41
donuts
8y

Just spent 20 minutes implementing a utility class.... then realized I don't need it...

The solution is actually much simpler... only takes 1 line of code...

Comments
  • 1
    That's a good thing...
  • 0
    @nickhh How so? I wasted 20 minutes?
  • 2
    The best code is the code which you don't have to write. Apparently the functionality which you need is already present and you just reused it. Win!
  • 0
    @nickhh what if this were a tedhnical interview question?
  • 4
    But it wasn't this time. I do agree with your frustration, but it's better then never figuring out the one-liner
  • 6
    I do this all the time. I've learned there's often a simpler solution, so in my code I'll scribble my obvious solution onto some paper (so noone sees it on screen/doesn't accidentally get committed). Then once I've got a handle on what the solution might be, I get a coffee, have five minutes and then think how it might be done simpler.

    Eventually patterns form and when you start encountering similar problems you learn how those might be solved.

    It's how we learn and become better programmers.
  • 0
    @nmunro Nice comment.
Add Comment