Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
4 answers
414 views

Is casting a concrete type to an interface and using it if it successful bad practice?

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
2 votes
4 answers
2k views

Confused about inheritance and correct usage. Should I avoid using members in base class?

I am using C++ , but as far as I understand most OO principles are cross language. In most of the articles that I have read and liked about inheritance the advice are about : not to use it for the ...
user3717741's user avatar
9 votes
2 answers
3k views

Interfaces and Casting

I recently started working with a shiny new version of a codebase that uses interfaces all over for... basically everything. I think all of our concrete classes implement interfaces. The problem I've ...
William's user avatar
  • 284
0 votes
0 answers
105 views

Heuristics/rules for programming to an interface [duplicate]

I am struggling with applying the "programming to an interface" guideline because I can't seem to decide in which situations it is necessary and in which ones it's overkill (or even counter productive)...
carlossierra's user avatar
  • 1,425
15 votes
5 answers
17k views

Should every class I write adhere to an interface?

I'm writing a game in Typescript, and decided going in that I was going to try to adhere to the idea of "interface based programming", where you write code based on an interface, instead of the ...
Carcigenicate's user avatar
0 votes
0 answers
74 views

What should I do with too much interfaces needed for a dialog

Let me start by doing a small summary of the changes we did in our code in the last year. We have a software (VERY big) that is used to visualize multiples underground networks, enter data in the ...
Jean-François Côté's user avatar
2 votes
0 answers
221 views

Pattern or solution for using classes with different interface the same way

What I would like to achieve is to use classes (now two, later more) with different interface the same way, so I would like avoid using decisions based on the interface on upper levels for instance, I ...
Damien's user avatar
  • 121