Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 23 Gang of Four (GoF) patterns

views
     
TScodercoder
post Sep 15 2023, 12:25 PM, updated 3y ago

Getting Started
**
Junior Member
148 posts

Joined: Jan 2023
How many design patterns do you guys really use in your development and what are they? notworthy.gif
TScodercoder
post Sep 15 2023, 03:01 PM

Getting Started
**
Junior Member
148 posts

Joined: Jan 2023
QUOTE(angch @ Sep 15 2023, 02:54 PM)
Not a lot. A lot of them are C++/Java-ism to deal with their shortcomings during GoF's era. PEAA (https://martinfowler.com/books/eaa.html) is used more, when appropriate, higher level integration with systems.

Mostly used as a short, common terms for communicating and documenting ideas.
*
I wonder why some interviewers are still asking on this. Even some youtuber still teaching this. I guess because of their legacy system



This post has been edited by codercoder: Sep 15 2023, 03:01 PM
TScodercoder
post Sep 15 2023, 03:43 PM

Getting Started
**
Junior Member
148 posts

Joined: Jan 2023
QUOTE(angch @ Sep 15 2023, 03:26 PM)
Just cargo culting using the terms without understanding *why* we're using them. Might have legitimate reasons to ask for it, but sounds like just fishing for people who know how to answer retro trivia.

https://en.wikipedia.org/wiki/Cargo_cult
*
could be

In the past, have any interviewers asked you on this?
TScodercoder
post Sep 18 2023, 09:03 PM

Getting Started
**
Junior Member
148 posts

Joined: Jan 2023
QUOTE(silkworm @ Sep 18 2023, 07:26 PM)
I've seen a few codebases that may have independently arrived at the Singleton Pattern tongue.gif

Even if you don't go out of the way to use the patterns yourself, you can find them being used in the frameworks or libraries that you might use daily.

Java developers use Abstract Factory every time they have to get a JDBC connection to a database or JMS connection to a message queue.

In all editions the book "Effective Java" (up to 3rd now) the Factory Method, or rather Static Factory Method, is recommended over plain constructors because:
1. the factory method names can be more descriptive than just the class name.
2. being able to have different factory names means that you're no longer restricted by the constructor's method signature when defining your parameters.

If you've used any of the ReactiveX implementations, like RxJS, Observables are an implementation of the Observer Pattern

Java's Servlet Filters implement a form of Chain-of-Responsibility, passing the entire HTTP request down the chain to any code that may want to manipulate it.

Java Persistence with lazy loading makes use of Proxy objects around your Entity classes, only making calls to the DB when you actually want to read the data.
*
Yeah, the library and framework are implementing design pattern.

AddDbContextFactory and IHttpClientFactory in the context of ASP.NET Core are examples of the Factory design pattern.

But I am curious on what are the common design patterns we wrote and the problems they solved.
TScodercoder
post Sep 18 2023, 10:00 PM

Getting Started
**
Junior Member
148 posts

Joined: Jan 2023
QUOTE(iammyself @ Sep 18 2023, 09:39 PM)
From my experience, you'll bump into some versions of the GoF patterns in almost any project.

However, in my opinion, these patterns are most applicable to OOP languages such as Java and C#.

This is not to say that you won't be using them in other languages.

For example, Go isn't an OOP language, but I've used/seen patterns such as singleton and factory.
*
Singleton in dependency injection is different from Singleton design pattern right?

 

Change to:
| Lo-Fi Version
0.0119sec    0.86    6 queries    GZIP Disabled
Time is now: 23rd December 2025 - 11:57 AM