55
-vim-
6y

Waisting some times on codewars.com

~~~~
3 kyu challenge:

Given a string with mathematical operations like this: ‘3+5*7*(10-45)’, compute the result
~~~~~

*Does a quick and easy one liner in python using eval()*

*sees people actually writing some 100 lines parsing the string and calculating using priority of operation*

Poor them...

(Btw, passed to lvl 4 kyu thx to this)

Comments
  • 14
    That's not the purpose of the task. The purpose is clearly to demonstrate knowledge of algorithms, and not to use someone else's implementation. This is literally cheating - when you take someone else's work and present it as your own in order to pass a task.
  • 11
    @AndSoWeCode yeah, but the goal of codewars is to demonstrate your knowledge of the language and come up with a solution that is “clever” or “best practices”, chose to go on clever. This is how you prove yourself on top of the others, by not making the move that comes right to your mind, but by trying to finding the way to ease your task.

    Also, the rule on codewars is simple: just don’t use answer sheets and don’t trick the verification system. Even if the author specifies to follow a specific rule, answers that don’t follow it will still get upvoted (even if I think they shouldn’t)
  • 12
    Because of you, I discovered codewars and that thing swallowed 4 hours of my evening. Thanks
  • 1
    I've done the opposite. I actually santitized a string and parsed a float out of it instead of using a parsing function, which the assignment asked for. I got 10 extra points.
  • 0
    ++ to this rant.
    Helped me know eval() and codewars
    Thanks
  • 2
    @MeanStreet works quite good on mobiles, so if you got time to spend on the go, it’s fun.
  • 1
    This should actually be solved with a binary tree otherwise eval or regex will do in couple of lines
  • 1
    @AndSoWeCode If that's cheating than every good developer should cheat. People that always reinvent the wheel are wasting their time and their company's time and resources when they bring that mentality to the workplace. That kind of thinking is how morons at my company ended up rewriting (worse and shittier) massive sets of existing functionality in the framework we use wasting thousands of company man hours and money to build shit that already existed. I came in and 'cheated' by using the existing functionality in the framework and utilizing open source libraries and saved the company thousands of hours and lots of money. If I was running a business I'd much rather hire the person that can complete the task in 1/4th of the time in one line of code rather than the guy banging his head against the desk writing thousands of lines of code in hundreds of hours which will likely devolve into a mess of unmaintainable nightmares which solve problems already solved a million times before.
  • 1
    @LicensedCrime a framework is not the answer for everything but let me give you an example of the sort of BS I deal with every day from people custom rolling their own solutions to everything under the sun. We work with fixed length files because we do it sucks but whatever. We have to parse these files into relational database tables. The first and second and third and last thought of everyone in this development team besides me was to write out custom loops, many of them, all over the place, to parse these documents based on shit tons of rules about what fields were what, what to cast values to etc. They spent literally weeks coding these features. I do one, I go to Google, find a library that will do 90% of the heavy lifting for me and turn what was 9,000 lines of code for them into a single function call that works flawlessly and can be implemented in an hour instead of weeks. That's real tangible progress that was made which saved the company thousands of dollars.
  • 0
    @LicensedCrime and more importantly my solution worked, was testable, handled edge cases well, performed over twice as fast and was just overall better in every way. Nobody else could say the same about their solutions. So are there times when you need to custom roll functionality or do stuff without a library or whatever?Sure, 40 or 50% of the work I do is like that, but I hate this mentality of just do it the hard way because... Someone else has already made the mistakes and spent hours of time to figure this problem out what exactly is the point of me replicating their effort when I can use my time to solve new problems that will help me in the code I'm working on now?
  • 0
    Framework or custom code
    Linux or Windows
    Object oriented or structural
    ...

    The NP problems of computer universe xD
  • 0
    @LicensedCrime fair enough and there are management problems to be sure so it's a multifaceted issue, if it didn't pay so well I would have been gone a while ago. And perhaps I should be more open to digging into custom solutions and solving problems without standing on other people's frameworks. Maybe I'll try out this code wars thing for fun this weekend and give it a shot.
  • 0
    @asinglenoob I'm not talking about production code, but about exercises meant to strengthen, test and compare people's abilities. Being a smartass is not a valuable ability. Knowing how to code however is.
  • 0
    great, now I have the urge to create AN ACTUAL MATH LIBRARY FROM SCRATCH
Add Comment