This post shows how to use the Composite design pattern in Rust. Also, it offers a sample implementation with two levels of composition. For instance, we have a group of lists of products. The Composite Design Pattern Use Case Our
The Composite Design Pattern In Simple Words
The Composite design pattern helps us deal with a type of object – individually or as a group. In other words, our codes should be able to process that object alone. Also, our codes can deal with a collection of
The Singleton Design Pattern In Simple Words
Be mindful when creating objects; sometimes, we only need one of a specific type. Creating a single object that lives throughout the lifetime of a program is a form of Singleton design pattern. As simple as the concept may be,
The Decorator Design Pattern In Simple Words
The Decorator design pattern is an alternative to subclassing that makes our codes flexible and maintainable. Furthermore, it allows us to wrap around existing objects and dynamically modify their behaviors (methods). When To Use This Pattern? When do we use
The Facade Design Pattern In Simple Words
Do you have codes with an overwhelming number of service and DAO methods? Which group of method calls represent which use case? If that is one of the predicaments you are having with your codebase, it is probably wise to
The Visitor Design Pattern In Simple Words
The Visitor design pattern is another behavioral pattern that simplifies access to an object’s data collections. Moreover, it is closely related to the Iterator design pattern. Unlike the Iterator pattern, the Visitor pattern makes client codes visit one data item
The Iterator Design Pattern Example In Rust
This post shows how to use the Iterator design pattern in Rust without using the Iterator trait or any crate. Suppose we have a struct with multiple collections of various types that implement the same trait. The Iterator Design Pattern
The Iterator Design Pattern in Simple Words
The Iterator design pattern is a behavioral design pattern that simplifies access to an object’s data collections. Moreover, it aims to provide a simple mechanism to make the data available. As a result, the client codes do not need to
Chain of Responsibility Pattern Example In Rust
This post shows a simple implementation of the Chain of Responsibility pattern in Rust. For example, we have a set of struct instances that check for a file, read it, and finally, display it. We could imagine these instances as
Chain of Responsibility Design Pattern In Simple Words
The Chain of Responsibility is a behavioral design pattern that processes data using a sequence of loosely-coupled handlers. Each handler receives the data from a handler preceding it. Then, it processes the data. If there are problems with the data,