Most voted "interface" questions
Used for object orientation concept. DO NOT USE for user interface or hardware component.
Learn more…200 questions
Sort by count of
- 
		64 votes1 answer5474 viewsProgramming facing the interface and not the implementation, why?What are the main reasons (in practice) that lead developers to apply the practice of developing for interface and not for implementation? 
- 
		63 votes3 answers24262 viewsWhat is the difference between Ienumerable, Iqueryable and List?What’s the difference between Ienumerable, Iqueryable and List no . NET? When it’s best to use one or the other? Why does Resharper suggest that I modify the return of that function, for example,… 
- 
		57 votes7 answers1478 viewsIs using many interfaces a bad programming practice?I am a student in Information Systems and I am modeling a game, a virtual pet that has its needs and conversation with its owner, below follows the modeling of classes and interfaces. I showed it to… oop software-architecture interface abstract-classesasked 11 years, 3 months ago Ivan Ricardo Lopes 1,376
- 
		50 votes7 answers6727 viewsIn object orientation, why are interfaces useful?Someone can give a practical explanation of why interfaces are used and why they are useful to us developers? 
- 
		49 votes6 answers32712 viewsAbstract Class X InterfaceWhat is the difference between an abstract class and an interface? I don’t understand when I should use one or the other. 
- 
		49 votes1 answer13752 viewsDifference between Icollection, Ilist and List?What’s the difference between ICollection, IList and List? When I should use each one specifically? 
- 
		31 votes3 answers21968 viewsWhat is the purpose of the Serializable interface?Example of implementation: public class MyClass implements Serializable{ private static final long serialVersionUID = 1L; } 
- 
		30 votes2 answers4104 viewsWhen should I use Inheritance, Abstract Class, Interface, or a Trait?From PHP 5.4 we have the Trait, that "are mechanisms that help (and greatly) the reuse of code, and serve perfectly to solve the problem of lack of multiple inheritance". Example of Abastrata Class… php interface inheritance abstract-classes traitasked 10 years, 3 months ago Wallace Maxters 102,340
- 
		29 votes1 answer10807 viewsWhen and how to implement Parcelable vs Serializable?After a long time using the Serializable implementation in my classes on the Java platform (Android), I discovered Parcelable, but I was in doubt regarding the following questions below: 1. When to… 
- 
		23 votes2 answers8037 viewsArraylist x ListWhat is the difference of declaring ArrayList and List for lists in Java? What are the advantages of using one or the other? 
- 
		23 votes2 answers418 viewsIs it bad practice to use empty interfaces?I have heard comments that it would be a good idea, when a future implementation can take place. Also heard that it is a bad practice. I know that in PHP, for example, there is an interface called… 
- 
		21 votes2 answers8871 viewsHow and when to use Interface?When should I use an interface, in which situations its use is feasible and which is not feasible and how to use it correctly? I developed an example to illustrate a situation, below: using System;… 
- 
		21 votes6 answers1578 viewsIs it good practice to use constructors (or magic methods) in interfaces?Well, I usually come using interfaces to define how some methods will be used. But to be honest, I’ve never seen anyone using interfaces to define contracts for a construtor. In a specific case I… 
- 
		17 votes2 answers5548 viewsIn OOP, can an interface have attributes?Is it possible for an interface to have attributes? If not possible, why not? 
- 
		15 votes1 answer703 views
