A methodology that enables a system to be modeled as a set of objects that can be controlled and manipulated in a modular manner
122
votes
22answers
1k views
How do you educate your teammates without seeming condescending or superior?
I work with three other guys; I'll call them Adam, Brian, and Chris.
Adam and Brian are bright guys. Give them a problem; they will figure out a way to solve it. When it comes to OOP, though, they ...
79
votes
10answers
6k views
Should we avoid object creation in Java?
I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible.
This seems somewhat to defeat ...
75
votes
18answers
11k views
If immutable objects are good, why do people keep creating mutable objects?
If immutable objects¹ are good, simple and offer benefits in concurrent programming why do programmers keep creating mutable objects²?
I have four years of experience in Java programming and as I see ...
60
votes
12answers
3k views
Name for this antipattern? Fields as local variables
In some code I'm reviewing, I'm seeing stuff that's the moral equivalent of the following:
public class Foo
{
private Bar bar;
public MethodA()
{
bar = new Bar();
...
58
votes
19answers
9k views
Do I really need oop for my kind of job? After 10 years I think I don't
After 10 years of writing something like business logic for my company I realized that for 95% of my code I just don't need any special OO techniques. For years I tried to get better with all that OO ...
58
votes
20answers
4k views
Is OOP hard because it is not natural?
One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of ...
55
votes
21answers
6k views
Why is OOP difficult?
When I started using an object-oriented language (Java), I pretty much just went "Cool" and started coding. I've never really thought about it until only recently after having read lots of questions ...
53
votes
12answers
4k views
Why is C not considered an 'object-oriented' language?
It seems that C has its own quasi-objects such as 'structs' that can be considered as objects (in the high-level way that we would normally think).
And also, C files themselves are basically separate ...
51
votes
14answers
10k views
Where does this concept of “favor composition over inheritance” come from?
In the last few months, the mantra "favor composition over inheritance" seems to have sprung up out of nowhere and become almost some sort of meme within the programming community. And every time I ...
51
votes
4answers
4k views
Functional Programming vs. OOP
I've heard a lot of talk about using functional languages such as Haskell as of late. What are some of the big differences, pros and cons of functional programming vs. object-oriented programming?
45
votes
12answers
3k views
New to TDD. Should I avoid private methods now?
I'm just now learning TDD. It's my understanding that private methods are untestable and shouldn't be worried about because the public API will provide enough information for verifying an object's ...
43
votes
14answers
6k views
What makes C so popular in the age of OOP?
I code a lot in both C and C++, but did not expect C to be the second most popular language, slightly behind Java.
TIOBE Programming Community Index
I'm curious as to why, in this age of OOP, C is ...
42
votes
15answers
7k views
Is it better to return NULL or empty values from functions/methods where the return value is not present?
I am looking for a recommendation here. I am struggling with whether it is better to return NULL or an empty value from a method when the return value is not present or cannot be determined.
Take ...
42
votes
14answers
5k views
When are Getters and Setters Justified
Getters and setters are often criticized as being not proper OO. On the other hand most OO code I've seen has extensive getters and setters.
When are getters and setters justified? Do you try to ...
41
votes
17answers
3k views
Is OO-programming really as important as hiring companies place it?
I am just finishing my masters degree (in computing) and applying for jobs.. I've noticed many companies specifically ask for an understanding of object orientation. Popular interview questions are ...