Today I am going to discuss a very simple behavioral design pattern called the Iterator design pattern. Almost every programming language has data structure and collection, hence they provide iterator and we iterate over the objects. Sometimes we use for loop or forEach loop to do that but we need to make sure that our implementation should not be exposed. According to the book, the main intent is like
“Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. ”
Ok, let's see some examples of iteration now.
// If a simple array…
“Once you stop dreaming, You start dying” — Bill Johnson
When we write code we think of everything as an object and One object can hold multiple objects like a chain inside the parent object. Every object can be treated as a single instance of the same type of object. The intent is like Compose the object into a tree structure to represent part-whole hierarchies. So we can get a tree structure and every node or leaf can be represented as a single object. When programmers write code for tree-structured data they often discriminate between a leaf node and a…
“If you want to go fast, go alone. If you want to go far, go together”. - African Proverb.
Template method pattern is used when we have multiple algorithms that have some common functionality. In general words, the template is like a default structure for doing a specific task. we are using this pattern for the architectural plans and throughout the engineering domain. A template plan can be built on with further variations. From the book, the main intent is like
“Defines the skeleton of an algorithm in a method, deferring some steps to subclasses. …
Let’s start with a quote,
“ If you are not prepared to be wrong, you never come up with anything original.”
— Sir Ken Robinson.
The software design pattern is a reusable solution to the commonly occurring problem within a given context in Software Architecture. In software design, we can think about an object and organize the object in such a way that it provides a strong solution for a system. There are three categories of this design pattern.
1. Creational Design Pattern
2. Structural Design Pattern &
3. Behavioral Design Pattern.
Creational Design Pattern: It basically works for creating…
Software Engineer | High Integrity System Graduate @Frankfurt University of Applied Sciences