Questions tagged [design-principles]
The design-principles tag has no summary.
69 questions
6votes
2answers
2kviews
How to implement many-to-many relationships without violating design principles in OOP?
I have an event class that holds details of a volunteering "Event" class. There is an "EXCO" Class that can create and edit details of said Events. There is also a "Volunteer ...
4votes
2answers
1kviews
Passing data through events to adhere to the Tell-Don't-Ask principle?
In my little WinForm app, intended to practice as a hobbyist, I'm using this code to pass data from the View to its Presenter: public event Action<object, string, string?>? SearchInAlbums; ...
1vote
2answers
204views
The dependence of the implementation of one class on the implementation of another class
I need to implement a set of algorithms for data processing. Algorithms do not directly access data, but use a set of basic operations that are placed in a separate class. The following code can be ...
0votes
1answer
488views
Stable abstraction principle
I'm studying design principles, and I have a doubt in package coupling principles. I know that the 'Stable Abstraction Principle' says that a package should be as abstract as stable, and it says that ...
0votes
1answer
671views
Source of "... against the interface, not the implementation"
For a paper I am writing, I need to find the origin of the following two phrases: Code against the interface, not the implementation and Test the interface, not the implementation (Note: the ...
1vote
2answers
102views
How to improve the design of the code using tools (e.g. git)?
There is a bunch of books that state principles about good code (SOLID, DRY, Design patterns etc.) Those principles are solutions to some problems. An application of those principles could go like ...
0votes
0answers
123views
What is the best way to share data between two loosely coupled interfaces?
I have two interfaces: Camera and Computer. So far, each interfaces have multiple implementations in my codebase and they are loosely coupled (no implementations of Camera depends on any ...
-1votes
2answers
279views
Enum and Programming to Interface and best practices
I am learning stuff and have made 2 microservices, Listener and MyApp. Listener is a jms listener (consumer of messages) and MyApp is the app sending messages to queue. I have 2 type of events CREATE ...
-1votes
1answer
239views
Is "Inheritance as Specialization" hurt? And how can it be fixed? [closed]
Given is the following package/class diagram of an implementation of java.util.List: 1. Which design principle is (most likely) hurt by the ArrayBasedList class? The design principle that is hurt by ...
-2votes
1answer
66views
How do you enforce API contracts across mutliple stacks?
For systems that are built on top of diverse tech stacks, including both static and dynamic types languages, what is in practice some ways to have the API contracts published and enforced? Some wiki ...
2votes
4answers
273views
Altering the state of a composed class by its composing classes. Is there any rule or principle for not doing so?
In other words, is it good to define the method that removes an element in a collection inside the class representing the element, considering a composition relationship? Something like: listElement....
-2votes
1answer
72views
Using a field, variable, or column for multiple purposes
I am in a situation right now where a solution has been proposed that uses a csv file. The proposed file structure essentially contains three atomic values; ID Thing 1 Thing 2 Fine. As we were ...
1vote
1answer
518views
Include Get Password function in User Domain without violating separation of concerns
Problem: I am using a Domain Driven Design architecture and I have a domain model called User as follows: public class User{ public User(string username){ this.Username = username; } ...
16votes
3answers
8kviews
What is separation between policy and mechanism?
The Wikipedia article on separation of mechanism and policy says The separation of mechanism and policy is a design principle in computer science. It states that mechanisms (those parts of a system ...
15votes
3answers
3kviews
Is there a conflict between YAGNI and SRP?
I my job, I am tasked with the responsibility of improving the code quality. To meet this responsibility I often pair program with developers and conduct sessions on design principles and design ...