As a developer or a developer intern you may be well aware about your Software Development Lifecycle. Have you heard of Life Cycle of a Code? I plan to discuss on how this works in this article.
Life Cycle of Code can be very different depending upon who is writing the code and for what purpose. For e.g, a school student writing code for assignment is different then a college grad writing code to finish his/her project related work, then writing code for a competition. What we would be discussing here will the most common scenario when we write Code in our Profession (some call it passion) to create something which works and which we can be proud of.
There are various phases through which a code undergoes transitions. Lets review the journey of transformations from one stage to another.
The Birth (Development Phase)
A developer’s machine is where it all starts. You may unleash your creativity and give birth to the code. Your code is a culmination of requirements, understanding a problem, design before it is even authored. The code goes over lot of changes, makeovers, fixes, refactoring, redesign before it is pushed to a code repository. While we shall get to the finer points but you may agree that your code goes through multiple iterations due to change in requirement, bug fixes, design changes, etc. before it sees the light of the day.
Note: After all change is the only constant.
The Toddler (Integration Phase)
Over a period of time your code has now grown into a toddler. As a parent, you feel good about the code and you push it to next stage of his life. It shall be deployed to a dev-integration environment. Here your code gets to mingle with other kids, teen, adult, parents, grand parents of all other developers or teams.
Integration testing ensure things work the way they are supposed to work. This is the place where you resolve dependency issues which is otherwise difficult to find while developing locally on your machine and unit testing.
Like any other young kid your code is bound to do some mistake and as a good parent one would want to correct them. So we fix the problems or bugs found in integration phase and again deploy the code and repeat the steps. You continue to iterate until it completely works as per your requirement or time runs out. In most cases it is later than the former.
Note: A stitch in time saves nine. Earlier you fix issues sooner you output quality code.
The Teenage (QA Phase)
Once your code is tested it matures to a teenager and moves to an environment where a developer’s scope ends and QA takes over the responsibility. It’s more like sending your child to the outside world and hope that they face all the challenges and become a winner.
QA continues to deploy code in their environment and the real test starts. Your code in QA is as good as a real world struggle, they succeed mostly but a few bugs do get raised eventually and you will have to help prepare your code to deal with such situations. Of course you cannot instruct them to handle everything and one would have to learn from their mistakes right? The vicious circle of QA raising bugs and fixed by developers and back to QA continues until we think our code is adult enough to handle the next step.
Note : 80:20 Rule for Code. 80% of bugs are raised against 20% of code. Read more
The Adulthood (Staging phase)
Once the QA phase is passed, your code is brave enough to be an adult is moved on to an environment which we call the Staging or Pre-production (or sometimes called the UAT, although in organisations UAT is different from Staging). Consider this as a University or internship period where your code is tested for business use-cases. Your code will be tested on performance factor, stress factors along with the conventional methods such as manual testing with production or test data. This will prove if your code is ready to face challenges of the real world.
This environment is called pre-production because it’s supposed to be as similar as production. In term of hardware, software, setup, topology, data etc. Limited iteration happens here.
The Adult (Production phase)
Once your code is signed off from staging, it is time to push the same code into the production phase and perform the final round of testing. This is a place where your code is finally out in the world, doing things you trained your child to do, the way you wanted. All are happy. It feels as good as getting your first paycheck.
The Death (Or Rebirth)
While it is your code and you may have some attachment to it, all good things come to an end, so does the code. It is only in a few cases your code may live longer to tell a great story. Some die an early death. Some die a natural death and is replaced by more efficient and dynamic piece of code. Some die just because your code was not meant to be alive for long.
As a developer, it’s very important to know what happens to the line of code you write. What stages are involved before it’s out in the world. Also, it is always better to give a new life to your code rather than seeing him die one day. Keep improving, making it better when you write code, and at same time making sure you are not inviting bugs to the party. It’s always very hard to do this and only few best developers can achieve this. The question is, are you one of them??