New answers tagged object-oriented-design
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 ...
1
vote
Multiple objects using the same connection for communication, filter messages "above" or inside the objects?
I think this problem is in need of another layer of abstraction.
Sounds to me like you are in need of a ConnectionFilter object. That a device will link to the main connection. And it filters the ...
2
votes
When to *not* use SOLID principles
S: Good for the most part, but be careful not to over-fragment your code and scatter functionality all over the place.
O: Applicable to enterprise OOP. Probably you should just avoid inheritance, in ...
1
vote
When to *not* use SOLID principles
As you are mostly looking for examples where skipping aspects of SOLID may be OK, or where sticking to it too much might be problematic, let me suggest this:
The more your code base has the character ...
1
vote
How to structure a cart with cart products object
Actually, you get to choose. Whatever makes the most sense to you.
This is one of the beauties of properly separated code. You are able to define what your persistence CartProduct (i.e. the table ...
1
vote
Accepted
How to structure a cart with cart products object
There are multiple ways to structure this, which are independent of Domain Driven Design. The Ubiquitous Language mentioned in DDD guides you in naming things. Within the realm of e-commerce, products,...
4
votes
When to *not* use SOLID principles
I do not think I can add anything new, as there are already a couple of really good answers, so I will merely try to put it another way around.
The idea behind the SOLID principles is to have clean, ...
1
vote
REST - Adding a new field
There is no relation to how information is given on a REST API and how information is stored in a database.
It is entirely normal and accepted that a REST API presents data from multiple database ...
3
votes
When to *not* use SOLID principles
The SOLID principles are also called the principles of object oriented programming. Since no other answer has mentioned it before, let me do it.
You don't apply SOLID to any other programming paradigm,...
152
votes
Accepted
When to *not* use SOLID principles
My Principle of Applying Principles:
Principles, patterns, and practices are not final purposes. The good and proper application of each is therefore inspired and constrained by a superior, more ...
14
votes
When to *not* use SOLID principles
Even when a certain situation does not require those principles, following SOLID to a certain degree does not automatically lead to "worse code" (at least, it does not automatically make ...
4
votes
When to *not* use SOLID principles
All of these concepts in SOLID have disadvantages.
S - This one is mostly safe, unless you are restrained from an address or storage space perspective. Think embedded software.
O - Can come with a ...
11
votes
When to *not* use SOLID principles
SOLID principles (and most of software engineering, really) are about human factors. The goal is to enable working on a codebase in the face of unforeseeable future requirements changes.
Therefore, ...
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 ...
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 ...
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 ...
0
votes
Specialization and LSP violation?
If you want to add extra parameters to a method without changing the method signature, inject a context object into the constructor. ie
ExternalDoc
ExternalDoc(IContext context)
public override ...
0
votes
Specialization and LSP violation?
There are two different situations: One, you use inheritance so that an "ExternalDocument" can be used wherever a "Document" can be used. In that situation it should have ...
Top 50 recent answers are included
Related Tags
object-oriented-design × 1683design-patterns × 590
object-oriented × 502
design × 426
java × 235
c# × 181
domain-driven-design × 100
architecture × 94
c++ × 92
inheritance × 89
class-design × 87
interfaces × 71
python × 57
solid × 55
php × 48
programming-practices × 38
dependency-injection × 37
single-responsibility × 34
refactoring × 30
uml × 30
api-design × 29
domain-model × 29
encapsulation × 28
mvc × 27
database-design × 25