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 (2)

1
vote
3answers
478 views

Best Practices Returning Read-Only Object

I have "best practices" question about OOP in C# (but it sort-of applies to all languages). Consider having library class with object that is to be exposed to public, say via property accessor, but ...
7
votes
1answer
614 views

Using visitor pattern with large object hierarchy

Context I've been using with a hierarchy of objects (an expression tree) a "pseudo" visitor pattern (pseudo, as in it does not use double dispatch) : public interface MyInterface { void ...
1
vote
3answers
210 views

Hacking Python “Requests” library.. How to start as an intermediate pythonista?

My question is conceptual, yet extremely vital for me. I'm an intermediate Python developer. I know fair enough about it, and actually use it on a daily basis. Now, I would like to transform my ...
1
vote
1answer
115 views

Class inheritance and extra parameters

Im trying to create an SMS gateway .. I have a request coming in from a client (web form or API or database record) that I need to process and forward on to a 3rd Party API - or SMS provider. So that ...
3
votes
2answers
131 views

Automated object creation from user input

I am working on a command-line application that runs simulations. It has to be heavily configurable; the user should be able to provide a very large number (100+) of parameters, some mandatory and ...
3
votes
2answers
185 views

Can I apply SOLID concepts to entire solution designs rather than just the internal components?

So maybe the quick answer is 'Yes' absolutely (or no I suppose), but let me explain my question angle to get a better derived answer. We all commonly use SOLID design principals when making up the ...
7
votes
3answers
834 views

Javascript simple code to understand prototype-based OOP basics

I know Javascript for some time, although I am not a heavy user, I know it the first from the time when Netscape was my browser. I pretty much understand the main things, but since JavaScript approach ...
8
votes
7answers
892 views

Difference between Pattern and Principle

What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can ...
0
votes
3answers
530 views

Is function overloading in general considered Evil? [closed]

Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of ...
1
vote
2answers
173 views

How to program object-oriented with a DI framework? [duplicate]

Possible Duplicate: Does “Inversion of Control” promote “Anemic Domain Model”? My impression is that projects using a DI framework like Spring or Guice tend to lose their object orientation ...
12
votes
6answers
381 views

OO Design, how to model Tonal Harmony?

