Nowadays many developers know about advantages of tests. We know how they’re helping us when we need to change or refactor the code. We also know how helpful they can be when we want to describe or show how a particular functionality works.
We are encouraging to write tests. To cover your code. To decrease uncertainty.
Yet, I’m still seeing a lot of articles where someone shares his knowledge about particular features and… he shows how the code works using main() method:
public class WhateverApp {
public static void main(String[] args) {
DescribedFunctionalityProvider provider = new DescribedFunctionalityProvider();
Result result = provider.showHowYouDoingThings();
System.out.println(result.showThatReallyWorks());
}
}
I’ve got one simple question – why?