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

New answers tagged

0 votes

Best practice: keep DB models in one file or split into modules?

this is interesting. I have had my models in one single file but given my application needs to be expanded now from 4 models to 10, i figured i introduce a directory, "orm" and store all my ...
Gordon's user avatar
  • 1
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
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
  • 208k
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
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
  • 77.9k
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
  • 1,983
-1 votes

How to do "Separation of concerns"

Separation of Concerns, in SOLID is talking about classes. ie. a class should have a defined purpose and stick to it. Like, Auth, SavingToDatabase etc However, you also have "Layers" of ...
Ewan's user avatar
  • 76.4k
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
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,949
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
  • 77.9k
0 votes

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

Since images are mostly static content, usually a CDN (Content Delivery Network) is used to deliver them as mentioned by @freakish. Consider a global website. One user is in California, the other in ...
Jon Raynor's user avatar
  • 11.5k
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
  • 973
6 votes

Is it good practice for object APIs to be required to be called in sequence to gather information?

Your coworker is right. Constructors should give you a fully initialized and usable object. I also understand why you don't want parsing to happen in the constructor, because it can throw an exception....
Greg Burghardt's user avatar

Top 50 recent answers are included