Sign in

Software Developer. Technical Writer.

Dealing with cross-cutting concerns

Photo by Taylor Vick on Unsplash


In this article, we’ll create a simple performance-logger-aspect. Using the logger-aspect, we’ll intercept each public method within a class marked with a specific annotation.


First, let’s look at a SimpleService with a create and update method:

With the use of delays, let’s assume that there are ongoing processes for both methods for simplicity.

Having that said, our goal is to log the performance of each method while maintaining a high cohesion and low coupling for our class.


There are other ways to handle the stated scenario; In our case, let’s suppose we wanted to conveniently annotate a class and…

A guide to clear a common misconception

Photo by Ben White on Unsplash

“There is no reason to use Java serialization in any new system you write.” — Joshua Bloch.

In 1997, serialization existed in Java. One of the mechanisms it was known for is to send object’s states over the network. As convenient as it sounds, the cons far outweighed the pros.

Fortunately, today, there are alternatives that we’ll refer to as cross-platform structured-data representations. While some referred to those as serialization systems, let’s avoid using that term to prevent mixing it up with Java Serialization.

In this article, we’ll talk about serialization. Next, we’ll take a closer look at one of…

Learn how to create a simple yet generic search

Photo by Isaac Benhesed on Unsplash

In this article, we’ll be discussing a common use case for JPA Specification.

First, we’ll start with the scenario wherein using JPA Specification would simplify our overall implementation. Next, we’ll take a look at how we’ll use it in our code. Lastly, we’ll explore its implementation.


A frequent use case is when we need to find record/s based on some columns where we define those columns in runtime.

For example, let’s assume that we are dealing with a Library Management System. Imagine a requirement to search for books using keywords without explicitly indicating if it’s from the title, genre, author

A practical guide in Java

Photo by Lance Anderson on Unsplash

1. Overview

Hexagonal Architecture is a pattern introduced by Alistair Cockburn, also known as the Ports and Adapters. It enforces inward dependencies to the Core Domain, which allows developers to test and develop features in isolation.

To visualize the usage of this pattern, let’s explore a simple scenario with an Online Store domain. Typically, a change in order status leads to the sending of a notification to the customer.

With the preceding scenario in mind, this article shows how to implement the Core Domain, Ports, and Adapters.

2. Core Domain

The Core Domain is where the business logic lives. As mentioned earlier, Imagine we’re dealing…

Avoid unnecessary headaches — figuratively and literally

Photo by Tim Gouw on Unsplash

I just witnessed yet another crime.

“A man gets shot.

He holds his breath and has enough strength to take a bus.

10 miles later the man gets off of the bus, walks a couple of blocks and dies.” — OscarRyz

Police happen to spot the body but have no idea what just happened.

The above describes what it’s like to swallow an exception. Kidding aside, it may already be a common knowledge to throw it instead of surrounding it with try-catch, but what if you can’t? Would you resort to swallowing the exception? It turns out you can do better.

When you can’t throw an exception — Scenario

With checked exceptions, you might…

A glimpse of both worlds from a developer’s perspective

Photo by Tanner Van Dera on Unsplash

As opinionated as this topic may be, I had thought of sharing my journey where I had been able to experience first hand working for both consulting and in-house companies. For this article, I would like to share the perks and challenges at work that I faced along the way.

In-house Company

I initially started my career as a Software Engineer at a multinational in-house company. Fresh out of college, I accepted their offer of a 3 month paid training program before becoming a full-time employee. 2 weeks into the training I was told by the Development Manager that I’ll be receiving…

Avoid N+1 Queries and retain the retrieval logic

Photo by Sam Pak on Unsplash

One of the first and most common problems encountered by developers who are new to JPA / Hibernate is n+1 queries. It’s because the code that is usually responsible for n+1 queries doesn’t look weird but looks so simple. It makes other developers unaware of the performance issue and only discovers it upon having enough data/records to the database.

It might look something as simple as this: person.getAddresses();

For this article, I’ll be discussing a simple yet common scenario wherein using “Join Fetch” would be beneficial. I’ll also include two integration tests to compare the performance. …

Using Individual Dead Letter Strategy

Photo by Goran Ivos on Unsplash

Exchanging messages from a microservice to another has never been easier. With the presence of modern web frameworks we are now able to bootstrap microservices from ground up with minimal configuration, e.g. Spring Boot which favors convention over configuration. It is also worth mentioning Spring JMS API — an abstraction layer to JMS that makes development easier because all connection, session, and JNDI contexts are all abstracted away. Combine this with Spring Integration Framework which allows services to communicate via message channels and in return makes the overall architecture loosely coupled.

While the things that I’ve mentioned are all good…

Beyond dependency injection

Photo by Maryjo Bautista

Most of the time, dependency injection is the first thing that comes to mind whenever the concept of inversion of control is brought up. For this article, I’d like to shed some light on method invocation as well, which is the concept being heavily utilized by Spring Integration.

Type-Level Coupling and System-Level Coupling

Before diving into the code, let’s first talk about the types of coupling inversion of control solves: type-level coupling and system-level coupling.

Type-level coupling is probably the most understood — it’s coupling between types, and it’s solved by using dependency injection. …

Dev INTJ Code

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