Skip to main content

Questions tagged [interfaces]

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

2 votes
2 answers
317 views

In unit testing: How to abstract a dependency of subject under test?

Disclaimer: I am learning unit testing. I am also kind of beginner in object-oriented design. Currently, I am involved in the development of an application to manage the finance of a humble food ...
Siva Sankaran's user avatar
6 votes
10 answers
6k views

In "I don’t want my users knowing that I’m handing them an interface.", why is the severity "I don’t want" instead of "Users don't need to know"?

According to some answers to this question, I should not add prefix "i" to interface. I'm not raising new reasons to support or oppose the prefix "i" on interface. Instead what I ...
wcminipgasker2023's user avatar
0 votes
3 answers
244 views

Is "my method supposes to work with specific subtype only" a reason to avoid "declare the most abstract type"?

According to Why define a Java object using interface (e.g. Map) rather than implementation (HashMap), I know I should declare the most abstract type as possible. However, I found that a situation ...
wcminipgasker2023's user avatar
7 votes
9 answers
8k views

Why just "interface segregation principle" but not "method segregation principle"?

According to one definition of "interface segregation principle" that states currently in Two contradicting definitions of Interface Segregation Principle – which one is correct?, a client ...
wcminipgasker2023's user avatar
2 votes
3 answers
238 views

How to retain the concrete type when writing base-class-oriented code?

A scenario often arises when attempting to make some existing code reusable. I introduce an interface to represent the commonality between some new feature I'm implementing and some existing ...
amarsha4's user avatar
  • 176
5 votes
5 answers
2k views

How to think when grouping functionality into modules

What are some commonly used strategies when it comes to divide software into modules, other than there should not be any cyclic dependency between any modules? Some ways I think of Group everything ...
user877329's user avatar
2 votes
2 answers
246 views

How to "explicitly" declare an implicit interface?

Abstract (virtual) interfaces allow you to explicitly declare a set of methods which a child class must implement in order to compile and be used with other parts of the code. This works great for ...
Patrick Wright's user avatar
2 votes
3 answers
675 views

Should my methods return concrete classes or interfaces?

I'm building a ASP.NET Core Web API and the application consists of 3 main modules. Data module: Contains the entities and DbContext Web API: Contains the controllers Service module: Contains all the ...
Critical Failure- Core Dumped's user avatar
3 votes
4 answers
491 views

Does "declare the most abstract type" increase coupling actually?

According to Why define a Java object using interface (e.g. Map) rather than implementation (HashMap), I know I should declare the most abstract type possible, so for example: public interface Fruit{ }...
wcminipgasker2023's user avatar
1 vote
1 answer
108 views

Virtual Method vs. Abstract Class Member

Suppose we are writing an interface class which has some "properties" and "operations." Assume also that every concrete implemented of the interface must contain the same set of ...
Patrick Wright's user avatar
0 votes
4 answers
341 views

Are "easier to search for the interface" and "avoid yo-yo to interface to find implementations to fix bugs" reasons to add prefix "I" on interfaces?

According to Should interface names begin with an "I" prefix?, I should not add prefix "I" to interfaces. However, I think prefix "I" in interface may be useful sometimes....
wcminipgasker2023's user avatar
1 vote
3 answers
211 views

How robust should an interface/implementation be?

In a spare-time project of mine, I implemented RSA public-key cryptosystem. Because the official PKCS#1 standard specify key formats in terms of ASN.1 syntax and DER/BER coding, which is a coding with ...
DannyNiu's user avatar
  • 229
0 votes
2 answers
198 views

For non-container classes, are "better naming" and "ready for commented codes" good reasons not to declare the most abstract type?

According to Why define a Java object using interface (e.g. Map) rather than implementation (HashMap), I know I should declare the most abstract type possible, but the question is about template class ...
wcminipgasker2023's user avatar
0 votes
1 answer
78 views

Where to store a props type declaration on a DDD project?

I am trying to apply DDD to a Vue project (so it's DDD on the frontend) and I have a doubt as to where store a props type. A Vue component can have props, which is basically named data passed to the ...
Bernardo Benini Fantin's user avatar
1 vote
1 answer
112 views

Correct way to represent acquaintance enforced by interface in UML class diagram

Suppose I have the following client code: using System; namespace InterfaceCompositionUml { internal class Program { static void Main(string[] args) { ...
user32882's user avatar
  • 267

15 30 50 per page
1
2 3 4 5
49