126 votes
Accepted

Clean Architecture: Use case containing the presenter or returning data?

The Clean Architecture suggests to let a use case interactor call the actual implementation of the presenter (which is injected, following the DIP) to handle the response/display. However, I see ...
candied_orange's user avatar
75 votes

What does Robert C. Martin mean by SQL being unnecessary?

Bob Martin is clearly exaggerating to make his point more clear. But what is his point? Does he just want people to stop using SQL/Relational Databases because of SQLi attacks? To my understanding,...
Doc Brown's user avatar
  • 203k
67 votes
Accepted

Ways to share DTO across microservices?

My advice? Do not share these DTOs among the applications in any kind of library. Or at least don't do this right now. I know, seems very counter-intuitive. You are duplicating code, right? But this ...
Dherik's user avatar
  • 2,426
57 votes

What does Robert C. Martin mean by SQL being unnecessary?

Bob Martin's opinion is just that; one man's opinion. A programmer is expected to understand the system he is writing well enough to exercise reasonable care about its security and performance. That ...
Robert Harvey's user avatar
50 votes

How many design patterns and levels of abstraction are necessary?

How many ingredients are necessary for a meal? How many parts do you need to build a vehicle? You know that you have too little abstraction when a little implementation change leads to a cascade of ...
Arseni Mourzenko's user avatar
43 votes

Is using Observer pattern a good idea while building a Chess Game?

Having a "Map object that keeps track of all the cells to which it can travel" looks to me like an example of premature optimization. Instead of remembering all those cells for each piece "just in ...
Doc Brown's user avatar
  • 203k
42 votes
Accepted

Function returning true/false vs. void when succeeding and throwing an exception when failing

Throwing an exception is simply an additional way of making a method return a value. The caller can check for a return value just as easily as catch an exception and check that. Therefore, deciding ...
Kilian Foth's user avatar
38 votes

Function returning true/false vs. void when succeeding and throwing an exception when failing

There is absolutely no reason for returning true on success if you don't return false on failure. What should the client code look like? if (result = tryMyAPICall()) { // business logic } else { ...
Polygnome's user avatar
  • 2,037
29 votes

Are there advantages to hard-coding data values into a program?

Really? No Possible Valid Use Cases? While I agree that hard-coding is generally an anti-pattern or at least a very bad code smell, there are plenty of cases where it makes sense. Here are a few. ...
haylem's user avatar
  • 28.9k
25 votes

Clean Architecture: Use case containing the presenter or returning data?

In a discussion related to your question, Uncle Bob explains the purpose of the presenter in his Clean Architecture: Given this code sample: namespace Some\Controller; class UserController ...
jflaga's user avatar
  • 351
24 votes

How many design patterns and levels of abstraction are necessary?

The problem with design patterns can be summed up with the proverb "when you're holding a hammer, everything looks like a nail." The act of applying a design pattern is not improving your program ...
Neil's user avatar
  • 22.7k
22 votes

Is using Observer pattern a good idea while building a Chess Game?

My suggestion is to make things as simple as possible. The more information you give to an object, the more complex it becomes, and the harder it is to keep track of it. Let's break your program ...
Alecto Irene Perez's user avatar
21 votes
Accepted

Is CQRS/MediatR worth it when developing an ASP.NET application?

I think you're expecting too much of the pattern you're using. CQRS is specifically designed to address the difference in model between query and commands to the database, and MediatR is just in-...
Samuel's user avatar
  • 9,167
20 votes

Ways to share DTO across microservices?

When it comes to Microservices, services' development life cycles should be independent too.* Different SLDC and different dev teams in a real MS system, there could be several teams involved in the ...
Laiv's user avatar
  • 14.5k
20 votes
Accepted

Is "evolutionary software architecture" a contradiction?

Neal Ford's keynote on Evolutionary Architecture can be found here. Paraphrasing: Architecture is the decisions that you wish you could get right early in a project, things that people ...
Robert Harvey's user avatar
17 votes

