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 ...
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,...
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 ...
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 ...
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 ...
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 ...
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 ...
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 {
...
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.
...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
architectural-patterns × 403architecture × 174
design-patterns × 101
microservices × 51
design × 47
domain-driven-design × 32
enterprise-architecture × 28
c# × 25
patterns-and-practices × 22
mvc × 19
java × 17
object-oriented × 13
object-oriented-design × 12
cqrs × 12
database × 9
database-design × 9
clean-code × 9
layers × 9
clean-architecture × 9
javascript × 8
.net × 8
dependency-injection × 8
message-queue × 8
api-design × 7
event-sourcing × 7