design

A collection of 14 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Apr 14, 2024 languages design object orientation functional programming

Dissolving Design Patterns In Design Elements

The book Design Patterns: Elements of Reusable Object-Oriented Software was one of the texts that changed how we think about software design.

Stefano Fago
Nov 19, 2023 languages design errors handling

A retrospective on Errors Management: where do we go from here?

Error management is a fact of life in software development as it is often inevitable and generated by different causes that also include incorrect or incomplete understanding of the requirements or even lack of knowledge of some tools or elements used during development.

Stefano Fago
Nov 17, 2019 docker design

Composition over inheritance applied to Docker

This post is neither a recommendation, nor even a suggestion. It’s just me toying with an idea: Implement it at your own risk! The main benefit of Docker containers is that they are self-contained. For developers, that means one just needs to inherit from the desired Docker image that contains the necessary required dependencies, and presto, one can build one’s application deliver it to production. Most of the times, the process is pretty straightforward.

Nicolas Fränkel
Oct 14, 2018 api jdk design cloneable

Cloneable, a Java design gotcha

Some time ago, I described a couple of surprising design choices in the JDK functional interfaces API. Lately, during a lesson, a student of mine proposed to shallow-copy an ArrayList by using the clone() method: I thought this is another API gotcha worth writing about. Cloning an object means a new object is created with the same state as the original one. As per the JavaDoc: Creates and returns a copy of this object. The precise meaning of 'copy' may depend on the class of the object.

Nicolas Fränkel
Dec 17, 2017 jdk functional interfaces design

Design gotchas in JDK's functional interfaces

Because of a course I prepared, I recently had a closer look at the java.util.function package in JDK 8, and discovered a couple of interesting design choices. A Callable and a Supplier are defined in the same way. But they are not equivalent.

Nicolas Fränkel
Apr 23, 2017 spring boot design

Fixing my own Spring Boot starter demo

Since one year or so, I try to show the developer community that there’s no magic involved in Spring Boot but rather just straightforward software engineering. This is achieved with blog posts and conference talks. At jDays, Stéphane Nicoll was nice enough to attend my talk and pointed out an issue in the code. I didn’t fix it then, and it came back to bite me last week during a Pivotal webinar.

Nicolas Fränkel
Apr 2, 2017 spring mvc clean code design

Common code in Spring MVC, where to put it?

During my journey coding an actuator for a non-Spring Boot application, I came upon an interesting problem regarding where to actually put a snippet of common code. This post tries to list all available options, and their respective pros and cons in a specific context. As a concrete example, let’s use the REST endpoint returning the map of all JVM properties accessible through the /jvmprops sub-context. Furthermore, I wanted to offer the option to search not only for a single property e.

Nicolas Fränkel
Mar 12, 2017 design object oriented programming tooling bean validation kotlin ide

Coping with stringly-typed

UPDATED on March 13, 2017: Add Builder pattern section Most developers have strong opinions regarding whether a language should be strongly-typed or weakly-typed, whatever notions they put behind those terms. Some also actively practice stringly-typed programming - mostly without even being aware of it. It happens when most of attributes and parameters of a codebase are String.

Nicolas Fränkel
Feb 26, 2017 class method design

A use-case for local class declaration

One of the first things one learns when starting with Java development is how to declare a class into its own file. Potential later stages include: Declaring multiple classes into the same file - with at most one of them publicDeclaring static nested classes or inner classesDeclaring anonymous (inner) classes But this doesn’t stop there: the JLS is a trove full of surprises. I recently learned classes can be declared inside any block, including methods.

Nicolas Fränkel
Oct 16, 2016 design api extension function

Extension functions for more consistent APIs

Kotlin’s extension functions are a great way to add behavior to a type sitting outside one’s control - the JDK or a third-party library. For example, the JDK’s String class offers the toLowerCase() and toUpperCase() methods but nothing to capitalize the string. In Kotlin, this can be helped by adding the desired behavior to the String class through an extension function: fun String.capitalize() = when { length < 2 -> toUpperCase() else -> Character.

Nicolas Fränkel
May 29, 2016 design object oriented programming

Encapsulation: I don't think it means what you think it means

My post about immutability provoked some stir and received plenty of comments, from the daunting to the interesting, both on reddit and here.

Nicolas Fränkel
Aug 31, 2014 design exception spring

Using exceptions when designing an API

Many knows the tradeoff of using exceptions while designing an application: On one hand, using try-catch block nicely segregates between regular code and exception handling codeOn the other hand, using exceptions has a definite performance cost for the JVM Every time I’ve been facing this quandary, I’ve ruled in favor of the former, because 'premature optimization is evil'. However, this week has proved me that exception handling in designing an API is a very serious decision.

Nicolas Fränkel
Jun 9, 2014 design exception

A single simple rule for easier Exception hierarchy design

Each new project usually requires setting up an Exception hierarchy, usually always the same. I will not go into details whether we should extend RuntimeException or directly Exception, or whether the hierarchy roots should be FunctionalException/TechnicalException or TransientException/PersistentException. Those will be rants for another time as my current problem is completely unrelated. The situation is the following: when something bad happens deep in the call layer (i.e.

Nicolas Fränkel
Jun 15, 2009 architecture design eda ego ego driven architecture

Ego Driven Architecture

Whoever is in charge of software architecture, be they senior developers, whole teams like in agile practice or architects-per-se, it is a deep trend to apply what I like to call Ego Driven Architecture (or EDA for short, not to be mistaken with Event Driven Architecture). When one has to choose an architecture, one should design it from a number of objective criteria, including: business requirements,technical constraints,ease of use,maintenance costs,etc.

Nicolas Fränkel
A Java geek © 2008-2026
v. bc04c88300c3ec997ce8470fbff5395dc9e518b1/13264050981
Latest Posts