What does Robert C. Martin mean by SQL being unnecessary?

What is he actually saying? Is he saying replace SQL with No-SQL technologies? TL;DR: Yes (sort of) In a more recent talk than the one you linked to on basically the same topic he says: "The ...
Søren D. Ptæus's user avatar
16 votes

Ways to share DTO across microservices?

I'm trying to design every service to be as independent as possible You should be publishing events. Events are certain type of messages that represent a solid fact about something that has happened ...
Pete's user avatar
  • 8,946
15 votes
Accepted

Can CQRS pattern exist without mediator pattern?

Command Query Responsibility Separation (CQRS) separates reading and writing into two different models. A "conventional" architecture looks like this: A CQRS architecture looks like this: Notice ...
Robert Harvey's user avatar
14 votes

Avoiding constructors with many arguments

I wouldn't do option 2, because then you have forever convolved your object's construction with boost property tree parsing. If you're comfortable with a class that needs that many parameters, you ...
Nir Friedman's user avatar
  • 1,447
12 votes

How to architect a store to avoid overselling inventory (distributed database scenario)

It depends on the widget. If the widget is rare and expensive (exactly 10 Ferraris), then the approach you're following is correct. Of course, you also need to account for inventory that's being ...
Dan Pichelman's user avatar
12 votes

What are some approaches used in financial applications to prevent deposit/withdrawal sync problems?

Transactions A transaction wraps all of the required steps for a particular business operation and guarantees that either all of the steps succeed or they all rollback to the original state in the ...
Robert Harvey's user avatar
12 votes
Accepted

Microservices communication: Avoiding single point of failure

As you rightly say, having a component dedicated to pass around messages is definitely better than having every service responsible for knowing how exactly to reach all collaborating services. ...
Kilian Foth's user avatar
12 votes

Cyclic dependencies in microservices

Let's first get rid of a misconception The microservice architecture "structures the application as a set of loosely coupled, collaborating services": Collaborating mean that microservices ...
Christophe's user avatar
  • 75.9k
11 votes
Accepted

Detecting breaking changes when modifying shared code

We've had a few problems where a contractor changed something in a common project and unknowingly this breaks a number of other solutions That's is unfortunate We're currently trying to decide a ...
MetaFight's user avatar
  • 11.5k
11 votes

Singleton design for small/medium sized music player project

Is this approach to making these key Objects easily available when needed good architecture? Is there a better approach to this issue? The much maligned singleton pattern occasionally has it's uses ...
candied_orange's user avatar
11 votes

What does Robert C. Martin mean by SQL being unnecessary?

SQL is a detail. Knowledge of a detail should not spread. As SQL is used in more and more places in your code your code becomes more and more dependent on it. As you learn more and more SQL tricks ...
candied_orange's user avatar
10 votes
Accepted

Are there advantages to hard-coding data values into a program?

Wikipedia: Hard coding (also hard-coding or hardcoding) refers to the software development practice of embedding what may, perhaps only in retrospect, be considered an input or configuration ...
Tulains Córdova's user avatar
10 votes
Accepted

REST: How to determine transient exceptions?

For your transient failures, don't return 500. Return 503 Service Unavailable. The query timeout is being caused by "a temporary overload", not by an underlying error in the code. In your ...
Eric Stein's user avatar
  • 3,542
10 votes

Is CQRS/MediatR worth it when developing an ASP.NET application?

CQRS is more of a data management thing rather than and doesn't tend to bleed too heavily into an application layer (or Domain if you prefer, as it tends to be most often used in DDD systems). Your ...
jleach's user avatar
  • 2,652
10 votes
Accepted

Unit Testing in VIPER Architecture: Possible?

Oh it's possible. It just doesn't look like what you want it to look like. What you're complaining about is the use of output ports1,2,3 to communicate results rather then returning results. Does this ...
candied_orange's user avatar

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