Put your system under test
The code we cannot test it's bad! How we can turn legacy code into clean code? Legacy code can be very hard to update and maintain and It can cause many problems, even between people. I've had a very bad experience working on code without any point of reference and documentation. The larger are the amount of legacy code, the more problems you will have in any case.
There are many refactoring techniques and we can read and write dozens of posts. All is good and we can always learn to practice and increasing the code quality. Use design patterns to face and solve common problems and don't forget the tests! There are specific test design patterns really useful to follow a common practice to test a design pattern implementation.
Write unit tests
Unit tests will allow you to isolate entities, responsibilities, eliminate dependencies and they will help you a lot to keep the code clean, simple and easy to read, understand, manage and update. That's easy to say but all we want this and we want to keep all plain and simple so we will take our time to write good tests. Even if it will seem to slow you. But it will not slow down anything! Because if you don't spend time to write tests, you will spend much more time to solve problems. No matter how good you are, no matter how careful you are. The code will rot during time and
Eliminate or reduce them into a minimal number. Sometimes dependencies are necessary but they are always difficult to manage. Sometimes it can be helpful to remove the production code and refactor the same function only keeping the essential.
Setup Continuous Integration tools for your environment
- Code Coverage
- Continuous integration tools: Jenkins, Xinc (for PHP)
- Build tools: Ant, Maven, Artifactory
Being professional with Continuous Delivery
Martin Fowler speaks about continuous delivery as a new frontier of software delivery. I think continuous delivery is a practice we must reach only having a good work environment, the right tools, and good and clean code. Only with the clean code we can extend, update and release fast without difficulties.