designpatterns

Understanding PSR-12: The PHP Coding Style Guide

Understanding PSR-12: The PHP Coding Style Guide

If you’ve been developing with PHP for a while, you've likely encountered the term PSR-12. It’s one of the most widely accepted coding standards in the PHP community and is aimed at ensuring consistency in PHP codebases across different projects. Whether you're working solo or as part of a team, following PSR-12 can make your code cleaner, more readable, and easier to maintain. In this blog, we'll break down what PSR-12 is, why it's important, and how you can apply it in your projects. Table of Contents What is PSR-12? Why is PSR-12 Important? Key Rules of PSR-12 How to…
Read More
How Object Calisthenics Helped Me Write Better C# Code

How Object Calisthenics Helped Me Write Better C# Code

Hi devs :) I’ve been diving into Object Calisthenics recently, and while it seems like a great practice, I know it’s not everyone’s cup of tea. It’s a set of 9 rules aimed at improving object-oriented design, but some developers are skeptical. Despite that, I’ve found these rules really helpful in making my C# code cleaner and more maintainable. What Are These Rules? Object Calisthenics encourages you to follow nine rules to enhance the modularity and readability of your code. Here’s a rundown with C# examples: One Level of Indentation Per Method Rule: Methods should have only one level of…
Read More
DESIGN PATTERNS : A Deep Dive into Common Design Patterns

DESIGN PATTERNS : A Deep Dive into Common Design Patterns

What is a design pattern? Design patterns are solutions to complex problems. Design patterns are all about crafting your classes and interfaces in a way that solves a particular design problem. Usually, while designing a system, we encounter some issues, and for those problems, we have a set of design patterns. Design patterns are generally templates that involve classes, interfaces, and the relationships between those classes. Types of design patterns: Creational design patterns: These types of patterns deal with the creation of objects in a way that is compatible with the given situation.At the creational level, we can determine how…
Read More
Minha conclusão ao conhecer os “Design Patterns” [PT-BR]

Minha conclusão ao conhecer os “Design Patterns” [PT-BR]

Introdução Terminei de conhecer os famosos "Design Patterns", descritos originalmente no livro "Design Patterns: Elements of Reusable Object-Oriented Software", lançado em 1994 pelo "Gang of Four" (GoF), que é, de longe, um dos maiores clássicos da área da computação. Organizei com meus colegas um clube do livro para ler uma versão mais acessível, prática e modernizada desse livro, que faz mais sentido para um clube. Trata-se do "Dive Into DESIGN PATTERNS", do famoso site Refactoring.Guru. Minha reflexão Depois de conhecer todos os 22 design patterns, comecei a perceber como eles influenciaram o mundo do desenvolvimento em que vivo hoje. Seja…
Read More
The Open/Closed Principle in C# with Filters and Specifications

The Open/Closed Principle in C# with Filters and Specifications

Software design principles are fundamental in ensuring our code remains maintainable, scalable, and robust. One of the key principles in the SOLID design principles is the Open/Closed Principle (OCP). This principle states that software entities should be open for extension but closed for modification. Let’s explore how we can adhere to this principle through a practical example involving product filtering. Initial Implementation: The Problem Imagine we have a simple product catalog where each product has a name, color, and size. We need a way to filter these products based on various criteria. A straightforward implementation might look like this: public…
Read More
Build your own DI Container in JavaScript.

Build your own DI Container in JavaScript.

What we will build In this chapter we will implement our own DI Container in JavaScript. We will create a checkout simulation and we are going to use our DI Container to handle the dependency injection. The services Here is the service classes and the flow of our application. We have a credit card, a shipping bag and then a class that handles the transaction and one that sends the order. // Independent service class CreditCard { owner; address; number; cvc; set(owner, address, number, cvc) { this.owner = owner; this.address = address; this.number = number; this.cvc = cvc; } }…
Read More
Figma for Beginners

Figma for Beginners

Hello everyone! Today I'll be making a blog on Figma. I wanted to blog on Figma because I see Figma everywhere but I still don't know what it is. Figma helps with the design interface and responsive web design. Figma frames have preset devices and screen sizes. Creating Figma FramesFigma frames can be created by simply hitting on the "A" or "F" key. There is a dropdown pane of the list of devices that the user wants to create the frame with. Frame interactionsThey can be modified by changing preset values or simply dragging the corners of the box. Nesting…
Read More
Master Abstract Factory Design Pattern for Programming Interviews with 5 easy steps

Master Abstract Factory Design Pattern for Programming Interviews with 5 easy steps

Abstract factory design pattern is advanced-level programming interview question, candidates are often asked to demonstrate their understanding of design patterns, specifically the Abstract Factory design pattern. This pattern is essential for creating families of related objects without specifying their concrete classes, and understanding it can significantly boost your chances of acing the interview. Go ahead and check them out! Find the largest sum subarray using Kadanes AlgorithmMastering Object-Oriented Programming in C++Palindrome Partitioning A Comprehensive Guidewhat is parameter in coding and what is the deference between param and argument in programminghow to inverse a matrix in c# find the first occurrence…
Read More
Mastering Distributed Systems: Essential Design Patterns for Scalability and Resilience

Mastering Distributed Systems: Essential Design Patterns for Scalability and Resilience

Introduction In the realm of modern software engineering, distributed systems have become pivotal in achieving scalability, reliability, and high availability. However, designing distributed systems is no trivial task; it requires a deep understanding of various design patterns that address the complexities inherent in distributed environments. This article delves into the best practices and design patterns essential for architecting robust and scalable distributed systems. Table of Contents Understanding Distributed Systems Key Challenges in Distributed Systems Essential Design Patterns Best Practices Conclusion Understanding Distributed Systems Distributed systems consist of multiple autonomous computers that communicate through a network to achieve a common goal.…
Read More
Enhancing Rust Enums in the State Pattern

Enhancing Rust Enums in the State Pattern

In my previous article, I discussed how Rust enums should be strongly considered when the solution benefits from a state machine. The strongest argument for this is the fact that the Rust compiler will inform you when a state variant isn't covered in a match expression. This was stemmed from a state pattern example provided by the official Rust book. The sample scenario they used was an article that was required to go through the status of Draft, PendingReview, and Approved. Using a similar strategy as I explained in my original article, I came up with the following code: post.rs…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.