Bootcamp Highlights - Unit Testing at Promoapp
Guest Blog by Randy Slocum
Promo app started by teaching us that continuous feedback helps create valuable code the customer and developers are confident in. We want a fast, reliable, refactored code. We also want code that isolates that codes' failures.But how do you write code like this? With the SOLID principle!S - Single Responsibility. Your applications should do one thing and do it right! Keep functionality simple from everything from applications down to variables.O - Open Closed principle. All artifacts should be open for extension, but closed for modification.L - Liskov's substitution principle: Any part of your code can be substituted by any other types.I - Interface segregation. Keep each interfaces simple with only one function.D - Dependency inversion. Abstractions should not depend on details, details should depend on abstractions. A car should depend on its parts, not the other way around.Exercise these principles, and you can use libraries like Mock and Fixture to help make unit testing fun!