When you are developing something with a little more complexity than a hello world software (which should be all the time) it is REALLY important to have at least three different environments: Development, Test / Staging and Production. This is even more important in web development as it is “fairly” easy to do in small / medium projects.
The Development environment is where developers live and breathe, where they make all the changes, mistakes and fixes that you need. It’s like a small lab where nobody judges you, where it does not matter if you break the CSS or your whole webpage as nobody is going to notice. Once you achieve something, like developing a new item of a list, fix a bug, or a new functionality, you should stop and move your functionality to the Testing environment.
The Testing / Staging environment is a little different. Actually, there is a slight difference between testing and staging environments, but to distinguish them is not the point here. You need something that acts as a copy of your corporate site, a copy of the live version. It should be EXACTLY the same, because you are going to test in this environment your new developments, you want to know how it will work and IF it will work live before going live. Only once you have verified that everything works, that your new functionality has not broken anything, you can migrate the changes to the production environment.
Finally, the Production environment. It is the live version of your site / software. You should only use in this environment things that you are 100% will work and that have been tested. You should NEVER make changes in production directly. It sounds easy to follow but it isn’t. When you see that you can “fix” something easily in production, hold that thought. Even if it is just one line of code, don’t do it, test it before. Some of the reasons to ALWAYS follow this rule is that a small change can break things, and that if you skip one of this steps you risk creating glitches between your different environments which in turn will increase the possibility of new failures.
The number of places where this simple rule is not followed is still huge, and the worst of it all is that the reason in most cases is pure human laziness, not computational complexity.After all, it’s actually an easy to follow rule:
Experiment on the development environment, Test it on the Test environment and if it works Migrate the changes to the Production environment.
Next time you are coding, please work in different environments as you should always do; it makes the world a better place.