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) {
...
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 ...
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 ...
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 ...
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 ...
3
votes
Why is "dependency injection" ok, but not "the opposite of preserve whole object (pass required parameters only)"?
This is a long answer. I couldn't really avoid it. You are bringing up several different software engineering principles, and have started oversimplifying, overcomplicating, and conflating them into a ...
2
votes
Why is "dependency injection" ok, but not "the opposite of preserve whole object (pass required parameters only)"?
TLDR
Avoid accidental dependencies. The pattern to apply does not matter. Only preserve whole object, when access to all future members of the object is expected.
Accidental dependency
Both Dependency ...
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
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
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)
...
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 ...
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 ...
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
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
design-patterns × 4484design × 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