Skip to main content
1 vote
2 answers
68 views

Suppose we want to model different kinds of food; pizzas and pies. Both pizzas and pies do have a sort of topping, but their toppings are different. We implement an abstract class Baked, and two ...
magva's user avatar
  • 101
3 votes
1 answer
288 views

Can someone please explain the difference between REP and CRP to me? I understand that the CCP (Common-Closure-Principle) states that modules that need to be changed together frequently should belong ...
dumbTransaction's user avatar
0 votes
0 answers
43 views

I have a folder structure like this: nlp ├── generation │ ├── io_operations │ ├── __init__.py │ ├── generator.py │ ├── processing.py │ └── prompting.py │ ├── prompts (folder) │ ...
Marcel Braasch's user avatar
0 votes
1 answer
162 views

Imagine we want to use the following library like this: use GrahamCampbell\GitHub\GitHubManager; class Foo { private GitHubManager $github; public function __construct(GitHubManager $github) ...
Ali's user avatar
  • 347
0 votes
0 answers
34 views

Example 1: You're designing an object and you put all the things and configurations required for it to work into the constructor call, so no additional calls needed after it initialized. Example 2: ...
yaapelsinko's user avatar
2 votes
1 answer
78 views

I've created a command like this, but I would like to refactor it to follow the DI principle: public function handle() { $productChoice = $this->argument('product'); if ($productChoice == ...
Ali's user avatar
  • 347
0 votes
2 answers
99 views

Please correct me of any of statements in this thread are wrong. I read that reusing code is the primary benefit of inheritance, but it dawned on me that polymorphism through subtyping is the primary ...
LancerHak's user avatar
0 votes
0 answers
57 views

Is there a software design principle that says an application should never alter or delete a user’s work done in the application without them knowing? It’s very similar to the Principle of Least ...
user3163495's user avatar
  • 3,968
1 vote
1 answer
90 views

My specific case is a web application but I believe this would apply more generally: I have data stored remotely in a database. My application uses 'collection' objects that correspond to each table ...
Derek's user avatar
  • 2,112
7 votes
6 answers
13k views

I am making an ASP.NET Core Web API project with controllers. All API controllers derive from ControllerBase that has NotFound() method. I use this method from controllers whenever I can't find a ...
mlst's user avatar
  • 3,631
1 vote
1 answer
1k views

Is there any way to define custom application events without extending ApplicationEvent? We are having submodules based on ports and adapters principle, domain module not having any any external ...
sidgate's user avatar
  • 15.3k
-1 votes
1 answer
48 views

What principle are we violating if we use a method to update an input object's fields? An example: class Data { public int $someField = 0; // it's private with setSomeField method public int $...
NameX's user avatar
  • 59
1 vote
3 answers
160 views

In the given JavaScript code snippet, there are two functions - handleClientError and handleServerError - that handle client-side and server-side errors, respectively. The handleError function is used ...
Ahzam Ahmed's user avatar
0 votes
1 answer
139 views

I have defined an interface IEmailManager as having send method. The email controller is using its concrete type EmailManager as a constructor dependency that sends the email. public interface ...
Engr Umair's user avatar
0 votes
2 answers
417 views

I always have the same question when I must to work with nested objects structure. An example: class Criteria { filters: Filter[]; } class Filter { field: string; operator: Operator; value: ...
Jose Luis's user avatar

15 30 50 per page
1
2 3 4 5
22