Skip to main content


Showing posts from October, 2015

How to deal with difficult code

I have recently been working on a piece of very complex and very poorly designed code. It has been very difficult staying focused on the task at hand because I just can't keep everything going in my mind. I lose track of what path I was working on or how I got to a specific spot in the logic tree.

What can I do in this situation?

Unfortunately, I can't completely rewrite the entire section of code, even though it desperately needs it. Even if I was free to rewrite the entire piece of the system, I don't have a good enough understanding of it to be able to completely rewrite it without breaking it. I can, however, make changes to the code to make it easier to understand. I can accomplish this without changing any of the logic in the code. This will shrink down the amount of code I need to work with.

I can start by taking a piece of code and break it out into its own method. This new method will do nothing different than what it was previously doing. It will receive a name t…