If you are a tech co-founder you always think to write scalable code for your startup.
Or if you are a job seeker, you may come around with this line in many job description
“Should be able to write scalable code”
Lemme give a quick overview of how to write scalable code.
Some gentleman said that
“Scalability can be judged on how many lines of code you need to modify to make the code implement the new requirement.”
Let's quickly understand this by taking some real-life cases
You are writing code in which you have used some constants like API Keys, URLs, etc etc in 10-12 files.
Now imagine URLs got changed or any other const gets changed, you need to change it in every file.
A simple scalable solution is to, maintain a configuration file and store all constants.
You can now simply import this file and use it everywhere you need. you have a single source of truth now.
Less amount of time and changes are required to modify the code in this way.
Writing meaningful variables and class names is also a part of scalable coding.
Imagine now, after 4 months, the functionality needs to be changed.
You have forgotten what the code was doing but meaningful names guide you and remember the whole purpose of the code in less time.
Modularization means dividing the code into sub-tasks. It makes the code more readable and reusable.
It fastens the development and deployment process.
Implementing caching can easily reduce the run time by storing previous results.
Proper Error handling is a crucial part of scalable coding.
Top comments (0)