Skip to main content
34 votes
Accepted

How to comprehend abstraction in code?

Programming concretely is the impulse to pull details towards you so you can nail them all down in one place. We all start this way and it's hard to let go. Programming abstractly is most definitely &...
candied_orange's user avatar
21 votes
Accepted

What do I use as an alternative to Domain-Driven Design, if I cannot define a Competitive-Advantage area of my system to apply it?

Here are some rules that I have come up with to help: The Rule of Requisition: Use a tool/technique/principle only when the benefits exceed the costs.* Note that "competitive advantage" is ...
Robert Harvey's user avatar
13 votes

How to comprehend abstraction in code?

At the bottom, there are some updates to how this fared for me every quarter of the year or so, I think they're valuable. Good naming. Or, if it's someone else's code, trying to attribute good names /...
coolpasta's user avatar
  • 641
12 votes

Disadvantage of the strategy pattern and how to overcome it

This quote is surprising and misleading. Design patterns are not chosen in a catalogue by comparing pros and cons! Patterns are chosen because they address a very specific problem that you are facing....
Christophe's user avatar
  • 78.7k
11 votes
Accepted

Rich domain model vs strategy pattern in DDD

The logic was supposed to be implemented inside the entities Yes, although it's usually more specific than that - the logic that computes the new state of an entity is supposed to be "inside" the ...
VoiceOfUnreason's user avatar
8 votes

Implementing strategy pattern multiple variables?

The intent of the strategy pattern according to the GoF is to "define a family of algorithms, encapsulate them and make them interchangeable. The strategy lets algorithms vay independently from ...
Christophe's user avatar
  • 78.7k
7 votes

The "real and effective" GIT CI/CD strategy

By having three repo you kind of have a branching strategy already but a complex one. I think you're not facing a technical issue but a cultural issue. Even if your solution is good (I think it is but ...
JayZ's user avatar
  • 827
6 votes

What do I use as an alternative to Domain-Driven Design, if I cannot define a Competitive-Advantage area of my system to apply it?

In the Red book (implementing DDD), there is DDD scorecard at page 11, which helps you recognize when DDD should be considered. for example If your project contains 30+ user stories will grow in ...
Muflix's user avatar
  • 195
5 votes

Rich domain model vs strategy pattern in DDD

I see Employer as the aggregate root here. When you do OO modeling, usually a business function is defined on the subject of the action, not the initiator of the action. It depends on the ...
Robert Bräutigam's user avatar
5 votes

Rich domain model vs strategy pattern in DDD

In rich domain model we are supposed to put domain logic into entities The problem with this sentence is, people interpret it wrong as "we are supposed to put all domain logic into entities". A ...
Doc Brown's user avatar
  • 210k
5 votes
Accepted

Looking for a strategy to ensure name of child node stays unique in collection

Uniqueness of those names is a property which is clearly defined only in context of a Pages collection. That is most easiest understood when you think of a Page object changing its "parent" container, ...
Doc Brown's user avatar
  • 210k
4 votes

Internal REST API versioning strategy

You should have a versioning strategy because that is key to independent evolvability, but it should be tied to Content-Type, not URLs or anything else. Even in a closed-house setting, you should ...
Nicholas Shanks's user avatar
4 votes
Accepted

When can client code know about strategy pattern implementations?

I looks to me that you have two different problems. Problem A is easy to solve. But problem B is harder. Problem A is to dynamically call a given strategy given a configString. That can be solved by ...
Tulains Córdova's user avatar
4 votes

How To: .Net periodic task to validate entries in tables

Write a program that queries the DB and does the things it needs to do. Run it as a scheduled task using the tools provided by the target operating system. Job done. Don't write your own scheduler. ...
LoztInSpace's user avatar
  • 1,199
4 votes
Accepted

Reconciling MVC with a strategy pattern

The MVC design pattern does not specify the mechanics involved in choosing which view to render. Both ways are "MVC". If you are rendering a collection of books, the controller renders a single view ...
Greg Burghardt's user avatar
4 votes