I have started to write a program in C++ 11 that would analyse chords, scales, and harmony. The biggest problem I am having in my design phase, is that the note 'C' is a note, a type of chord (Cmaj, ...
0
votes
3answers
149 views

What will be the better way to access information from another object

I have a page Object, which has Paragraph and Image object Collections And each paragraph has only image_id(s) that are assigned to a paragraph. All other information about image is stored in ...
1
vote
1answer
152 views

How to avoid huge functions with made up of enums and if-else or switch case when dealing with server response in iOS?

in my application, I have a request type associated with variety of API calls I make to the REST server. when the response from server comes in the same delegate method for web engine's response, I ...
1
vote
1answer
297 views

Are silly examples bad way to learn OOP? [closed]

Some tutorials give silly examples to teach OOP, for example: Car class and myCar object, etc. Is that way considered bad in learning OOP assuming that these examples not applied to real programming ...
15
votes
9answers
1k views

Should the methods of a class call its own getters and setters?

Where I work I see lots of classes that do things like this: public class ClassThatCallsItsOwnGettersAndSetters { private String field; public String getField() { return field; ...
13
votes
3answers
523 views

Does the state Pattern violate Liskov Substitution Principle?

This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET This is the class diagram for the State Pattern where a SalesOrder can have different states during ...
1
vote
1answer
67 views

User selection and object creation

I'm writing a GUI application. The user selects item from a comboBox (non editable). The suitable input data control is then enabled and user enters data. Then the appropriate object according to the ...
7
votes
10answers
11k views

How to explain OOP concepts to a non technical person?

I often try to avoid telling people I'm a programmer because most of the time I end up explaining to them what that really means. When I tell them I'm programming in Java they often ask general ...
1
vote
4answers
271 views

How to implement classes that should be loaded once?

I'm building a little framework, currently it is just for fun. I'm wondering how should I implement classes that should be instantiated by the framework and be passed to the controller to use? For ...
13
votes
4answers
966 views

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

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, ...
-4
votes
4answers
444 views

Objects in javascript vs objects in java/php/c++

I code in PHP and JavaScript. Why do the two languages use a different syntax for creating objects, classes, functions, even if they are both OO? For example, in PHP, we use the new keyword to create ...
6
votes
8answers
3k views

Is PHP a bad object oriented language? [closed]

I had a chance to have an interesting conversation with my co-workers. Most of them are flash action script or Java developers. We talked about how well php handles OOP. I said that PHP can handle ...
0
votes
1answer
134 views

Wrapping Primitives to Enable Returning null — Bad Practice?

I am frequently tempted to wrap integers, etc, solely for the purpose of writing methods that can return null. Negative 1 can work in many cases, but too often (especially in sound) it's a valid ...
3
votes
3answers
368 views

Are immutable/stateless singletons bad?

Lately there have been some kind of revolution against singletons, but is there something wrong with them if they are stateless? I know the overuse talk and all... this applies to everything not just ...
6
votes
2answers
472 views

Best Practice to Avoid “Playing Telephone” with Constructor Arguments

I find that the encapsulation required by OO has me frequently passing paramenters down the line from parent to child to great grandchild to second grand nephew once removed (not actually that bad). ...
8
votes
3answers
381 views

Would it be better to have extra checks, or would it be a waste of time?

In your opinion, do you think it is a waste of time to make checks that you know there is no possible way of it being there/not being there, or would you just put it there just in case there is a bug ...
2
votes
2answers
142 views

Designing entities to be self-manageable

Although this is a gamedev project, the question is about general OOP practices, so I believe it goes here. Here's the problem: (note: I will call any equivalent of real-world physical objects ...
7
votes
4answers
871 views

Can an object oriented program be seen as a Finite State Machine?

This might be a philosophical/fundamental question, but I just want to clarify it. In my understanding a Finite State Machine is a way of modeling a system in which the system's output will not only ...
5
votes
3answers
169 views

How do I design a DAL when I have to deal with relationships?

Say I'm developing a bug tracker, where a ticket belongs to at most one milestone, and a milestone can have many tickets. When a milestone is deleted (from the database), all tickets associated with ...
14
votes
5answers
1k views

Why don't modern libraries use OOP

I'm a beginner-level C++ programmer, but I understand the concepts of the language fairly well. When I began to learn external C++ libraries, like SDL, OpenGL (maybe something else too), to my great ...
2
votes
1answer
417 views

C++ Design: Functional Programming vs OOP

Design Question Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some ...
1
vote
2answers
360 views

Have I understood OOP correctly?

I had originally posed this on StackOverflow. The question was closed and I was asked to post this here instead. Here is the original question I had posted there: I have been programming using ...
2
votes
6answers
732 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 ...
6
votes
10answers
422 views

Teaching Classes and Objects

I'm trying to teach how an object is just an instance of a class to a buddy of mine. However, he doesn't seem to understand it so well. I've heard a ton of the examples (blueprint to a house, etc.) ...
8
votes
3answers
168 views

OOP terminology in Ruby and C++

I am taking a C++ class in my school. Since I've programmed in Ruby I know some OOP stuff. But in C++ there are member functions, member variables, and static functions. In Ruby we have instance ...
3
votes
0answers
131 views

DDD and filtering

I am developing an app in ddd maner. So I have a complex domain model. Suppose I have a Fare object and Airline. Each Airline should contain several or much more Fares. My UI should represent Model ...
20
votes
6answers
1k views

Functional programming compared to OOP with classes

I have been interested in some of the concepts of functional programming lately. I have used OOP for some time now. I can see how I would build a fairly complex app in OOP. Each object would know how ...
1
vote
4answers
506 views

About shared (static) Members and its behavior

I just realized that I can access shared members from instances of classes (probably this is not correct, but compile and run), and also learn/discover that, I can modify shared members, then create a ...
2
votes
3answers
379 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 ...
18
votes
5answers
1k 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 ...
32
votes
9answers
2k views

Code Smell: Inheritance Abuse

It's been generally accepted in the OO community that one should "favor composition over inheritance". On the other hand, inheritance does provide both polymorphism and a straightforward, terse way of ...
15
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 ...
3
votes
2answers
479 views

Should the 12-String be in it's own class and why?

This question is regarding a homework project in my first Java programming class (online program). The assignment is to create a "stringed instrument" class using (among other things) an array of ...
1
vote
3answers
190 views

Inheritance from the objects themselves

Making new inheritance hierarchy with the help of C++ I think about: Why there is no inheritance from the class objects? Abstract example (on abstract C++): struct Foo { int v; Foo(int a) : v(a) ...
1
vote
1answer
135 views

Is there a good design pattern for this messaging class?

Is there a good design pattern for this? I want to create a messaging class. The class will be passed: the type of message (eg. signup, signup confirmation, password reminder etc) the client's id ...
1
vote
3answers
330 views

Setting up ASP.NET structure for code

I've always coded in C# MVC3 when developing web applications. But now i wanted to learn a bit more about developing web sites with just ASP.NET. But now i'm wondering what a good setup for my code ...
3
votes
2answers
580 views

Using PDO with MVC

I asked this question at stackoverflow and received no response (closed as duplicate with no answer). I'm experimenting with OOP and I have the following basic MVC layout: class Model { // do ...
0
votes
1answer
211 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
138 views

Design backward and forward button operations of a browser

If you were asked to design the backward and forward button operation (as a library) in a browser, how would you do it? What will be your APIs and parameters to them? what data structure will be best ...
0
votes
5answers
340 views

should singleton be life-time available or should it be destroyable?

Should the singleton be designed so that it can be created and destroyed at any time in program or should it be created so that it is available in life-time of program. Which one is best practice? ...

1 2 3 4 5 15