I have, say, two devices. class Device1{ public: int GetData(){ //... } }; class Device2{ public: bool GetData(){ //... } }; I have a a C# sty
So, I've been studying design patterns and in the context of the Single Responsibility Principle I tried to calculate the Lack of Cohesion of methods (LCOM) in
Can someone please tell me which design pattern is used in the code below? This code has been used in a recruitement test (live codingame test
I have quite large website for incident analysis. Now the owner wants to make a smaller analys tool with parts of the old tool to make it simpler for smaller in
I have quite large website for incident analysis. Now the owner wants to make a smaller analys tool with parts of the old tool to make it simpler for smaller in
Suppose that I have two different solvers that both will be called at run time. I want to call solvers' api and get resulted Eigen matrix through the base class
I'm looking for some good ideas on software design for this problem: A server sends an array of Steps: type StepTypeEnum = 'SECURITY' | 'PERSONAL_DETAILS' | ...
My Factory has dependency on Repository. It calls many methods from Repository. Lets say something like this: class CarFactory { private Repository reposito
My controller looks like this: public function store(Request $request) { $validateData = $request->validate([ 'name' => 'required|u
I am trying to implement an interface and this interface is taken by two concrete classes say class First and class Second, I have another class that takes thes
Leaders in DDD cite the Application Layer as the appropriate place for Transaction Management. For example, from Vince Vaughn: Application Services reside in t
So let's say I have a product order system. I have several classes that may look like this. data class CreateOrderCommand( val productId: String, val produ
I wanted to know the exact difference between method chaining and fluent interface. As I understand it, method chaining is just running the methods of previous
I am trying to build an object that gets its data from external APIs. I will try to explain it with an example: First of all, I get a POST body in my API to cre
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Creational.Builder { public c
Currently I have code like this: for (each item) { if (item == 'x') { print } if (item == 'y') { print } } Now, there is an additiona
I have been looking into cloud firestore as my backend infrastructure. Ive been using realtime database but feel the switch is vital. I have looked at the fireb
I'm trying to model blood flow. As simple as it gets I am trying to have an event (TimerTick) trigger the transfer of a resource object from unit A to unit B, B
Many Architects and Engineers recommend Dependency Injection and other Inversion of Control patterns as a way to improve the testability of your code. There's n
Gang of Four sums up the difference between Template Method and Strategy as follows: Template methods use inheritance to vary part of an algorithm. Strat