A methodology that enables a system to be modeled as a set of objects that can be controlled and manipulated in a modular manner

learn more… | top users | synonyms (3)

16
votes
11answers
2k views

What made object oriented programming successful? [closed]

What is that feature according to you that has made object oriented programming so much successful ? Message Passing Inheritance Polymorphism Encapsulation Or some other feature that you may like ...
35
votes
9answers
11k views

Can't I just use all static methods?

What's the difference between the two UpdateSubject methods below? I felt using static methods is better if you just want to operate on the entities. In which situations should I go with non-static ...
18
votes
5answers
4k views

Is objected oriented programming paradigm outdated since it is anti-modular and anti-parallel? [closed]

I have read the controversial article Teaching FP to freshmen posted by Robert Harper who is a professor in CMU. He claimed that CMU would no longer teach object oriented programming in the ...
30
votes
17answers
8k views

How can I feel more confident about my programming skills? [closed]

Programming isn't alien to me. I first starting doing markup (HTML, now please don't laugh at me) when I was 12 and a little bit of BASIC when I was 13 (I knew much about Flowcharts, Pseudocodes at ...
16
votes
11answers
3k views

is OOP the dominant programming model in real world?

Objects Never? Well, Hardly Ever In the VIEWPOINT section of Communications of The ACM, I found an interesting article entitled "Objects Never? Well, Hardly Ever". It’s a radically different ...
14
votes
4answers
2k views

How does the Law of Demeter apply to object-oriented systems regarding coupling and cohesion? [closed]

How does the Law of Demeter applied to object-oriented systems with coupling and cohesion? I was reading a book "Software development and professional practice" and came across the chapter about LoD, ...
14
votes
1answer
3k views

What did they call Object-Oriented Programming before Alan Kay invented the term?

Alan Kay claims that "I made up the term "object-oriented", and I can tell you I did not have C++ in mind." What he had in mind, of course, was Smalltalk. But he did not make up object-oriented ...
26
votes
8answers
5k views

Why have private static methods?

I just wanted to clear up a question I have. What is the point of having a private static method as opposed to a normal method with private visibility? I would have thought an advantage to having a ...
8
votes
6answers
927 views

What are the practical ways to implement the SRP?

Simply what are the practical techniques people use to check if a class violates the single responsibility principle? I know that a class should have only one reason to change, but that sentence is ...
9
votes
4answers
1k views

How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages?

There is a fairly helpful question already along these lines ("Non-OOP Design Patterns?"), but I am more curious about a transitional point of view for someone just getting started with dynamic and ...
21
votes
11answers
1k views

Is information hiding more than a convention?

In Java, C# and many other strongly-typed, statically checked languages, we are used to write code like this: public void m1() { ... } protected void m2() { ... } private void m2() { ... } void m2() ...
13
votes
3answers
980 views

Pure virtual or abstract, what's in a name?

While discussing a question about virtual functions on Stack Overflow, I wondered whether there was any official naming for pure (abstract) and non-pure virtual functions. I always relied on ...
8
votes
7answers
3k views

Structured programming versus OO programming

I am making a presentation that shows the differences between structural and object oriented programming and I want to illustrate why people need OOP with an example where applying OOP concepts will ...
4
votes
6answers
1k views

OOP principles and method names

class Boxer: def punch(self, punching_bag, strength): punching_bag.punch(strength) class PunchingBag: def punch(self, strength): print "Punching bag punched with strength", ...
19
votes
11answers
2k views

Is pure oop necessary [closed]

Please don't direct me to this post: http://stackoverflow.com/questions/1551/how-to-think-in-oo. I have read it and still have no answer. I have programmed c++ for years and was taught that ...
16
votes
7answers
1k views

To rewrite or slowly refactor old C++ project [duplicate]

Our team has recently inherited a relatively large project from another company (~250k lines). It was developed using C++Builder and we intend to port the Ui side to Qt. Most of the Ui code is ...
10
votes
3answers
771 views

Dependency Inversion Principle: How to define “high-level policy” and “low-level detail” to other people?

I am trying to explain the dependency inversion principle to my (mostly junior) colleagues. How can we define which one is the "high-level policy" and which one is the "low-level detail" in a ...
4
votes
2answers
930 views

How does MVC work with the principle “Tell, Don't ask”?

Procedural code gets information then makes decisions. Object-oriented code tells objects to do things. — Alec Sharp So, when a view wants to display some information that is suppose to be ...
4
votes
6answers
3k views

What are abstract classes and abstract methods?

I got several explanations but so far I'm not able to understand that what are the abstract classes and methods in Java. Some said it has to do something with the security of the program, other said ...
4
votes
4answers
1k views

Why are public and private accessors considered good practice? [duplicate]

Possible Duplicate: When are Getters and Setters Justified Why exactly is having public and private accessors like these: private string foo; public string Foo { get { ...
4
votes
6answers
7k views

When is C a better choice than C++? [closed]

I can't imagine that there's any reason not to use the OOP features of C++. It's is just as fast as C, and - what's more important to me - it's transparent, just as C. (I mean "transparent" that I ...
2
votes
3answers
2k views

OO PHP static keyword, should I use it?

I'm writing script for fb and I have 3 objects that I'll be using through all classes. I'm wondering if there is any advantage in using the static keyword except I don't have to create an instance ...
1
vote
2answers
334 views

What are the problems which I will face if all the classes I use are loosely coupled

Loosely coupled classes gives flexibility. If I understand it right, Event flow, Observer Pattern and Design Patterns like MVC focus on loose coupling. So in this context I am aiming towards making a ...
19
votes
3answers
13k views

Which is a better practice - helper methods as instance or static?

This question is subjective but I was just curious how most programmers approach this. The sample below is in pseudo-C# but this should apply to Java, C++, and other OOP languages as well. Anyway, ...
12
votes
8answers
1k views

Mental Models or Real-World-Metaphors for Functional Programming

Does anyone have a good mental model or metaphor for functional programming which references something in the real world? Object Oriented programing intuitively makes sense to me. There are things ...
10
votes
12answers
2k views

How can I explain object-oriented programming to someone who's only coded in Fortran 77?

My mother did her college thesis in Fortran, and now (over a decade later) needs to learn c++ for fluids simulations. She is able to understand all of the procedural programming, but no matter how ...
8
votes
10answers
889 views

What should be first - functionality or design? [duplicate]

I've started reading a book from Head First series about OOP and Design. In a first chapter it is stated I have to worry about design of my application just after basic functionality is ready. Basic ...
5
votes
4answers
2k views

using static methods and classes

I know that static methods/variables are associated with the class and not the objects of the class and are useful in situations when we need to keep count of, say the number of objects of the class ...
3
votes
4answers
2k views

PHP, structural or OOP based language? [closed]

I would like to discuss why is PHP called a structural language? what are the OO concepts that cannot be implemented using PHP?
1
vote
3answers
3k views

How to apply good Object Oriented Design principles in Embedded Systems [closed]

I am a firmware engineer moved from Electrical background to Embedded Systems. I was till now programming in C and never bothered to apply OO principles in my design. Recently I was forced to ...
12
votes
6answers
3k views

How to practice object oriented programming? [closed]

I've always programmed in procedural languages and currently I'm moving towards object orientation. The main problem I've faced is that I can't see a way to practice object orientation in an effective ...
9
votes
5answers
946 views

Advantages to Multiple Methods over Switch

I received a code review from a senior developer today asking "By the way, what is your objection to dispatching functions by way of a switch statement?" I have read in many places about how pumping ...
7
votes
5answers
1k views

Abstract DAL - Use Interface with Internal Class?

We have a business logic layer (BLL) that is tightly coupled to our data access layer (DAL). We make calls like this: using (FooData data = new FooData()) { data.DoSomething(); } It's important ...
6
votes
8answers
3k views

C++ to friend or not to friend

I have an object oriented programming with c++ course this semester at college and we were learning about friend functions. I instinctively dislike them for their ability to bypass the security that ...
3
votes
3answers
182 views

Which one subsumes the other: class-based object-orientation or prototypal inheritance?

In this talk: http://www.youtube.com/watch?v=hQVTIJBZook, Douglas Crockford claims that class-based object-orientation can be represented in terms of prototypal inheritance. The construction he gives ...
2
votes
3answers
258 views

OOP: Behavior + Data, but what about 'validation' behaviors?

EDIT: Thanks for all the great answers! In reading these responses I realized that I'm approaching this from the wrong angle so I wrote a new question here. I had this discussion with my superior ...
2
votes
2answers
2k views

Object oriented immutability: final classes or final methods

One of the things you see in numerous places in the standard java library is final classes. It is claimed that this is for immutability which I understand...to an extent. Suppose you have a class: ...
2
votes
1answer
489 views

Liskov substitution and abstract classes / strategy pattern

I'm trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much! P.S. ...
2
votes
2answers
354 views

Designing a library that is easy to use: composition or inheritance

I have designed a small library for work that consists of a few exposed classes. These can basically be thought of as a server class and client class. But now that I am writing all the test cases and ...
1
vote
3answers
288 views

When to use a Singleton and when to use a static class [duplicate]

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to ...
0
votes
3answers
266 views

Force Derived Class to Implement Static Method C#

So the situation is like, I have few classes, all of which have a standard CRUD methods but static. I want to create a base class which will be inherited so that it can force to implement this CRUD ...
0
votes
3answers
157 views

How to divide OO project into packages?

I'm a hobbyist programmer working on my own projects. I use Java. Until recently my average project was only 1000 LoC. My latest project however is bigger and is starting to exceed 1500 LoC. I ...
147
votes
24answers
44k 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 ...
68
votes
1answer
13k views

Should package names be singular or plural?

Often, in libraries especially, packages contains classes that are organized around a single concept. Examples: xml, sql, user, config, db. I think we all feel pretty naturally that these packages ...
71
votes
8answers
52k views

Aggregation vs Composition

I understand what composition is in OOP, but I am not able to get a clear idea of what Aggregation is. Can someone explain?
29
votes
3answers
5k views

Rich Domain Models — how, exactly, does behavior fit in?

In the debate of Rich vs. Anemic domain models, the internet is full of philosophical advice but short on authoritative examples. The objective of this question is to find definitive guidelines and ...
35
votes
14answers
12k views

Isn't MVC anti OOP?

The main idea behind OOP is to unify data and behavior in a single entity - the object. In procedural programming there is data and separately algorithms modifying the data. In the ...
26
votes
6answers
4k views

LSP vs OCP / Liskov Substitution VS Open Close

I am trying to understand the SOLID principles of OOP and I've come to the conclusion that LSP and OCP have some similarities (if not to say more). the open/closed principle states "software ...
81
votes
18answers
8k views

Is it poor programming practice to pass parameters as Objects? [duplicate]

So, we've got a guy who likes to write methods that take Objects as parameters, so they can be 'very flexible.' Then, internally, he either does direct casting, reflection or method overloading to ...
61
votes
22answers
12k 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 ...