Skip to main content
Share Your Experience: Take the 2024 Developer Survey
27 votes

Are "factory methods" anti-pattern now?

But isn't that all a DI concern? No, it isn't. Raw DI simply means that an object receives its dependency as parameter, as opposed to constructing it internally. You inject dependency. It is true ...
freakish's user avatar
  • 1,291
8 votes

How to do "Separation of concerns"

Separating on the base of language is not separation of concerns. It's only the consequence of SoC: SoC is the root cause that made you chose two different languages instead of one. Separation of ...
Christophe's user avatar
6 votes

Are "factory methods" anti-pattern now?

Whether something is considered an anti-pattern often comes down to how a particular design is used. Dependency injection frameworks can provide factories. They are a factory in their own right. DI ...
Greg Burghardt's user avatar
5 votes
Accepted

What is a good architecture / design pattern for giving multiple shared attributes in different combinations?

Yes there is. It is called the entity component system. It is used mostly in gaming industry to avoid deep hierarchies and share "components" (attributes or behavior or both) between "...
Christophe's user avatar
5 votes

Do you re-include system headers in the implementation files?

When a header file A.h requires an include for <unordered_map>, and the related cpp file A.cpp (which includes A.h) contains some code dealing with objects of type unordered_map (regardless ...
Doc Brown's user avatar
  • 209k
3 votes

What value does the mediator pattern add beyond dependency injection?

DI is unrelated to the mediator pattern Wikipedia's description of the Mediator pattern (especially, Problems that the mediator design pattern can solve) does not clearly distinguish a use case which ...
Flater's user avatar
  • 51.7k
3 votes

What value does the mediator pattern add beyond dependency injection?

I think your usage of "DI" is incorrect here. So I'm going to replace "DI" with "plain interface", because that is what I believe you are actually talking about. ...
Euphoric's user avatar
  • 37.5k
3 votes

How to do "Separation of concerns"

Most design practices have one goal in mind - maintenance. When a component is changed it may become buggy. To minimize bugs we want each change to affect less components (we assume that a in a well ...
Basilevs's user avatar
  • 2,011
3 votes
Accepted

Referencing objects created during seeding by ID

I would say that a "Natural Key" (as you say, id = "total revenue") is the best solution here. However you still have to have some way of transmitting this list to consumer apps, ...
Ewan's user avatar
  • 76.4k
3 votes
Accepted

How to do "Separation of concerns"

How to identify which seperation suits my development. Be suspicious of 1 to 1 relationships across separations. Yes even that FooTest class that tests the Foo class. Separations are more useful when ...
candied_orange's user avatar
2 votes

Dynamic web application hitting database on front page load to fetch profile image

The industry best practice is to never store images (and other big blobs) in database directly. And only store "references" to those images. The reason for that is that such images overload ...
freakish's user avatar
  • 1,291
2 votes

What is a good architecture / design pattern for giving multiple shared attributes in different combinations?

The basic approach for specifying arbitrary data fields arranged in arbitrary shapes, and for implementing algorithms which perform processing upon those fields and shapes, is nowadays called "...
Steve's user avatar
  • 8,977

Only top scored, non community-wiki answers of a minimum length are eligible