- 
		14 votes2 answers1408 viewsHow and when should we use Interface to document systems in PHP?I always wondered exactly, if it is a good practice, to make a system always making use of Interfaces, or this is not necessary? Interface People { public function getName(); public function… 
- 
		13 votes6 answers1170 viewsWhy is it not possible to define an interface with static methods?I would like to force some of my classes to be implemented in Singleton, but I came across the following situation. interface ICharacterSingleton{ static Characters getInstancia(); } public static… 
- 
		13 votes2 answers1215 viewsWhy create an interface for each DAO?I see a lot on the Internet the creation of an interface for each system DAO. I understand the importance of using interface mainly for an easy implementation exchange, I have even found an… 
- 
		12 votes3 answers637 viewsIs it correct to state which interface solves the multiple inheritance problem in Java?It is known that Java does not support multiple heritages. Is it correct to say that the interface concept solves the multiple inheritance problem in Java? If so, why? 
- 
		12 votes1 answer950 viewsJava Interface 8Java 8 allows you to implement methods in the interface itself. So I’d like to know what an abstract class can do that an interface cannot. Source:… 
- 
		12 votes2 answers381 viewsJava 8 "default method" versus C# "extend method"Java 8 introduces the concept of "standard method" to allow adding new features to an interface. C# provides "extension methods" that allow "adding" methods(features) to existing types. Taking into… 
- 
		11 votes3 answers579 viewsProgramming for the interface means programming for a super-type, why?When we program facing an interface, does it involve programming for a super-type? What is the meaning of this? 
- 
		11 votes2 answers3452 viewsInstantiating interface - What’s the point?I learned in college and in all the materials I saw that the interface serves to define a pattern that classes should follow and interfaces CANNOT be instantiated. However I came across projects… 
- 
		10 votes2 answers4750 viewsWhat are functional interfaces?What are functional interfaces in Java? This concept already existed or emerged from version 8 of Java? 
- 
		10 votes1 answer3061 viewsWhen to use InterfacesI always had the following question: When should I really use an interface instead of inheritance and what advantages can I get ? 
- 
		10 votes3 answers2035 viewsInterface or Abstract?I read several contents on this subject, until arriving at this example: public interface Funcionario{ public void trabalha(); public void recebe(double salario); } public abstract class Geek… 
- 
		10 votes2 answers525 viewsWhen is it recommended that a class implement Idisposable?I use the IOC standard in my project which facilitates the call of procedure type Resolver.Resolve<IPedido>().GerarPedido(), however, I did not want to leave "loose" in this way, I would like… 
- 
		10 votes2 answers551 viewsWhat is the point of an explicit C#interface implementation?I usually use interfaces in PHP and I was able to do a similar example, only for tests, in C#. class MyClass : IWriter { public string Writer(string str) { return str; } } interface IWriter{ public… 
- 
		9 votes2 answers1138 viewsWhy can’t the implemented methods of an interface be private?When I implement an interface in my class, why your implemented methods cannot be private/protected/etc? And another question, when I implement an interface method explicitly, why can’t this method… 
- 
		9 votes1 answer1492 viewsLibraries, interface, classes and methodsWhat’s the difference between libraries and interfaces? For example, on the line: import java.util.Scanner; The util would be the interface and Scanner the class? Or the util would be the library… 
- 
		9 votes5 answers1956 viewsDifference between JSON and String dataI’m just finishing building a website on PHP with architecture MVC, the next step is to integrate the application (I only have the interface) with the core(controller) site, to fetch information… 
- 
		9 votes2 answers128 viewsIf abstract classes and interfaces cannot be instantiated, what is happening here?I discovered that interfaces and abstract classes cannot be instantiated, but my teacher gave me an example that left me in doubt, because it seems very an instance of interface ActionListener.… 
- 
		9 votes2 answers687 viewsHow do I know if a class implements an interface?In PHP, we can implement one (or more) interface in a class. Thus: interface Authenticable { // métodos } interface Model { // métodos } class Person implements Authenticable, Model { // métodos }… 
- 
		9 votes2 answers4792 viewsWhat is Yenumerable and Yenumerator for?I made a combo of questions about IEnumerable and IEnumerator not only to help me but to help everyone who needs a more didactic explanation. Question 1 Could someone explain in a more didactic way… 
- 
		8 votes1 answer492 viewsHow to get the generic type entity type from the top interface?I have the following situation: public class MinhaClasse : IMinhaClasse<Carro> { //... } public static void Main(string[] args) { var foo = new MinhaClasse(); } It is possible to get the… 
- 
		8 votes2 answers925 viewsHow to add Static methods in interface?I have my method: public static CloudStorageAccount GetAccount() And in my Interface: public interface IAzureStorangeService { CloudStorageAccount GetAccount() } But the compiler accuses that the… 
- 
		8 votes2 answers121 viewsDeclaration of an interface with WhereI’m studying a lot Pattern design, because I think they solve a lot of things and it is very opportune to study them. I took this statement on the Macoratti website and I confess, I could not… 
- 
		8 votes3 answers370 viewsPrivate set of property in an interfaceI’m modeling a C# interface that has a property. However, I want to ensure that all classes that implement this interface maintain the Setter as private: public interface IBar { string Id { get;… 
- 
		8 votes1 answer101 viewsPros and cons of securing an interface contract through a subclassThis article presents an interface IList<T> containing the methods Add(T item) and Count(). The contract of that interface expects that when an item is added, the method Count() reflects the… 
- 
		7 votes2 answers360 viewsTheoretical doubt - Interface, unique responsibilityPresentation: I created a photo.Cs class that should be responsible for: Calculate the angle of view of the lens; Receive lens zoom (in mm) Receive the cut factor (value multiplied by the lens zoom… 
- 
		7 votes1 answer79 viewsWhy can’t a Trait implement an interface?Why a Trait cannot implement an interface in PHP? 
- 
		7 votes2 answers820 viewsWhat is type and state inheritance?Recently in a Java simulation, I came across a question related to inheritance classification, which I had never seen before. Taking the opportunity, I will separate into topics, so that the answer… 
- 
		7 votes1 answer4432 viewsHow to create Javascript interface?I believe most of you know the concept of Interface, fairly widespread in POO, but in Javascript in all projects I worked until today I have not seen use of this concept. I did some research on, but… 
- 
		7 votes2 answers684 viewsUse of interfaces in domain classes?The project analyst I’m working on as a C# programmer vigorously defends the concept of SOLID in development. And it says that one of the requirements to use it is to have interfaces for everything.… 
- 
		6 votes1 answer545 viewsGenericdao - Is that correct?I’m implementing a simple GenericDAO as below, but I feel like I’m doing the wrong thing, it works but I feel like there’s something wrong anyway, could help me? I created an interface like this:… 
- 
		6 votes1 answer755 viewsHow to make an interface in C++?Java, C# and other languages have the concept of interface, which is very useful in some circumstances. How to interface or get closer to it in C++? 
- 
		6 votes3 answers14381 viewsAre there interfaces in python?In languages like PHP and Java, there are interfaces, which, when implemented in a class, requires it to contain the methods of this interface in the same way as they were declared. Example in PHP:… 
- 
		6 votes1 answer3121 viewsClass and interface differenceWhat is the difference between class and interface and when I should use one or the other? 
- 
		6 votes2 answers166 viewsWhat is the Countable interface for in PHP?I saw a certain class whose statement was that way: class Collection implements Countable {} I realized she was implementing Countable, but I didn’t understand what this implementation was doing… 
- 
		6 votes1 answer100 viewsWhat is the use of default interface methods?I was seeing some features proposed for C# 8 and came across the default interface methods. Add support for virtual Extension methods - methods in interfaces with Concrete implementations. From what…