Most voted "oop" questions
Object orientation is a paradigm of analysis, design and programming of software systems based on the composition and interaction between several units of software called objects.
Learn more…1,456 questions
Sort by count of
-
12
votes2
answers13989
viewsWhat is the function of the super in a Java constructor?
I have a daughter class that inherits from another abstract class, and in the class builder I have the following: Public aluno(String nome, int idade){ super(nome,idade); } What is the function of…
-
12
votes2
answers5497
viewsHow to perform method overload with PHP?
How to perform method overload with PHP? To declare methods with the same name but with different parameters.
-
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
answer1740
viewsWhat are the differences between the concepts of polymorphism and superscript in OOP?
I was a little confused when researching polymorphism. The concept of polymorphism resembles the concept of superscript. What are the differences between polymorphism and superscript in OOP?
-
12
votes1
answer950
viewsJava Interface 8
Java 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
answers4565
viewsWhat are DDD aggregates and how to identify them?
In DDD there is the notion of aggregate. A definition I’ve seen around is as follows: Compounds of Entities or Objects of Values that are encapsulated in a single class. The Aggregate serves to…
-
12
votes2
answers699
viewsOrigin of object orientation
I have been working for 4 years with object orientation but to this day I have not asked myself the origin of this paradigm. What I’m trying to understand, basically, is what were the motivations…
-
12
votes4
answers1580
viewsIs this a common practice in object orientation?
In object orientation, one way to ensure encapsulation is to maintain the attributes of the private classes and modify their state via methods. In addition, to ensure the integrity of objects, it is…
-
12
votes1
answer6364
viewsWhat are the advantages of using object-oriented databases?
What are the advantages and disadvantages of using object-oriented databases in relation to relational databases? What are the most commonly used object-oriented databases?
-
12
votes1
answer479
viewsIs inheritance a bad practice for all languages?
I took a course in architecture of Java projects and the instructor told me that heritage in Java is considered a bad practice, which should always be avoided and is preferable if possible to use…
oop software-engineering encoding-style inheritanceasked 7 years, 11 months ago Fernando Bittencourt 174 -
12
votes1
answer1898
viewsWhat is Class Coupling?
I was reading this reply in relation to the design standards relating to Serviceprovider and Servicecontainer, however, the AR Euler01 cited a pattern that mentions class coupling, and it was at…
-
12
votes1
answer3203
viewsWhat are the pillars of object-oriented programming?
In general, I’ve seen some places say that object-oriented programming has 3 fundamental pillars, in others I’ve seen saying that it’s 4 pillars. How many and what are the pillars of object-oriented…
-
12
votes2
answers129
viewsWhy can’t I declare an attribute as an object?
I have a class A and I’m creating a class B. I want one of the attributes of B is an object of A. Why the notation public $objeto = new A(); is not correct?…
-
12
votes4
answers229
viewsIs overloading methods less performatic?
I was reading about interfaces as part of my studies and came across an overloaded class (overloading) methods, with two comments saying that it should be avoided. I was in doubt about it affecting…
-
12
votes4
answers549
viewsProblem with polymorphism
I have a polymorphism problem. But before I explain it, I want to make it clear that I’m still learning a lot, so if you want to throw my structure in the garbage, be my guest. I have a project that…
-
12
votes2
answers688
viewsClass copy in C#
In C++ programming to copy one class, to another, just do the following: minhaClasse* class_1 = new minhaClasse(); minhaClasse* class_2 = new minhaClasse(); *class_2 = *class_1; // Faz a atribução…
-
12
votes1
answer231
viewsWhen is it useful to separate state of behavior?
In object orientation there is the concept of encapsulation: meet in the same state class and the functions operating in that state. But there are situations where it is useful to separate state and…
oop software-engineering ddd software-project encapsulationasked 6 years, 4 months ago Piovezan 15,850 -
11
votes1
answer5272
viewsWhat is a wrapper class?
What is a wrapper class? How they can be useful? Cite examples of use in php or c#, as well as when to use or not to.…
-
11
votes8
answers2292
viewsWhy create an object using the superclass?
Given the following code: public class Musico { public void tocaInstrumento() { // faz algo } } . public class Baterista extends Musico { public void giraBaqueta() { // faz algo } } . public class…
-
11
votes2
answers1149
viewsWhat are the metaclasses?
Some modern programming languages such as Ruby implement the so-called "Metaclasses". What is this? What good is? How and when to use?
-
11
votes2
answers4415
viewsWhat is "granularity level" and how to identify it?
In the book Design Standards - Reusable object-oriented software solutions by Erich Gamma, in the first chapter introduction we have the following text: "Designing object-oriented software is…
-
11
votes2
answers4523
viewsInner Class in Java, when to use?
Sometimes I find class codes with Inner class, such as: class ClasseExterna { private int a = 10; // ... class InnerClass { public void accessOuter() { System.out.println("Outra classe " + a); } //…
-
11
votes3
answers5893
viewsWhat is operator overload?
In some programming languages such as C++ it is possible to overload operators. What is and what serves?
-
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
votes1
answer1648
viewsDifference between method and constructor?
Reading a friend’s notes I came across the following statement: "method does not allocate space in memory". This statement is correct? It may not be the main difference between them, but it is…
-
11
votes1
answer1160
viewsWhat’s the difference between Vent and Delegate?
I see how it works delegate and event, but I saw no use of event. For example: public delegate void ChangedEventHandler(object sender, BaseEventArgs e); public ChangedEventHandler Changed; The code…
-
11
votes1
answer5003
viewsIs it correct to create a constructor method in an abstract class?
If an abstract class cannot be instantiated, can creating a constructor method for this abstract class be regarded as good practice or not? If so, why are we creating the implementation of this…
-
11
votes1
answer1208
viewsWhy String objects are immutable?
Up to the latest stable version, Java 8, type objects String are immutable. That is, any change in a String causes the creation of a new object String. This is not harmful from a performance point…
-
11
votes1
answer780
viewsWhat is Feature Envy?
What is Feature Envy? Why is it considered a bad smell of code (code Smell)? What are the advantages of avoiding it? She must always be avoided?
-
11
votes2
answers4107
viewsConcept of class, entity and objects
I’m reading about classes in C#, and an excerpt left me a little confused. I know that classes are objects in C#, and can be used in various ways. My doubt is in the following sentence: "A class can…
-
11
votes3
answers663
viewsClass generic property
I have a class with two properties (Name and Value). The estate Name is a string, already the property Value I want to leave the variable type. public class Field<TValue> { public string Name…
-
11
votes3
answers731
viewsWhat is the advantage of using getters/setters in Javascript classes?
For example in this code below I use methods getters and setters in class: class Pessoa { constructor(nome) { this.nomePessoa = nome; } get _nomes() { return this.nomePessoa; } set _nomes(valor) {…
-
10
votes2
answers6412
viewsWhat is the C++ copy builder for? How do I implement it?
I am a programmer Java and I am currently studying C++. In addition to the "normal" constructors (the standard constructor and the parameterized), C++ has a copy builder. I would like to know what…
-
10
votes2
answers163
viewsWhat is differential inheritance?
I was reading this article in the English OS and came across the term Differential inheritance. Which, exactly, is differential inheritance? It is possible to have a minimum example, preferably in…
-
10
votes2
answers1623
viewsWhat is the real concept and usefulness of POCO classes?
I am studying and developing a new project and the little studying on Windows Phone 7.1, I saw that they suggest/ indicate the use of classes POCO, for database mapping (It seems to me that Windows…
-
10
votes2
answers5743
viewsLevel of detailing use cases
I’m starting to use use use cases to document object-oriented system requirements and I’m having a little doubt about the level of detail of a use case. Basically, I have doubts about "which should…
-
10
votes2
answers11707
viewsHow, when and where to use PHP’s magic methods? Get and Set? What’s the difference? Should I use them in every class I create?
I’m starting in POO and would like to know when, where and how I should use the magical methods GET and SET and if possible cite their differences in practice. Should I use them in all the classes I…
-
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…
java oop software-engineering interface abstract-classesasked 10 years, 1 month ago Franchesco 5,144 -
10
votes4
answers1233
viewsWhat is the difference between OO and DDD?
I read about Domain Driven Design, it seems to use the concepts of object orientation but is based more on business rules. Is there nothing else that actually differentiates OO from DDD? If it is…
-
10
votes2
answers1467
viewsMethod to execute when destroying class instance
There is some way to execute a method automatically by destroying a class instance. I have a generic SQL class, where in the constructor I call a method that opens the connection. Only I want to…
-
10
votes2
answers8126
viewsWhat is the service layer in DDD?
Reading about Ddds I’ve heard about the service layer and I’m having a little doubt about that because from what I read a service can count business logic. Basically the definition I saw is this:…
-
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
votes1
answer3650
viewsWhat is the difference between virtual and Abstract methods?
In which cases should I prefer to use one type instead of the other?
-
10
votes3
answers956
viewsWhat is Container in POO?
What does Container mean in object-oriented programming? In which scenario its use is best represented?
-
10
votes2
answers1084
viewsHow to use Traits in PHP?
I’m creating namespaces for my traits and using them directly, without using them within a specific class, example: NOTE: The code below is just an example. namespace Decrypt; trait Rc4 { public…
-
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…
-
10
votes3
answers271
viewsHow to avoid the use of setters in such cases?
In object orientation it is recommended to avoid the use of setters. The usual justification for this is that the logic that modifies the state of an object must be encapsulated in the object.…
-
10
votes1
answer1490
viewsPolymorphism or inheritance?
I’m learning about polymorphism and I’ve been wondering if what I’m doing is actually polymorphism or just inheritance? If it’s polymorphism what’s in my code that I can clearly identify is…
c# oop software-engineering inheritance polymorphismasked 8 years, 2 months ago Mauricio Ferraz 2,074 -
10
votes1
answer382
viewsShould we use all variables as private?
We should always use the attributes of a class as private? What private variables help prevent? How do you decide whether a particular property should be private or not? CASE, by default, each…
php oop variables software-engineering encoding-styleasked 7 years, 6 months ago UzumakiArtanis 9,534 -
10
votes2
answers1800
viewsWhat is the relationship between encapsulation and polymorphism?
A few days ago, I was talking to a friend about Java, and asked what part of the story they were studying. Then he replied that they were starting inheritance studies. As they were too late, I asked…