I've been working with software development for 4 years now with different groups and different companies. But nothing has changed as much as TDD did with my style of programming, thinking and solving problems.
Since I decided to learn TDD and apply it to my work I had a lot of questions. Does TDD really works ? Why should I spend my time writing test first ?
Though, those are questions often asked by who is starting with TDD but we can't stop on the first rock, we must keeping going. Instead what I've seen in many developers are the same excuses to not apply TDD or even worst to not stop and learn a amazing subject that will improve their productivity, will improve their code. "Look I'm out of my dead line and I can't spend my time on tests", "I'll apply TDD after I finish my project".
TDD for certainly is a change of paradigm. Specially for PHP developers who are often dealing with structured, this developers will be forced to use OOP instead.
Unfortunately humans are creatures of habits and I can't do nothing to change you either your friends or your parents. Just you can make the difference and make you a better professional.
The most issue I've crossed is to talk with developers who is not in the TDD world and when I face this situation I expose some advantages when using TDD.
- OOP : Is often a issue of developers who is not familiar with abstraction, design patterns and quality of code. Those developers often do their code with many responsibilities and often is impossible to test without refactor.
The first step to apply TDD is learn and understand OOP and their benefits. (I saw projects without any abstract class or interface, are they using OOP ?)
- SOLID: Is directly related to TDD and SOLID follows TDD in all of it stages
- Design Patterns: Usually are testable therefore are not easy to understand but once applied the maintenance is easy and the developers have a huge of information about Design Patterns on the internet.
TDD is changing the way of we developers do our job for a better way, it gives us a tremendous confidence on our code. But unfortunately it not comes on a blink an eye it takes time and dedication, researching and making mistakes. Please don't try to apply TDD in your project at the company at first, do it when you feel comfortable at home or any place that you like start a blank project and try to build something simple such as calculator or a classic app of to do.
Do you have any suggestions or question ? Please let me know on the commentary section bellow this post I'd like to hear from you!