23 Gang of Four (GoF) patterns
23 Gang of Four (GoF) patterns
|
|
Sep 15 2023, 12:25 PM, updated 3y ago
Return to original view | IPv6 | Post
#1
|
![]() ![]()
Junior Member
148 posts Joined: Jan 2023 |
How many design patterns do you guys really use in your development and what are they?
|
|
|
|
|
|
Sep 15 2023, 03:01 PM
Return to original view | Post
#2
|
![]() ![]()
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. I wonder why some interviewers are still asking on this. Even some youtuber still teaching this. I guess because of their legacy systemMostly used as a short, common terms for communicating and documenting ideas. This post has been edited by codercoder: Sep 15 2023, 03:01 PM |
|
|
Sep 15 2023, 03:43 PM
Return to original view | Post
#3
|
![]() ![]()
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. could behttps://en.wikipedia.org/wiki/Cargo_cult In the past, have any interviewers asked you on this? |
|
|
Sep 18 2023, 09:03 PM
Return to original view | Post
#4
|
![]() ![]()
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 Yeah, the library and framework are implementing design pattern.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. 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. |
|
|
Sep 18 2023, 10:00 PM
Return to original view | Post
#5
|
![]() ![]()
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. Singleton in dependency injection is different from Singleton design pattern right?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. |
| Change to: | 0.0119sec
0.86
6 queries
GZIP Disabled
Time is now: 23rd December 2025 - 11:57 AM |