The Composite pattern is a very powerful design pattern that you use regularly to manipulate a group of things through the very same interface than a single thing. By doing so you don’t have to discriminate between the singular and plural cases, which often simplifies your design. Yet there are cases where you are tempted [...]
Continue Reading »
Tags: closureofoperation, composite, design, fold, functional, intentionrevealing, interface, java, language, oo, pattern, Programming, trick
Posted in Functional style, Programming • Comments Off
In the first part of this article we introduced predicates, which bring some of the benefits of functional programming to object-oriented languages such as Java, through a simple interface with one single method that returns true or false. In this second and last part, we’ll cover some more advanced notions to get the best out [...]
Continue Reading »
Tags: ddd, design, functional, interface, java, language, logic, optimization, predicate, Programming, specification, subsumption, testing, trick
Posted in Patterns, Programming, ddd • 2 Comments »
You keep hearing about functional programming that is going to take over the world, and you are still stuck to plain Java? Fear not, since you can already add a touch of functional style into your daily Java. In addition, it’s fun, saves you many lines of code and leads to fewer bugs. What is [...]
Continue Reading »
Tags: ddd, design, functional, interface, java, language, predicate, Programming, specification, trick
Posted in Programming • 6 Comments »
If you happen to create your own annotations, for instance to use with Java 6 Pluggable Annotation Processors, here are some patterns that I collected over time. Nothing new, nothing fancy, just putting everything into one place, with some proposed names.
Continue Reading »
Tags: annotation, configuration, convention, default, dependencies, design, pattern, syntax, tool, trick, xml
Posted in General, Patterns, Programming • Comments Off
Small details matter because you deal with them often. Any enhancement you make thus yields a benefit often, hence a bigger overall benefit. In other words: invest small care, get big return. This is an irresistible proposal! Examples of small design-level details that I care about because I have experienced great payback from them: Using [...]
Continue Reading »
Tags: craftsman, ddd, design, domain, human, methodology, Programming, trick
Posted in Programming • Comments Off
Information hiding is one of the very essential principles of object orientation. If you dont know it well, I suggest you take a look at it on the Web, e-g at UncleBob. But information hiding is much more than just putting data private through accessors to protect them, it is especially a great tool to [...]
Continue Reading »
Tags: analysis, encapsulation, idiom, oo, primitive, trick
Posted in Programming • 1 Comment »
In a recent project I was asked to parse massive XML document from a third party provider. We had two problems: the xml document definition was very massive, with about 120 groups of different elements, leading to a total of around 1500 different elements to parse into java objects. The other problem was that our [...]
Continue Reading »
Tags: codegeneration, java, pattern, Programming, trick, xml
Posted in Programming • Comments Off