Discount calculation pattern

The intent of the Strategy pattern is to encapsulate a family of algorithms and use them interchangeably. But your current need seems to be very different: You want to apply different algorithms ...
Christophe's user avatar
  • 78.7k
4 votes

Strategy & Architectural Decision: Customer data migration between two companies

Great, more email for the spam folder... OK seriously now: your business' desire to merge the user accounts is not of concern for the customer. Therefore, the customer will not have any desire for ...
mtj's user avatar
  • 2,058
4 votes
Accepted

How to implement Gang of Four's Lexi's Compositor-Composition?

The idea behind Lexi's Composition/Compositor combination is that an empty document starts with a Composition without children and a concrete Compositor that determines how the formatting of the ...
Bart van Ingen Schenau's user avatar
4 votes
Accepted

Is my git branch strategy best practice?

If you make sure that the master branch can be released at any time, so that the following conversation can happen: CEO: Is New feature X already done? You: Yes, it has been tested and merged. CEO: ...
Bart van Ingen Schenau's user avatar
4 votes

Is my git branch strategy best practice?

This exact workflow I've successfully implemented for my projects. There is a minor complication though: we use Maven and it implies that for each patch/bugfix a version defined in pom.xml file is ...
Basilevs's user avatar
  • 2,268
3 votes
Accepted

Strategy Pattern with abstract class instead of interface?

Is the strategy in the strategy pattern always an interface? That depends on what you mean by "interface". If you mean the standard general programming meaning of "an abstraction that hides its ...
Jörg W Mittag's user avatar
2 votes

What is the best serial port connection strategy

Keep the connection open and separate the logic of ensuring the connection is open from the actual using of the serial connection. In C# I would provide the following methods for using the serial ...
Kasper van den Berg's user avatar
2 votes

Advantages of Strategy Pattern

There is nothing wrong with if/else per se. In many cases if/else is the simplest and most readable way of expressing logic. So the approach you describe is perfectly valid in many cases. (It is also ...
JacquesB's user avatar
  • 59.9k
2 votes

Strategy Pattern with abstract class instead of interface?

The strategy pattern is rather orthogonal with regards to the language-specific construct of an interface. The strategy pattern works just fine in languages which do not have an interface or ...
Ben Cottrell's user avatar
2 votes

Should you refactor all helper classes into small obects with state?

I would choose the variant where paint_thickness is a parameter of the paintRoom method. It can be optional: $some_painter->paintRoom(paint_thickness); $painter_factory->createPainter()->...
michalsrb's user avatar
  • 414
2 votes

For learning purposes, how should I set about implementing an arbitrary precision library in C or C++?

Base your code on the standard C++ library, and usual c++ conventions. Preliminary thinking Define the interface of your operations without thinking of the implementation. This includes conversions ...
Christophe's user avatar
  • 78.7k
2 votes
Accepted

How to design a Rule Engine Validation System to be asynchronous and highly performant!

This answer will be incomplete as it does not address your question on "how to design" - whether to incapsulate classes or not. But in the interest of efficiency, I think you can separate your rules ...
LSerni's user avatar
  • 2,441
2 votes

(Fuzzy) Data duplication detection - scoring systems strategy

It is unlikely that you will be able to build a reliable automated system, but you can apply statistical techniques (“machine learning”) to detect possible duplicates and report them for human review. ...
amon's user avatar
  • 135k
2 votes

Strategy to review all occurrences of specific field in large project

To simplify, I'd do this refactoring module by module. If possible, I'd also leverage the IDE features, such as find usages, change-of-signature refactoring, and so on. For example, you could do ...
schrödingcöder's user avatar
2 votes

Strategy to review all occurrences of specific field in large project

If you are using a compiled language with static type checking, where the compiler will complain if you forgot to change the variable name back, your overall strategy seems to be ok. Note, however, ...
Doc Brown's user avatar
  • 210k

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