Factories and packages

A few weeks ago Uncle Bob wrote a blog post about if/else/switch being a dependency magnet. He recommended reversing dependencies by using polymorphism, and he chose a factory pattern to do that. It was a very useful post, and I completely agree with its main point, but it got me thinking - do we really need factories for that?
Read More

Object oriented JSON mapping

Sometimes we need to transform JSON files from one schema to another. These transformations can be straightforward, or there can be complex rules. This is one of the problems developers usually solve by writing procedural code, even in object oriented languages. . .
Read More

Isolation makes tests tautological

All tests have the expected part and the actual part. Tautological tests are tests where expected and actual parts are equivalent in some respect such that it makes them useless or meaningless in that respect. Isolation by mocking makes tests tautological.
Read More

Wine and potency

We know we can eliminate controllers, services, factories, managers, helpers and other obscure technical "objects" which don't exist in the real world. Can we eliminate "collection objects" as well?
Read More

Two layer repositories in Spring

Persistence is one of the most difficult and confusing problems in object oriented programming, which, it might seem, will never be solved. Databases are about individual rows of data, objects are about individual instances of behaviour. It is not obvious how they can be mapped. . .
Read More

Building vertical decorators right

If you read Elegant Objects, you probably know about vertical decorator pattern. However, there are right ways and wrong ways to do it. In this post I want to propose a few additional rules I haven't seen in the book, even though I think they are there implicitly. . .
Read More