Thursday, 15 June 2017

This week 11/2017

After years of programming I have seen good presentations of Kamil Szymański and Jakub Nabrdalik, who in a easy way explained what is a clean code and how to implement DDD in your code. I always was listening to Sławek Sobótka but I  had never known how to write such code until I took a part in Jakub Nabrdalik presentation about class's scopes and hexagonal architecture. Jakub was pointing popular mistakes made by all kind of Java developers as:

- splitting code between packages which describe layers, not functionality

- publication all code of module instead of publish only classes which we want allow to be used by other modules,

- creating a lot of test and affection to them what made production code not refactorable,

- focusing on algorithm testing instead of testing module as black box using behavioural or acceptation tests.

Easy example shows that we should put all services and repositories to one package with package scope and don't publish them to the world. Only fasad interface and dto can be published. This way we care only about contract between fasad and its client. This is the place to focuses on test which check all module and its behaviours. Jakub thinks that unit tests which test internal classes of module could be always deleted if there is difficult to correct them after module's code refactoring.

However Kamil noticed that unit tests​ should test units, not classes, that's why we should care of test code quality the same as about production code.


Resources:

No comments:

Post a Comment