New answers tagged

0 votes

How to store product and pricing history in a product database?

I think prices of anything are very crucial and it is essential to store pricing so that they can be retrieved accurately without any complex logic except a single join. For example: ProductA's price ...
kandarp gautam's user avatar
-1 votes

Do Interactors in "clean architecture" violate the Single Responsibility Principle?

The Clean Architecture book clarifies SRP (p.62): Historically, the SRP has been described this way: A module should have one, and only one, reason to change. Software systems are changed to satisfy ...
Jocelyn Englund's user avatar
2 votes
Accepted

How encapsulating what varies can help us?

It is the nature of an example that it is simple and that a reader can easily grasp its entire content without needing an elaborate explanation. It is the nature of real production code that things ...
Flater's user avatar
  • 45.5k
0 votes

Access Token Or Alternative for Microservices For Resource Level Granular Checks

When you deal with db records, you dont use access tokens. You should somehow relate the user with the records they have access to. It could be by using the user-id in your resource-table or a ...
stelios.anastasakis's user avatar
6 votes
Accepted

In poltergeist, whats wrong with "solely to trigger or initialize several other objects"? Isn't it is a good use of encapsulation and reuse?

First, let me say the Wikipedia article about Poltergeist, as it is written today in Sept. 2023, isn't very clear. It lacks an example, suffers from some overgeneralization and oversimplification, and ...
Doc Brown's user avatar
  • 201k
0 votes

Is it an anti-pattern to use interface for entity?

If you have a simple data-only object, declaring and using an interface costs very little. Very often you don’t have a simple data object. Say you have an object that can persist or load itself. Or ...
gnasher729's user avatar
  • 42.7k
0 votes

Is it an anti-pattern to use interface for entity?

Although not immediately obvious, your example demonstrates a common interface that represents the same conceptual data in two different domains. This is one of the primary reasons to implement ...
Chris Schaller's user avatar
0 votes
Accepted

How could I apply the strategy pattern to a react component?

Strategy vs composition You are realy asking 2 questions here. How to use composition with React components and how to use the strategy pattern. Let me first give you the traditional way to get rid of ...
Stijn de Witt's user avatar
0 votes

Is it an anti-pattern to use interface for entity?

The article you mention probably - more or less explicitly - places itself in the context of a Rich Domain model, or at least an architectural style where there is a "pure" business layer ...
guillaume31's user avatar
  • 8,381
0 votes

Alternatives to the singleton pattern

It depends very much what you mean by singleton. My definition: A “singleton instance” (not class) is an object that serves a specific purpose, that should be exclusively used for that purpose, that ...
gnasher729's user avatar
  • 42.7k
0 votes

Is it an anti-pattern to use interface for entity?

I read an article about that using interface for entity is anti-pattern by these reasons You need to understand this advice in context. Programming to interface is a very well known and important ...
Ilmari Karonen's user avatar
0 votes

Is it an anti-pattern to use interface for entity?

Two counterarguments: quite often, there is a second implementation: a mock object for unit testing. even if there isn't, it is a stronger split between interface and implementation.
Simon Richter's user avatar
9 votes

Is it an anti-pattern to use interface for entity?

Without the full context of this article, it's impossible to say exactly what the point of it was but I think I can provide a useful answer to your question. The first bullet "Your interface ...
JimmyJames's user avatar
  • 25.2k
4 votes

Is it an anti-pattern to use interface for entity?

Put it to the test: class JpaBook implements Book { // implement entity for JPA } class RedisBook implements Book { // implement entity for Redis(for caching) } If you delete implements Book and ...
nvoigt's user avatar
  • 7,337
6 votes

Is it an anti-pattern to use interface for entity?

Interfaces should be designed in their own right. They are not simply accessories to a class. That said, this: Your interface signature [is] identical to your class can actually be fine. It just ...
candied_orange's user avatar
0 votes
Accepted

What C# Object Composition strategy would you apply for CoreObjects with a governing 'ObjectType' property

This DesignType determines various fundamental characteristics of the design object, and various calculated values of the design type may have different calculations based on the DesignType. The ...
radarbob's user avatar
  • 5,823
3 votes

How encapsulating what varies can help us?

As always the question for the "best" software design depends on the specific context and requirements, therefore there will likely be no definite answer, but lets introduce some concepts ...
Mathias Mamsch's user avatar
1 vote

Is this a bad pattern for reporting/audit?

Put the item on a message queue ... reporting events are frequently missing due to restarts Restart of what ? The message queue restarts: Surely you should be using a message queue service (plenty of ...
S.D.'s user avatar
  • 977
0 votes

How encapsulating what varies can help us?

First of all: your pancakes know how to cook and plate themselves. In my opinion that's a code smell. It also obscures why you would want to encapsulate the pancakes. Assume your EncapsulationExample ...
wallenborn's user avatar
  • 1,980
0 votes

How encapsulating what varies can help us?

Software engineering is about insuring against future, as yet unknown change. As long as all your program never changes, i.e. all it does is serve pancakes, and pancakes have no other use than being ...
Kilian Foth's user avatar
1 vote

Is this a bad pattern for reporting/audit?

The steps you listed in your question are a high level description of a standard solutions. It is too high level though, there are a lot of details of the implementation that are not trivial. First of ...
FluidCode's user avatar
  • 717
3 votes

Event-driven design with delayed consequences

It sounds like you have a lot of conditions going on here, not a bad thing, but I think you will definitely need to ensure that your events are organized. Spend some time and diagram out your sequence ...
Chris Johnson's user avatar
3 votes
Accepted

Event-driven design with delayed consequences

Some part of your system needs to have the knowledge which fields of which objects are required before a certain procedure can be started. Usually, this knowledge is bundled with the procedure itself, ...
Doc Brown's user avatar
  • 201k
1 vote

Event-driven design with delayed consequences

Is there a clean way to do this with event-driven design? Yes. Queue up a "query" or "interact" event, and attach the backlog fields. This might arrange for an RDBMS query to ...
J_H's user avatar
  • 2,912

Top 50 recent answers are included