- Efficient Text Highlighter
- Implement the Lightning Algorithm
- Build a markdown notes taking app
- Serve Images in Next-gen Formats
- Package-lock.json Explained
Behavioral Patterns - State Pattern Exercise
06/26/2018
The State Pattern allows an object to alter its behavior when its internal state changes. It tremendously reduces the complexity when introducing more states later to the object. In this exercise, we will use the State Pattern to create a modern vending machine to understand the components of the State Pattern.
Behavioral Patterns - Memento Pattern Exercise
06/20/2018
The Memento Pattern is used to record the internal state of an object. It is used to create a state machine and also makes undo or redo operation very easy with this pattern. In this exercise, we will use a scenario of account and account manager to understand the components of this pattern.
Behavioral Patterns - Observer Pattern Exercise
06/20/2018
The Observer Pattern is widely used to solve one-to-many object state changes notification problems. The pub/sub model uses the Observer Pattern as the base pattern. It is also used in the event-driven systems. In this exercise, we will create a naive implementation of the pub/sub model to understand the components of the Observer Pattern.
Behavioral Patterns - Chain of Responsibility Pattern Exercise
05/18/2018
The Chain of Responsibility Pattern is very useful to avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along with the chain until an object handles it. We will implement a naïve security filter chain using this pattern in our practice exercise. You will certainly enjoy this exercise as it is a great way to get you totally master this pattern.
Behavioral Patterns - Command Pattern Exercise
05/18/2018
The Command Pattern is almost the second most popular pattern after the Singleton Pattern. It can be used to encapsulate each request to an object and turn the client application to a stateless application while the delegated object who receives the invocation persists its own state. In this exercise, we will create an operation manager which basically can change some state and undo the changes. The example I created is a Document Writer, which can write lines and undo the lines are written. For more challenge, there is also a bonus point – a custom data structure that you will need to implement -- to mimic preventing the system crashing from not-enough-memory.
Behavioral Patterns - Iterator Pattern Exercise
05/18/2018
The iterator pattern is widely used in collections, it simplifies the way a collection could be iterated as well as provides a mutable capability to the collection during the iteration.
Behavioral Patterns - Mediator Pattern Exercise
05/18/2018
The Mediator Pattern defines an object that encapsulates how a set of objects interact. In this exercise, we will create a mediator that helps us handle the cross-cutting business logic in the Command Pattern Exercise.
Add Model Attributes to Layout Template
05/11/2018
@ControllerAdvice
is widely used to create exception handlers in a cross-cutting way when writing a Spring MVC or REST application. It could also be used to solve adding model attributes to any groups of controllers so that the model could be shared in some specific views such as a layout template. This lesson teaches the strategy to use @ControllerAdvice
annotation to solve this problem.
Spring @Transactional - Propagation Type
05/08/2018
Spring @Transactional
annotation is concise and powerful. To understand what's the best property setting for your use case in this annotation could be confusing if you don't clearly understand what transaction management key concepts are. In this series, we will talk about the key concepts in transaction management that could be configured through the @Transactional
annotation. This article focuses on the propagation type.
Spring @Transactional - Isolation Level
05/04/2018
Spring @Transactional
annotation is concise and powerful. To understand what's the best property setting for your use case in this annotation could be confusing if you don't clearly understand what transaction management key concepts are. In this series, we will talk about the key concepts in transaction management that could be configured through the @Transactional
annotation. This article focuses on the isolation level and its side effects.