Is Maintainable / Clean Code is a Requirement to Your Apps?

Dirty code? That is code produced without considering the maintainability aspect. You can consider a code as dirty when there are tightly coupled, using arrays or map-based instead of data structures, or use hacks like global variables. One characteristic of dirty code, is when the application become large or complex, it is hard to extend or modify and prone to error while doing so. Is you application need the opposite (called clean code)? Not every apps need clean code, and here is why.

Will it be Used in Production or Live?

Code that is intended for research purpose (especially research for dirty code or coupling), can be as dirty as it is, since it's original purpose is only one, that is for the research. Similar situation where the code are used for requirement collections such as mock ups or prototypes, does not need to be clean. Just make sure, that the code does not goes into production, otherwise it will require clean code.

Is the Application will be Extended / Modified?

There are some applications which will not be extended or modified even when used in production. It can consist of one-time used application (such as data conversion apps, or file cleaner), or application that only do one thing only (in my case I made an app which prevent the pc from sleep or showing screen saver). 
However for the second case, usually there will be extension somewhere (such as the prevent screen saver has time limit or based on some event occurred). As soon as your apps seems like need adjustment / modification, then make it clean.

Is it Embedded Software?

My point here is not that embedded software does not need clean code. It need clean code, but second priority to fast-optimized code. Since clean code are usually achieved by abstracting thing, it is not achievable in embedded environment, which need fast response such as car's ECU.

Is it Used during Examination?

You are doing university thesis or other's thesis? Do it quick and dirty, since it will only require small modifications and will not have long life cycle. Are you trying to explain something to other (such as hello world in c# or bubble sort)? Do it fast, they only need the concept!


There are some cases where dirty code having places, but in most of situation, it is not that worth for having dirty code. If you care about your house, your bedroom, bathroom, living room, dining room, electricity, conduit, air flow, etc, make it clean and maintainable. Otherwise just make a square with everything in one room, it is faster and cheaper, but un-maintainable, not pretty and prone to dangers.
Post a Comment