Skip to main content

New answers tagged

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 ...
Flater's user avatar
  • 54.9k
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 ...
candied_orange's user avatar
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 ...
Doc Brown's user avatar
  • 212k
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. ...
Steve's user avatar
  • 10.3k
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 ...
Steve's user avatar
  • 10.3k
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 ...
No-Bugs Hare's user avatar
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 ...
shivamag00's user avatar
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) ...
freakish's user avatar
  • 2,301
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 ...
Bart van Ingen Schenau's user avatar
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 ...
Useless's user avatar
  • 12.7k
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 ...
JimmyJames's user avatar
  • 28.5k
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 ...
Useless's user avatar
  • 12.7k
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 ...
Pete Kirkham's user avatar
  • 2,021
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) { ...
Doc Brown's user avatar
  • 212k
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 ...
candied_orange's user avatar
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 ...
Bart van Ingen Schenau's user avatar

Top 50 recent answers are included