OCP

Builder pattern and Immutable Objects

Posted on

Immutable Objects An immutable object is a read-only object (you cannot change it’s properties). It’s easy to test and automatically thread-safe. Since it’s properties cannot be changed. The object will never have an invalid state. Follow this strategy to make a class immutable: Use a constructor to set ALL properties of the object (it’s immutable, […]

OCP

Singletons compiled

Posted on

Intro to singletons When applying the singleton pattern we are aiming to create only one instance of a class in memory of the application. Singleton pattern makes sure that: only one instance of a class is in the application there is one point of access to this object within the application Singleton: Singletons are obtained as […]

OCP

Did you know – Advanced Class Design

Posted on

Can you stay with me till the end of the post? 🙂 Did you know that: The return type of an overridden method should be the same or more restrictive aka covariant return types abstract methods are not allowed in a class that is not abstract all methods in an interface are public the interface itself […]

Tutorial

JavaScript: async / await

Posted on

As a Java developer it speaks for itself that I’m using Java most of the time. Recently I had to develop an AWS Lambda using Node.js. I had a great time learning about JavaScript. I learned about promises, async/await and functional programming in JavaScript. I created a small code-example below. This example will fetch some […]