Recently, I get to know that writing code in the modular or components way is important. But I am not sure why is it so important.
Can someone explain why is it important if you know?
Recently, I get to know that writing code in the modular or components way is important. But I am not sure why is it so important.
Can someone explain why is it important if you know?
code modularity is important for code readability, maintainability and post production support.
If you write a function which has 500 lines of code, it will be very difficult to understand but if you break your 500 lines of code into 10 different functions, it will be easy to understand and debug.
Example: //without code modularity
Decide yourself which code is more readable. Here I have provided a very simple example but just think how will you maintain your code when it becomes huge.
Also, you can go through some online material to learn by yourself on best practices of code modularity.