In software industries, existing code maintenance is the biggest challenge. A huge part of total product cost is utilized to maintain existing bad code.
First, let me explain you bad code and good code
- Modular code
- Loosely coupled code
- High cohesion
- All conventions properly followed
- Readable code
- Expressive code
- Zero redundancy
- Proper credential store
- Combined code
- Tightly coupled modules
- Low cohesion
- Conventions not properly followed
- Complex code
- Files not a proper place
- Redundant code
Now, think of a case, when you want to make some changes to existing code which is not modular or tightly coupled with other modules. In both cases, you will end with a lot of code changes.
In loosely coupled modules, if you need to modify one module, then you will make changes only to that module. This will save a lot of developer time and maintenance cost. Also, chances of mistakes/missing change will be less in a good code.
We can also relate code quality to daily life.
Consider your room is a complete mess and you are getting late for your office. You don't know where you left your id. Now think of the effort and time you will require to find your ID when you don't have enough time.
Similarly, take the just opposite case. Your room is well managed, every item has a proper place. In this case, to find your ID you will directly go to the place where it should be.
Now, compare the effort and time consumed in both cases.
When it comes to debugging a good code, it consumes very less effort than a bad code.
Benefits of good code
1) Easy to maintain - A good quality code can be debugged very easily and in short time. As the code is not dependent on other modules there will be no problem in maintaining the code.
2) Low maintenance cost - As a code with good quality can be maintained easily and maintenance time is less. So, less development effort and the cost will be required to maintain the code.
3) Easy to debug - In a good quality code, when any issues occur, a developer knows where to look. So debugging becomes easy.
4) Chances of mistakes are very less - As the code is loosely coupled, so there is no chance of dependent code. So the chance of mistakes is negligible.
5) Modules can be upgraded easily - As the modules are independent. So we can easily upgrade modules one by one. Whole software/product update is not required.
6) Easy to scale - We can take the case of microservice architecture. We can scale modules independently as per the load on a specific module.
7) Easy to understand - It will be very easy for a new developer to understand a good quality code.
I hope you liked the blog. See you on the nEXt one...
More CONTENT to COME...STAY TUNED!