The Composite design pattern has the intention to represent part-whole as your friends on social media or a tower, as in the picture below.

Tokyo skytree tower

Why this pattern?

Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly [1].

Using a composite structure, we can apply the same operations over both composites and individual objects. In other words, in most cases, we can ignore the differences between compositions of objects and individual objects.[2]



The diagrams below show how to identify this pattern and the participants.

When do you need to connect things, one of the options is to build a bridge, and this pattern is an example of it in code time upfront of integrations.

Forth Railway Bridge, Scotland
  • For more about this bridge, click here.


Excerpt from GOF book[1],

When an abstraction can have one of several possible implementations, the usual way to accommodate them is to use inheritance. An abstract class defines the interface to the abstraction, and concrete subclasses implement it in different ways. But this approach isn’t always flexible enough. …

Ready to not use your local environment? This is the idea behind the GitPod “Spin up fresh, automated dev environments, for each task, in the cloud, in seconds.


1. Why?

Don’t use your laptop/computer to code, instead use a browser to do it. Be Java, React, JavaScript etc.

2. Pricing

You can play into a free tier as I’m doing, that means 50 hours monthly.

3. How?

Click on the Try Now button if you’re a new user and the arrow indicates.

By default when I need to write a code to communicate with Repository I thought to use CrudRepository, but the JpaRepository also is an option, so should I review my bias?

A380 Cockpit — From Andrés Dallimonti

1. Acronym

  • CRUD — Create Retrieve Update Delete operation
  • JPA — Java Persistence Api
  • API — Application Program Interface
  • IDE — Integrated Development Environment

2. Objective

Explain the difference between the interfaces CrudRepository and JpaRepository.

3. CrudRepository and JpaRepository

To explain the difference let’s see the diagrams of each one.

3.1. CrudRepository

From my point of view, the CrudRepository is the most used in tutorials/articles and does your work well.

To prevent working with production resources in a local/dev environment the use of profiles is highly important, in this article let’s see how Quarkus helps us to achieve the environment configuration.

1. Definition

  • Profile → Provide a way to segregate parts of your application configuration and make it only available in certain environments [Spring].
  • Environment → An environment is a user-defined collection of resources that hosts an application. An environment is the application’s mechanism for bringing together components with the agent that deploys them. Environments are typically modeled on some stage of the software project lifecycle, such as development, QA, or production…

Since Java 1.5 when the Generics was introduced, the Java developer life changed a lot, and changed in a good way.
In this article will handle Covariance(? extends T) and Contravariance(? super T) and will be splitted into definition, example, and conclusion.

1. Definition

1.1. Covariance

Using the covariance is allowed to use any subtype of FirstClass, such as Suite and Superior instances.

List<? extends T>
// or in the example
List<? extends FirstClass>

1.2. Contravariance

Use elements defined to use in the declaration of its supertypes.

List<? super T>
// or in the example
List<? super Gourmet>

All super classes based…

A long time ago in a city far, far away…. 👾 well in fact was in Araraquara, Brazil 🇧🇷. Due to a connection speed we faced some problems to make the application start up properly (timeout), then a team mate, Eduardo had an idea to build a proxy[3] to solve the problem, from this day forward I would know of the existence of this pattern.


1. Which problem this pattern intent to solve?

Based on the GOF book “Provide a surrogate or placeholder for another object to control access to it.[1]”.

Sounds abstract, doesn’t it? 😟

Let’s see the definition by Head First book “A remote proxy acts…

Working with a dev environment is kind of different from prod, and managing the changes should be too. To achieve the changes Liquibase is an option rather than Hibernate create-drop strategy.

Database tables


To maintain all DB schema changes into one place, Liquibase has these reasons.

  1. Version-controlled database schema changes
  2. Automatically orders scripts for deployment
  3. Branching and merging for teams
  4. Embeds into your product or build tools, like Jenkins
  5. Easily rollback changes

For this tutorial, the focus will be on item 1.


Write code is great, but sometimes is better generate code than type them. For this article I’ll present some options, such as Lombok and MapStruct.

Time is money


As I said before, sometimes writing a repeated piece of code is not a good idea, since this is a DRY (Don’t Repeat Yourself).

Back in time, to 2000’s 👴 working with EJB 2.x the tool to generated code was XDoclet with Apache Ant if I’m not wrong and I have to say, I don’t miss that time.

After the arrival of the Java Annotations changed the game.

Lombok uses the Java Annotations feature to…

Working with Lists is a common task in Java, but this task should be done carefully whether the unmodifiable or immutable is required.


1. Why?

This article covers the change inside the elements of the List in order to avoid problems, for instance: Where is the element nth? Why did the element have one value and now has another value?

2. Benefits?

Retain the data as is, and don’t allow any element change, if required or a man in the middle.

3. Definition

1.1. Unmodifiable

The term unmodifiable means that the structure of the List itself cannot be altered[1].

1.2. Immutable

If the elements in the List are mutable (which…

Luiz Gustavo De O. Costa

Hi there 👋 , I’m Luiz Gustavo I’m a Brazilian and don’t play soccer very well, then I became a software developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store