New answers tagged design-patterns
2
votes
Aggregating classes to emulate multiple constructors using factory methods
The intention is good, but the design guideline you're following only makes sense from the perspective of he who built it, not he who consumes it; making it a bad design.
The design itself is flawed ...
5
votes
Accepted
Aggregating classes to emulate multiple constructors using factory methods
I don't like it.
I don't like that I don't know how to use it unless I know how it was built.
I don't like that despite there being a lot of code here there is no business logic. Just a lot of ...
2
votes
Builder with non-defaultable required args
I think the real design issue are classes with a lot of mandatory constructor parameters. Normally, you start small, with a class having one or two mandatory constructor parameters. When you need to ...
2
votes
Transaction Management Across Microservices with Rollback Mechanism using Kafka
If all work in A is undone when B throws an exception, then these microservices are obviously not independent.
It sounds like just two stages of a queue. A receives data provisionally for processing. ...
1
vote
Why is it called Data-Oriented Design?
For a moment I was going to ask what the question actually was, then I remembered it was in title.
I agree "data-oriented design" is a pretty obtuse and uppity term.
The term seems to ...
1
vote
Are utility classes with nothing but static members an anti-pattern in C++?
Whenever we're speaking about a potential anti-pattern - it is important to understand: what is so bad about it? Which RL bad consequences will come out of it?
And in this particular case of ...
0
votes
Difference between composing Factory and inheriting
@yuanlu0210 answer seems to accurately explain the intention of the authors of Head First Design Patterns. This is evident from the code examples that are present in the book. I will explain how:
They ...
2
votes
Builder with non-defaultable required args
Suppose a class needs multiple properties of the same type. I don't want a big constructor where the user can mess up the order of args (remember, they are of the same type, no compile-time errors)
...
3
votes
Accepted
Builder with non-defaultable required args
Also, what do you think on this whole dilemma generally? Maybe, I should use something else instead of a builder? Or maybe, this problem is fundamentally unsolvable?
Your problem is solvable and the ...
5
votes
Accepted
What does it mean to be "truly" asynchronous?
Here it just means that while the I/O operations themselves may be asynchronous, the completion events are dispatched synchronously in Windows (ie, when you check the completion port).
UNIX signals ...
0
votes
Trying to write a sane alternative to the visitor pattern, please help me review it
I've never liked the Visitor pattern, and I think it rightfully gets a lot of hate. It creates a tangled mess of coupling. Every new shape requires a new implementation in both your vistor interface ...
2
votes
Trying to write a sane alternative to the visitor pattern, please help me review it
Are there downsides with the approach I'm trying to implement that the Visitor pattern doesn't have?
It values visiting hierarchies which are not designed up-front to be visitable, which was never a ...
2
votes
Trying to write a sane alternative to the visitor pattern, please help me review it
The Visitor pattern as presented in 'Design Patterns: Elements of Reusable Object-Oriented Software' is one of the patterns which are there to overcome a limitation in the implementation language.
The ...
5
votes
Trying to write a sane alternative to the visitor pattern, please help me review it
One point of the visitor pattern is to avoid the need of the repetition of code like this
process(Shape s) {
if(s instanceof Circle) {
visitCircle(s);
}
if(s instanceof Dot) {
...
1
vote
What do you call an enum that translates its own values?
This recurring pattern might not have a name. But what you're seeing is stringly typed strings being converted into types. This example just happens to use enums.
The danger of this pattern is that ...
3
votes
Accepted
What are the common design patterns for updating user data of a desktop/mobile application?
What you describe is a fairly standard way of handling backwards compatibility in file/database formats. The process of reading an old file format and then storing the data in the latest format is ...
Top 50 recent answers are included
Related Tags
design-patterns × 4485design × 906
object-oriented × 690
object-oriented-design × 602
c# × 544
java × 504
architecture × 455
c++ × 196
mvc × 192
php × 189
domain-driven-design × 184
python × 131
dependency-injection × 124
programming-practices × 122
patterns-and-practices × 111
javascript × 110
architectural-patterns × 106
.net × 102
interfaces × 95
database × 93
api-design × 86
anti-patterns × 82
refactoring × 79
database-design × 78
inheritance × 77