Pay Now or Pay Later

If you quickly write hacky code now, you will pay the price with bugs and maintenance later. Usually it is worth the time to do the hard work now because fixing bugs can be exponentially more costly than writing good code in the first place. However, in some situations, quickly writing hacky code is actually the right thing to do. If you are playing with code to learn a new concept (for example, experimenting in the console), there is no reason to follow all your standards. Your code is thrown away as soon as it is executed. If you want to quickly build a prototype to prove that some idea can actually be implemented, a quick, hacky solution might be best. When you decide whether you will write quick-and-dirty code or high-quality ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.