Skip to main content

Questions tagged [interfaces]

Questions about `interface` related design considerations, and also "programming to the interface instead of the implementation"

0 votes
2 answers
146 views

I'll get straight to the point. I want to implement a class structure in Java similar to the one in the image. Am I falling into bad practice with this kind of diamond-shaped interface implementation?...
A. WW's user avatar
  • 11
0 votes
6 answers
302 views

In a certain program I would like to have three objects, say, a, b, and c, with c being a shared private member (sub-object) of a and b. The data between the three objects shall only go this way: a &...
Alexey's user avatar
  • 958
3 votes
7 answers
564 views

I'm working on a custom Magento 2 module in my internship, and I'm trying to follow SOLID principles in my code. Right now, my controller actions handle everything: getting request data, processing it,...
Ruben Eekhof's user avatar
5 votes
2 answers
1k views

I'm trying to get hands-on experience with Uncle Bob's Clean Architecture in Go, but I'm running into some issues. Also, I'm not yet familiar with all of Go's idioms. For testing purposes, I'm ...
Crite's user avatar
  • 61
3 votes
4 answers
415 views

When designing a pure virtual base class (interface) in C++, in what cases would I not want to allow polymorphic deletion via a pointer to my base class? I've seen questions about why you should make ...
ToddR's user avatar
  • 335
3 votes
3 answers
554 views

I am starting a project in Java and ran into the following situation. The application requires a persistence layer for a certain document type. This could be a MySql database, an AWS Dynamo DB ...
Matias Grioni's user avatar
1 vote
2 answers
234 views

Let's say I am coding an C++ application which needs to drive some motors with some hardware interface (USB, Serial...). There are several kinds of motors, which expose the same services, but with ...
Oodini's user avatar
  • 147
7 votes
8 answers
946 views

According to Is it wrong to use a boolean parameter to determine behavior?, I know using boolean parameters to decide the behaviour is bad, for example, when using boolean parameters as the following: ...
wcminipgasker2023's user avatar
2 votes
4 answers
486 views

I recently came across some code: val, ok := i.(SomeInterface) if ok { val.Method() } The above is Go, and attempts to cast to an interface and then runs the method for that interface against the ...
DubDub's user avatar
  • 645
0 votes
1 answer
448 views

I’m currently creating a class diagram to develop an application following the “Clean Architecture” guidelines by Robert C. Martin. I’m unsure about how to structure the “Entity” component, ...
Idan Carta-Lag's user avatar
-2 votes
1 answer
222 views

Some may think I'm kidding, but I'm really stuck on this Suppose you have some UserDao interface that you want to implement What should you call it? Here are a few points I'd like to make I firmly ...
Sergey Zolotarev's user avatar
2 votes
2 answers
300 views

Concrete example : https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/DataInput.html#readFully(byte[],int,int) @throws NullPointerException if {@code b} is {@code null}. is before @...
William's user avatar
  • 131
0 votes
1 answer
444 views

It might be that my question would sound a bit stupid but I would like to find the best way for naming my DTO interfaces. In my PHP application I have following DTO types: Simple (which contains a ...
Viacheslav Ravdin's user avatar
2 votes
3 answers
272 views

According to Why define a Java object using interface (e.g. Map) rather than implementation (HashMap), I know I should declare most abstract type when possible, for example, suppose I'm using an UI ...
wcminipgasker2023's user avatar
4 votes
2 answers
321 views

While developing my application I faced an interesting situation: I have multiple DTO's which are almost identical in terms of methods, only properties are different. For example I have AccountDTO ...
Viacheslav Ravdin's user avatar

15 30 50 per page
1
2 3 4 5
50