5 ms·
Solve the problem before you code the solution. That may be obvious to this crowd, but I learned it the hard way! I competed in the ACM programming competitio
by jakevoytko 16y ago
Solve the problem before you code the solution.
That may be obvious to this crowd, but I learned it the hard way!
I competed in the ACM programming competitions in college, so I did lots of practice problems. When I coded up-front, I would first represent the problem description as data structures and solve it from there. This is obviously flawed, since I had no idea whether any of it was useful! Sometimes they weren't, and sometimes I missed obvious tricks and wasted a lot of time. When I first worked out a solution on pencil and paper, I always knew what code needed to be written.
- clueless123 16y agoCoders do two things: Thinking and Typing.. the more you do of one, the less you do of the other
- ttorn1 16y agoBut the more typing you do, the more time u'll have to spend on thinking later.
- jakevoytko 16y agoAh, well said!
- endlessvoid94 16y agoUnless you're writing Java.
- ssp 16y agoSolve the problem before you code the solution. That may be obvious to this crowd, but I learned it the hard way! That's likely far from obvious to this crowd (if it has been paying attention). Paul Graham advocates the exact opposite: "exploratory programming", where you start writing the program without even knowing what the problem is, let alone the solution. I personally agree more with you than with Graham, though.
- gruseom 16y agoThose two things aren't contradictory. The first is about answering a well-defined technical question. The second is about deciding what program to write.