Gaining Flexibility by Building Bridges: Analysis and Implementations in Four Different Languages with the Bridge Design Pattern

2023-06-22 | #bridge-pattern #design-patterns #structural-patterns

Once upon a time, there were two kingdoms. Despite being very close to each other, a wide and deep river was located between them. This river made it difficult for the kingdoms to interact with each other. To solve this situation, both kingdoms decided to build a bridge. This bridge became an interface that facilitated communication between the two kingdoms. However, the bridge had different structures and features on each side.

Continue reading 


Anemic Domain Model: A Detailed Review

2023-06-15 | #anemic-domain-model #anti-pattern

The Anemic Domain Model is a software design pattern where most of the domain logic is found in services and data transfer objects, often obscuring functionality and behavior, and is typically used for data transmission only. This term was first defined by Martin Fowler as a negative example of a design pattern. A typical example relies on the ability of objects to store data, but the business logic resides in services and other external resources.

Continue reading 


Decorator Design Pattern: The Adornments of Software

2023-06-15 | #decorator-pattern #design-patterns #structural-patterns

Once upon a time, there was an object named “Component”. This object was used to perform a specific function. However, sometimes it was necessary to extend or modify this function. That’s where “Decorators” came into play. Decorators are objects that “decorate” or extend the Component. A Decorator comes on top of a Component and extends or modifies its function. This is used to extend the functionality of the Component without changing it itself.

Continue reading 


From the Language of Code to Fairy Tales: Uniting Different Worlds with the Adapter Pattern

2023-06-15 | #adapter-pattern #design-patterns #structural-patterns

Once upon a time, there were two friends from two different worlds: the Electric Vacuum Cleaner and the Electric Outlet. The Electric Vacuum Cleaner needed energy and wanted to get this energy from the Electric Outlet. However, there was a problem. The plug of the Electric Vacuum Cleaner did not fit the Electric Outlet. They were both produced in different standards and could not communicate directly with each other. In this case, a hero emerged: the Adapter.

Continue reading 


Decoding the Transaction Script Pattern: A Philosophical Dialogue with Epictetus

2023-06-11 | #domain-logic-patterns #enterprise-patterns #transaction-script

Murat: The Transaction Script pattern allows transactions to be carried out simply and smoothly. However, using this pattern can make understanding and maintaining the code difficult for applications with complex business logic. Epictetus: Yes, Murat. But we must not forget that everything depends on complexity. The Transaction Script pattern can be an excellent choice for applications with simple business logic. However, as the business logic becomes more complex and requires many transactions, other patterns such as Domain Driven Design (DDD) may be more suitable.

Continue reading 


Unraveling the Transaction Script Pattern: A Deep Dive with Real-World Examples

2023-06-11 | #domain-logic-patterns #enterprise-patterns #transaction-script

The Transaction Script is an Enterprise application design pattern often used in transaction-based systems. This pattern is created by bringing together a series of procedures to perform a transaction. These procedures are typically used to initiate a transaction, run database queries, and process the results. The Transaction Script pattern is suitable for applications with non-complex business logic. However, as the business logic becomes more complex and requires many transactions, using this pattern can make understanding and maintaining the code difficult.

Continue reading 


The SemaphoreSlim Class: Multitask-Based Programming in C#

2023-06-11 | #net #semaphoreslim

Overview The SemaphoreSlim class is a structure used in C# to control one or more threads using a specific resource or operation concurrently. SemaphoreSlim limits the number of threads that can access the resource at the same time. The use of SemaphoreSlim is often used to prevent deadlock situations in multi-threaded applications and to ensure that a specific resource is used by only one or more threads at the same time.

Continue reading 


Singleton Pattern

2023-06-11 | #creational-patterns #design-patterns #singleton-pattern

Once upon a time, there was a ruler in the Singular Realm. The ruler’s name was “Singleton”, and he had the property of being the only entity in the whole realm. Singleton had educated everyone else about preserving his uniqueness and singularity. Being the sole ruler of his kingdom, Singleton was recognized with the property of being a unique entity that, once created, could not be changed again. In every corner of the kingdom, it was known that Singleton was created only once and only one instance existed.

Continue reading 


Abstract Factory Pattern

2023-06-11 | #abstract-factory-pattern #creational-patterns #design-patterns

Once upon a time, there was a kingdom, and the name of this kingdom was “Abstract Factory”. Although it seemed abstract, everything in this kingdom had a purpose, a certain order, and a specific design. There were certain rules on how everything was made, and these rules were based on design patterns that regulated the creation of objects. In the kingdom of Abstract Factory, the King, known as AbstractFactory, would manage the factories of different types of products.

Continue reading 


Builder Pattern

2023-06-11 | #builder-pattern #creational-patterns #design-patterns

Once upon a time, there was a very beautiful kingdom, and its name was “Builder Pattern”. Everything in this kingdom was about the art of constructing complex objects step by step and connecting them together. These complex objects were the most valuable treasures of the kingdom, and each one was carefully and thoughtfully constructed. The wisest person in the kingdom was this master named the Builder. The Builder would construct complex objects using materials like stones, bricks, and wood.

Continue reading 