Skip to main content
Filter by
Sorted by
Tagged with
Advice
1 vote
3 replies
64 views

Description: I am building a web app, let's say about an organization for approving participation in a free service. There will be the following roles: Organization employee Citizen Administrator ...
Stathis Ath's user avatar
Best practices
0 votes
31 replies
200 views

Does the code below violates Liskov Substitution Principle (LSP)? class Object { public: virtual ~Object() = default; }; class A : public Object { public: void print() { std::...
Dmitriano's user avatar
  • 2,474
0 votes
1 answer
78 views

As a coding test I've been tasked with developing a toy three-layer architecture DBMS project, involving OOP principles. The three-layer stuff isn't strictly my background so I've been trying to study ...
GokuToucher's user avatar
3 votes
1 answer
85 views

I'm working a little bit with VIEWS and I created those following seales class. The first one to "hold" the state for the screen, it can only be Loading, Success or Error: sealed class ...
Cristian Alexis Torres Zavala's user avatar
1 vote
0 answers
105 views

Please excuse me for how long this question is. I tried to shorten it as much as possible while still listing all of the various things I've tried and the problems I've run into. I have a state ...
DavidTriphon's user avatar
0 votes
0 answers
31 views

I'm trying to follow best practices by keeping my entity properties private and accessing them via getters and setters, but I run into a compile-time issue when referencing private properties in ...
alanmxll's user avatar
3 votes
1 answer
162 views

In Java SE 21 there is an interface called SequencedCollection. There are few built-in classes that implement that interface, including ArrayList and TreeSet. The interface defines some methods, for ...
Nicolas's user avatar
  • 1,514
1 vote
1 answer
60 views

I am designing models for my Django App and am concerned with decoupling the caller's logic from the model's implementation, so that future changes to the model itself do not require changes ...
Jun Song's user avatar
0 votes
1 answer
138 views

I'm thinking about creating an interface method with an argument that can have a mixed type, to act like metadata. I don't know the metadata type upfront, but I know that some kind of it (or something ...
Constantine's user avatar
-1 votes
1 answer
71 views

I'm designing a menu system in Unity and need help validating my approach to ensure it follows the SOLID principles, particularly the Liskov Substitution Principle. The system consists of: A BaseMenu ...
xxSithRagexx's user avatar
-1 votes
2 answers
129 views

Here in this blog: https://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same/#db5adf784deb4c9b92a656627283c9da. They said that changing the direction of the dependency between the ...
Francisco Silva's user avatar
-1 votes
1 answer
45 views

Let's say I have implemented an Action Design Pattern, and I have these actions: MakeJuice MakeCoffee MakeBreakfast MakeDessert now, for every actions, as it should, have their own set of ...
ssrsvn's user avatar
  • 33
1 vote
2 answers
241 views

I have an exercise on the SOLID principle using java, specially on the open/closed principle and the exercise asks me to make a program the calculates the total area of different geometric shapes and ...
Ali Hassan's user avatar
1 vote
2 answers
213 views

So, I have two classes service-class & entity-class with private constructor & static async method, for creating new instance of class. My service-class create & call new entity-class ...
AlexZeDim's user avatar
  • 4,442
-2 votes
1 answer
46 views

Requirement create different type of decorator and used it with user class so we can add specific details of different type of user based on decorator and in my code I have two decorator one is ...
Shanu Singh's user avatar
4 votes
1 answer
169 views

I am writing a back-end for a program that manages surveys in TypeScript but don't know how to design my Survey and SurveyRepository class without violating the Open/Closed Principle (OCP) My survey ...
Kilian Reichart's user avatar
2 votes
4 answers
116 views

Let's say I have some model code like the following with quite a few references in a moderately sized existing system: public class House { public House(IEnumerable<Window> windows) { ...
jessiebot's user avatar
3 votes
2 answers
670 views

I keep reading code examples that suggest that the Dependency Inversion Principle is achieved by using interfaces for a classes dependencies. That in itself is confusing me, as the more I read about ...
myol's user avatar
  • 10.1k
1 vote
1 answer
213 views

I have read many examples about Dependency Inversion from classic SOLID in different coding languages. // A is dependent on B class A { property; constructor() { this.property = (new B())....
myol's user avatar
  • 10.1k
-1 votes
1 answer
52 views

I'm working with TMDB API, This API has 2 improtant endpoints one for movies and the other for series. right now working on movies, so i made an abstraction layer (module) to get data from that API ...
A-E's user avatar
  • 3,401
0 votes
1 answer
83 views

I'm working on a Spring Boot application with the following structure for sending messages public interface MessageService { void send(String message); } @Component("SendEmailService") ...
Tom's user avatar
  • 95
0 votes
1 answer
72 views

I'm taking a course on C# programming here: https://www.udemy.com/course/ultimate-csharp-masterclass/?couponCode=KEEPLEARNING In it, there's a lecture on encapsulation. The instructor gives an example ...
gib65's user avatar
  • 2,039
2 votes
2 answers
108 views

I have created an ASP.NET Core 8.0 MVC app. Here is my AppDbContext class: public class AppDbContext : DbContext { public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) ...
Reyad's user avatar
  • 23
0 votes
1 answer
68 views

I am developing a Spring Boot app and I am faced with the following situation: I have x and y entities, but the fields of these entities are exactly the same, and because of this they both use the ...
Adrienn's user avatar
  • 135
0 votes
1 answer
53 views

I've got a question around the best way to refactor a Factory like this: I am working on a side-project and have ended up in a position whereby I have an OrderProductFactory that requires a strategy ...
Vortex's user avatar
  • 816
0 votes
1 answer
58 views

this is actually an issue so when we create an interface per class in a project then when someone new join, it is gonna be really hard to keep track on the flow and the integration between classes for ...
hamidreza nasrollahy's user avatar
2 votes
2 answers
90 views

I am wondering what can be the potential benefit if I start to split the interface of my repository which has GET/CREATE/DELETE/UPDATE methods and in one service I have like 10 entities which per each ...
hamidreza nasrollahy's user avatar
5 votes
1 answer
143 views

I am learning SOLID principle. While learning "Dependency Inversion Principle" found out that class should depend on interfaces rather than concrete classes. Does this mean composition is ...
CrystalSapphire's user avatar
0 votes
0 answers
54 views

Controller->Service->Repository->Model->all() I have a construction in laravel(11). My code is as follows: PostRepository.php <?php namespace App\Repositories\Eloquent; use App\...
DCYılmaz's user avatar
-1 votes
1 answer
250 views

We are creating a one-to-many relationship in a class, for example, a student can have many books. In this class, are we not breaking the Single Responsibility Principle? Because Student class has its ...
user24437316's user avatar
1 vote
1 answer
3k views

I have 2 classes: export class Enrollment { private _productId = signal(0); private _price = signal(0); public productId = this._productId.asReadonly(); public price = this._price....
Alex Dantsev's user avatar
1 vote
1 answer
132 views

I'm having a hard time trying to wrap my head around the Dependency Inversion principle of SOLID, I' think I might be mixing up concept with implementation... so I figured I could post my thought ...
JulesMG's user avatar
  • 248
2 votes
2 answers
122 views

I would appreciate some clarification on how to properly implement 'Composition over Inheritance'. I think I have a grasp on the theory but in practice I struggle to understand how it doesn't lead to ...
Link's user avatar
  • 153
0 votes
1 answer
111 views

Wanted to know if I am breaking Liskov Substitution Principle - post-condition rule here, public class ProcessController { public virtual Dictionary<int, string> GetRunningProcess() { ...
riki's user avatar
  • 2,433
0 votes
1 answer
72 views

I am trying to understand how to better write my Flutter application as right now with the current approach, the size of my service file is getting out of hand. Here is my use case (simplified): I ...
Robert J.'s user avatar
  • 2,721
0 votes
1 answer
76 views

In my application I have N child classes all extending a superclass. Every class has its own implementation of serialize but they share some common code. For example: class Serializer { serialize = ...
Andrea Costanzo's user avatar
0 votes
0 answers
191 views

I need to create a simple 2D designer where user can draw shapes (triangles, rectangles, polygons etc) and also change already created shapes. I have three main classes: Entity class Area. Contains ...
BambinoUA's user avatar
  • 7,283
1 vote
1 answer
173 views

Context So far as I understand, the Dependency Inversion and Interface Segregation principles of SOLID OOP tell us to write our program according to the interface, not internal details. So, I am ...
Della's user avatar
  • 1,730
0 votes
2 answers
96 views

I'm working on a social app using flutter, so there are posts to get published. Suppose there are two types of posts. Post contains only text. ImagePost contains images and text. The following code ...
A-E's user avatar
  • 3,401
2 votes
2 answers
131 views

I am trying to understand the dependency inversion principle (DIP) via some simple, but concrete codes and classes (implemented in python) from this tutorial. I am summarising it (with my own comments ...
Della's user avatar
  • 1,730
0 votes
1 answer
154 views

I need help understanding the Single Responsibility Principle (SRP) in software development. I know that SRP says a class should only change for one reason, but I'm confused about the difference ...
Muhammad Nabeel's user avatar
1 vote
1 answer
129 views

My questions is specific to adhering to SRP on the client side where we need to maintain state in our objects instead of adhering to SRP on the server where our state is maintained within a database, ...
Kevin Greetham's user avatar
2 votes
2 answers
567 views

In the microservices architecture, the primary rule is to have autonomous services at all levels of design, including the database and domain model. However, in an application where the classes (...
Madeh_Mohamadi's user avatar
1 vote
1 answer
430 views

Sorry for the long question. I have tried my best to articulate my thoughts as best I can. I am slightly confused with the common practice I hear of one repository per entity. Does this mean we have a ...
Kevin Greetham's user avatar
0 votes
1 answer
120 views

Breaking up methods/functions to do one thing only is considered a good practice as it leads to more maintainable and readable code but it increase number of operations in many cases . How to achieve ...
shadow's user avatar
  • 145
0 votes
1 answer
88 views

I'm working on a project with the task of creating a route to checkout ticket purchases for events. In this scenario, I have a controller that receives the request with order data, client information, ...
Victor Antunes B.'s user avatar
0 votes
1 answer
91 views

I am trying to follow the SOLID principles in my new C# 12/.NET 8 project. I will start by providing an example: Given two separate assemblies AssemblyA and AssemblyB where AssemblyA defines an ...
patvax's user avatar
  • 659
0 votes
2 answers
247 views

My goal is to conform to the Dependency Inversion principle. Meaning that SheetView should depend on Sheet ViewModel's protocol. The problem is when I pass ViewModel to a Sheet View's constructor, ...
Jason Rich Darmawan's user avatar
1 vote
2 answers
232 views

I have created this UML diagram which applies the Template method design pattern: Both concrete classes share a lot of the logic whithin the template methods createTask and completeTask, with small ...
Jose Robles Villares's user avatar
2 votes
1 answer
91 views

In my application I am processing a List of IMyInterface instances. Not all, but some of them in addition also implement IAnotherInterface. Note that IAnotherInterface not derives from IMyInterface. ...
me.at.coding's user avatar
  • 18.5k

1
2 3 4 5
25