Debugging is Twice as Hard
Join the DZone community and get the full member experience.Join For Free
I recently tweeted an article about a professor who posed a question to his student. The student gave a simple solution to the professors problem. He simply said the solution was too trivial, nothing worth writing a paper about.
Developers fall to the same affliction when trying to solve problems. They try to make their solution as complex or as involved as possible; Amaze in their ability to keep things in context and their non-trivial solutions! Fight the stack!
Developers are the only ones who read programs, machines just execute them. Let’s really take this point to heart. Readability over everything! How often do developers take into account the readers state of mind when writing code? How does that change when you are writing documentation? Both should emphasize clarity and simplicity.
When I am most in sync with another developer is when I am reading his/her code I understand their mental process when trying to solve the problem. That combined with a clear problem statement and comments is what its all about!
Anytime I am reminded of elegant solution to a problem it is usually deemed elegant simply due its innate ability to solve the problem at hand. It’s almost always easier to grasp and grok. Definitely easier to debug when you find a bug in your current implementation.
So with that said go refactor some shit. Write some tests. Comment your code.
Published at DZone with permission of Mahdi Yusuf, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.