DEV Community

Discussion on: Bad Code Can Make for Good Learning?

Collapse
 
mrwesdunn profile image
Wes Dunn

Oh the joys of inheriting and maintaining a legacy codebase!!! Whether or not this question was inspired by a legacy codebase, the pain of inherited spaghetti-code definitely resonates with me. I have often remarked that my title should be code janitor. 🤣

As for the question, YES, ABSOLUTELY!!! Throughout the past few years, I’ve been tasked with refactoring and adding new features to a handful of applications that share a lot of the same C++ code (not modern c++ either, mostly C code that makes use of classes). As such, I’ve wandered into “dark corners” of this code that has befuddled me for days, but thanks to the excellent tooling Xcode provides, I’ve been able to grok the functionality of the code and get a sense of how that/those piece(s) of code interrelate to the entire application. Despite the all-too-often “WTF!?!” reactions to what I find, I believe it has been incredibly valuable to my overall domain knowledge, ability to identify code smells, and “how not to do things next time.”

Unfortunately, I think there are a lot of pitfalls to this kind of position. For me, it’s resulted in reusing other poorly written classes/methods/etc as a kind of “crutch,” in that those things can become excuses to not refactor things further than the scope of the work.