Dependency Injections

Design Patterns Explained – Dependency Injection with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

Dependency injection is a programming technique that makes a class independent of its dependencies. It achieves that by decoupling the usage of an object from its creation. This helps you to follow SOLID’s dependency inversion and single responsibility principles. As I explained in my previous articles about the SOLID design principles, their goal is to improve the reusability of your …

design principle_ service locator

Design Patterns Explained – Service Locator Pattern with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

The service locator pattern is a relatively old pattern that was very popular with Java EE. Martin Fowler described it in 2004 on his blog. The goal of this pattern is to improve the modularity of your application by removing the dependency between the client and the implementation of an interface. Interfaces are one of the most flexible and powerful …

Design Principles

Design Patterns Explained – Adapter Pattern with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

Design patterns provide a reliable and easy way to follow proven design principles and to write well-structured and maintainable code. One of the popular and often used patterns in object-oriented software development is the adapter pattern. It follows Robert C. Martin’s Dependency Inversion Principle and enables you to reuse an existing class even so it doesn’t implement an expected interface. …

Dependency Inversion Principle

SOLID Design Principles Explained – Dependency Inversion Principle with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

The SOLID design principles were promoted by Robert C. Martin and are some of the best-known design principles in object-oriented software development. SOLID is a mnemonic acronym for the following five principles: Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle Each of these principles can stand on its own and has the goal to …

SOLID Design- Interface Segregation Principle (1)

SOLID Design Principles Explained: Interface Segregation with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

The Interface Segregation Principle is one of Robert C. Martin’s SOLID design principles. Even though these principles are several years old, they are still as important as they were when he published them for the first time. You might even argue that the microservices architectural style increased their importance because you can apply these principles also to microservices. Robert C. …

SOLID Principles- Liskov Substitution (1) - 2 dogs graphic

SOLID Design Principles Explained – The Liskov Substitution Principle with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

The Open/Closed Principle, which I explained in a previous article, is one of the key concepts in OOP that enables you to write robust, maintainable and reusable software components. But following the rules of that principle alone is not enough to ensure that you can change one part of your system without breaking other parts. Your classes and interfaces also …

SOLID Principles- Open Closed principle - door graphic

SOLID Design Principles Explained – The Open/Closed Principle with Code Examples

Thorben Janssen Developer Tips, Tricks & Resources

The Open/Closed Principle is one of five design principles for object-oriented software development described by Robert C. Martin. They are best known as the SOLID principles: Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion All 5 of these design principles are broadly used, and all experienced software developers should be familiar with them. But don’t worry, …

SOLID Principles in Java - Swiss Knife Minimalistic Design

SOLID Design Principles Explained – The Single Responsibility Principle

Thorben Janssen Developer Tips, Tricks & Resources

SOLID is one of the most popular sets of design principles in object-oriented software development. It’s a mnemonic acronym for the following five design principles: Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion All of them are broadly used and worth knowing. But in this first post of my series about the SOLID principles, I …

Java Graphic

The State of Java in 2018

Thorben Janssen Developer Tips, Tricks & Resources

2017 has been a turbulent year in the Java world. The long-awaited release of Java 9 brought a lot of changes and interesting new features, and Oracle announced a new release schedule for the JDK. And that was just the beginning. In the past, developers often complained that Java wasn’t developing fast enough. I don’t think you will hear these …

Concepts of cloud computing

What is Cloud-Native? Is It Hype or The Future of Software Development?

Thorben Janssen Developer Tips, Tricks & Resources

For quite a while now, cloud-native has been one of the hottest topics in software development. Some developers just call it hype that will lose traction and disappear after some time. For others, it’s the future of software development. Whatever the future will bring, cloud-native is currently one of the biggest trends in the software industry. It has already changed …

OOP Concept Composition Definition and Examples

OOP Concepts for Beginners: What is Composition?

Thorben Janssen Developer Tips, Tricks & Resources

Composition is one of the fundamental concepts in object-oriented programming. It describes a class that references one or more objects of other classes in instance variables. This allows you to model a has-a association between objects. You can find such relationships quite regularly in the real world. A car, for example, has an engine and modern coffee machines often have …

What is Polymorphism

OOP Concepts for Beginners: What is Polymorphism

Thorben Janssen Developer Tips, Tricks & Resources

The word polymorphism is used in various contexts and describes situations in which something occurs in several different forms. In computer science, it describes the concept that objects of different types can be accessed through the same interface. Each type can provide its own, independent implementation of this interface. It is one of the core concepts of object-oriented programming (OOP). …

OOP Concept for Beginners: What is Inheritance?

Thorben Janssen Developer Tips, Tricks & Resources

Inheritance is one of the core concepts of object-oriented programming (OOP) languages. It is a mechanism where you can to derive a class from another class for a hierarchy of classes that share a set of attributes and methods. You can use it to declare different kinds of exceptions, add custom logic to existing frameworks, and even map your domain …

Java OOP Concepts

OOP Concept for Beginners: What is Encapsulation

Thorben Janssen Developer Tips, Tricks & Resources

Encapsulation is one of the fundamental concepts in object-oriented programming (OOP). It describes the idea of bundling data and methods that work on that data within one unit, e.g., a class in Java. This concept is also often used to hide the internal representation, or state, of an object from the outside. This is called information hiding. The general idea …

OOP Concept for Beginners: What is Abstraction?

Thorben Janssen Developer Tips, Tricks & Resources

Abstraction is one of the key concepts of object-oriented programming (OOP) languages. Its main goal is to handle complexity by hiding unnecessary details from the user. That enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity. That’s a very generic concept that’s not limited to …

Java custom exceptions

Why, When and How to Implement Custom Exceptions in Java

Thorben Janssen Developer Tips, Tricks & Resources

We already talked a lot about exception handling on this blog and described the differences between checked and unchecked exceptions, best practices and common mistakes. If you’ve read these posts, you probably recognized a pattern. You should provide detailed information about the situation that caused the exception, and you should not remove anything that might be useful to the caller. …

Performance tuning tips for Java

11 Simple Java Performance Tuning Tips

Thorben Janssen Developer Tips, Tricks & Resources

Most developers expect that performance optimization is a complicated topic that requires a lot of experience and knowledge. Okay, that’s not entirely wrong. Optimizing an application to get the best performance possible isn’t an easy task. But that doesn’t mean that you can’t do anything if you haven’t acquired that knowledge. There are several easy to follow recommendations and best …

Java Microservices

Communication Between Microservices: How to Avoid Common Problems

Thorben Janssen Developer Tips, Tricks & Resources

In one of the previous posts, I showed you how to build a microservice with Java EE and JBoss Forge. But building one microservice is obviously not enough. The overall idea of this architectural style is to implement an application as a system of services. In the beginning, that seems like an easy task. As long as each service solves only …

Common Mistake to Avoid with Java Exception Handling

7 Common Mistakes You Should Avoid When Handling Java Exceptions

Thorben Janssen Developer Tips, Tricks & Resources

Handling an exception is one of the most common but not necessarily one of the easiest tasks. It is still one of the frequently discussed topics in experienced teams, and there are several best practices and common mistakes you should be aware of. Here are a few things you should avoid when handling exceptions in your application. Mistake 1: Specify …

How To Handle Java Exceptions

9 Best Practices to Handle Exceptions in Java

Thorben Janssen Developer Tips, Tricks & Resources

Exception handling in Java isn’t an easy topic. Beginners find it hard to understand and even experienced developers can spend hours discussing how and which Java exceptions should be thrown or handled. That’s why most development teams have their own set of rules on how to use them. And if you’re new to a team, you might be surprised how …