more with lessFebruary 20, 2008
Every programmer wants their code to run as fast as possible with as little processing imaginable; this takes some time to figure out. Writing out some good logic can sometimes be pretty easy. In fact, usually when a programmer has a task to complete, they have 3/4 of it already done in their mind. Then, when we’re ready to start typing, and after a few tries, your lovely logic comes to life.
Usually the first attempt isn’t that great. Code can always be shorter then when it was originally written. It’s a pain sometimes to simplify things. Like Einstein said, “Everything should be as simple as it is, but not simpler”; easier said than done genius.
There are tons of programming devices that can make your code a little easier on the eyes, as well as processor power. Take advantage. There are loops, arrays, functions, (to name a few) that can help you get your 14 lines down to 4. Experiment with alternate solutions and try and simplify.
I don’t mean to get all sentimental on you, but this can really apply to any life situation. Simple doesn’t always mean something lacks complexity. Often times the most simplest ideas are the most confusing to really understand. Shorter code = better programming; it’s that simple.
“If I had more time, I would have written a shorter letter.” – Blaise Pascal