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)

11
votes
5answers
3k views

Benefits of classic OOP over Go-like language

I've been thinking a lot about language design and what elements would be necessary for an "ideal" programming language, and studying Google's Go has led me to question a lot of otherwise common ...
-1
votes
1answer
1k views

What is the difference between class level attributes, Class constants and singleton methods?

What the difference given they all exist 'once per class'. When should I use one over another, i.e. for what purpose? I use Ruby.
0
votes
1answer
920 views

How to access functions in extended classes efficiently?

In PHP I have classes as below class Animal { //some vars public function printname(){ echo $this->name; } } class AnimalMySql extends Animal { static public function ...
2
votes
4answers
220 views

How to store multiple requirements with OR and AND?

Well I'm working on a personal project that needs to check if a user has met certain requirements, and they come in a form of Requirement: [c1 OR c2] AND [d1 OR d2] Requirement: [c1 AND c2] OR [d1 ...
0
votes
3answers
809 views

Passing class names or objects?

I have a switch statement switch ( $id ) { case 'abc': return 'Animal'; case 'xyz': return 'Human'; //many more } I am returning ...
5
votes
2answers
895 views

Taking Object Oriented development to the next level [closed]

Can you mention some advanced OO topics or concepts that one should be aware of? I have been a developer for 2 years now and currently aiming for a certain company that requires a web developer with ...
11
votes
4answers
2k views

Is it bad practice to use an interface for categorization only?

For example: Say I have classes A, B, C. I have two interfaces, lets call them IAnimal and IDog. IDog inherits from IAnimal. A and B are IDogs, while C is not, but it is an IAnimal. The important ...
4
votes
4answers
319 views

what is the term for the class in the bottom of a class hierarchy?

You have a class hierarchy: D extends C which extends B which extends A, for example. A would be the top class, but how about D? I am looking for a short and concise way of describing the position ...
4
votes
2answers
408 views

Is this a pattern? Proxy/delegation of interface to existing concrete implementation

I occasionally write code like this when I want to replace small parts of an existing implementation: public interface IFoo { void Bar(); } public class Foo : IFoo { public void Bar() { ...
2
votes
5answers
1k views

When is an object oriented program truly object oriented?

Let me try to explain what I mean: Say, I present a list of objects and I need to get back a selected object by a user. The following are the classes I can think of right now: ListViewer Item App [...
5
votes
3answers
5k views

What is the order of diagram drawing in a design?

I'm new with OOP and UML and I have some confusion here. I'd like to know where to start, I mean, somebody comes to you and ask you to do something (involves software design of course), once you have ...
1
vote
2answers
2k views

Sharing object between 2 classes

edit: I am thinking that dependency injection is the best approach. I am struggling to wrap my head around being able to share an object between two classes. I want to be able to create only one ...
5
votes
2answers
921 views

Object oriented design importance

I started studying Object Oriented Design and Modelling using the this book by James Rumbaugh. It uses a tool called Object Modeling Technique (OMT). I have certain newbie questions. I searched the ...
1
vote
1answer
342 views

Object Oriented programming on 8-bit MCU Case Study

I see that there's a lot of questions related to OO Programming here. I'm actually trying to find a specific resource related to embedded OO approaches for an 8 bit MCU. Several years back (maybe 6) ...
3
votes
3answers
7k views

Can I use a child class variables in its parent class?

I am programming in Objective C, iOS. I create a Class A which is a parent class, and Class B inherits to Class A. Now I have Class B variables which I also need to use in Class A. And also one ...
5
votes
4answers
867 views

Is there any functional difference between immutable value types and immutable reference types?

Value types are types which do not have an identity. When one variable is modified, other instances are not. Using Javascript syntax as an example, here is how a value type works. var foo = { a: 42 }...
10
votes
1answer
2k 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 ...
241
votes
24answers
104k 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 ...
1
vote
2answers
2k views

Ongoing confusion about ivars and properties in objective C

After almost 8 months being in ios programming, I am again confused about the right approach. Maybe it is not the language but some OOP principle I am confused about. I don't know.. I was trying C# a ...
4
votes
3answers
1k views

When too much encapsulation was reached

Recently, I read a lot of good articles about how to do good encapsulation. And when I say "good encapsulation", I am not talking about hiding private fields with public properties; I am talking about ...
5
votes
3answers
6k views

Can a class be inside another class?

Here's an excerpt from "The C++ Programming Language" template<classT> class List { // optimal public: class Link { /* ... */ }; List (); // initially empty void put(T *); // put before current ...
3
votes
5answers
2k views

I feel unprepared to start my first job out of college… how can I improve? [closed]

I just graduated from university with a degree in Computer Science/Engineering and was fortunate enough to land a job working in the pharmaceutical industry as a developer. My title is System ...
1
vote
3answers
598 views

Objects in non-OOP languages

Can we use the word "object" for data / functions in e.g. C (or Pascal) which doesn't really have objects? In C, what is an object? A data structure? A named memory area? I spoke to my collegue about "...
-1
votes
2answers
3k views

Is it best practice to always capitalize class file names in PHP, and other languages? [closed]

I ask because I've seen a couple of OO PHP tutorials which do not adhere to this, but to me it just makes sense. It makes it easy to instantly see if a file is a class or not, if non-class files all ...
2
votes
3answers
327 views

What are the drawbacks when designing a class?

When I read the book Effective Java chapter 4, I met some sentences but I can't think them out : What is the implementation when designing a class , why subclass will rely on the implementation ...
0
votes
2answers
79 views

Slow if use object cross referecing

In OOP, it seems that if an object cross-references another object in its property, ultimately, if such objects are used a lot, the software at the end will be slow because of this. Is this true? If ...
10
votes
5answers
3k views

Is unit testing procedural code effective?

On a current project, the powers that be want to have unit testing incorporated into our development cycle to avoid the constant amount of bugs that seem to seep into our code. The problem is that the ...
177
votes
13answers
51k 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 ...
6
votes
6answers
2k views

How is encapsulation used for safety?

I am learning OOP. I have studied much about encapsulation but the more I read the more I became confused. I understand we hide (by making private) data and expose it to user of class (other ...
25
votes
5answers
22k views

How can I apply OOP concepts to building a simple, but real-world, web app? [closed]

I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog ...
7
votes
7answers
1k views

Should a class without instance variables be considered a class?

Say you need to implement a few closely related functions that provide a piece of functionality, but there is no need to track any state between those functions, they just sometimes pass some ...
0
votes
1answer
322 views

iOS object instance accessible from three separate classes, or load 3 nib files with one class?

I've got three nib files in my project, each of which is driven by its own class (.h and .m files). Each nib has a stylized design with a full screen background image and a few overlay images acting ...
7
votes
3answers
5k views

websites that show real world scenarios for OOP beginners so that they can implement them [closed]

Since programmers learn more by implementing the real world scenarios rather then by gaining theoretical knowledge and concepts about programming, I wanted to know that is there any website that tells ...
3
votes
1answer
172 views

Data/Object Design Problem

Goal: I'm trying to figure out the best way to model/design and then implement a "user" feature in a system. Background: I am designing an on-line access request system, so our company can use a ...
4
votes
2answers
233 views

Should these concerns be separated into separate objects?

I have objects which implement the interface BroadcastInterface, which represents a message that is to be broadcast to all users of a particular group. It has a setter and getter method for the ...
9
votes
5answers
959 views

OOP :What are some of the situations in which class based design is better than interface based one?

I was reading JDOM's website. Why is the JDOM API defined in terms of concrete classes rather than interfaces? Jason Hunter summarizes the arguments against an interface-based API for JDOM: ...
13
votes
7answers
11k views

What are the roles of singletons, abstract classes and interfaces?

I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it. Let's use this class for the example: class Person{ ...
5
votes
3answers
534 views

Filesystem like permissions for C++ type-members

Abstract (tl;dr) Please read the full question, this is awfully simplified: How can unix file permission style restrictions be applied to inter-type data/control flows, allowing fine-grained access ...
0
votes
4answers
487 views

Is it fair to reduce OOP to mere hierarchical composition of data structures?

Meaning that OOP allows me to have data-trees, of arbitrary depth and breadth, with some leafs being functions (and those leafs would be called methods) ? Because everything else that people often ...
5
votes
3answers
781 views

Does the use of Comparator interface breaks encapsulation in Java?

According to the essay "The Object Calisthenics" by Jeff Bay in the book ThoughtWorks Anthology, Use of Getters and Setters should be avoided as they break encapsulation and we should instead ask the ...
3
votes
1answer
262 views

Can methods in an OOP language be considered as some kind of closure?

Consider a method m of a class A in an object-oriented language like Java or C++. In the body of the method m it is possible to reference the member variables of the object on which the method is ...
8
votes
4answers
1k views

Design pattern for handling a response

Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication ...
5
votes
1answer
758 views

Separation of concerns in an RMR framework

I'm working on a new framework for PHP that utilises an architectural pattern called RMR, instead of the more common (pseudo)-MVC that most PHP frameworks currently implement. So far it feels like a ...
0
votes
1answer
605 views

Method size in an OOP language, for instance - in Java [duplicate]

Possible Duplicate: What should be the maximum length of function In Java (and I think in other OOP languages too) it is recommended to keep class methods as short as possible. While I ...
0
votes
4answers
3k views

Is there really Object-relational impedance mismatch?

It is always stated that it is hard to store applications objects in relational databases - the object-relational impedance mismatch - and that is why Document databases are better. However, is there ...
24
votes
5answers
4k views

How to make the transition to functional programming?

Lately, I have been very intrigued with F# which I have been working a bit with. Coming mostly from Java and C#, I like how concise and easily understandable it is. However, I believe that my ...
6
votes
2answers
261 views

Adapter Pattern to expose different aspects of an object — Is this a correct use?

Quite frequently, I use an Adapter-like design to expose different aspects of data objects. For example, in a 3D modelling application I use an object hierarchy to represent the 3d models in the ...
22
votes
10answers
30k views

Why use an interface when the class can directly implement the functions? [duplicate]

Possible Duplicate: Why are interfaces useful? Like most faculty, my java faculty introduced interface without explaining or even mentioning its practical use. Now I imagine interfaces have a ...
9
votes
5answers
1k views

When to stop inheritance?

Once upon time ago I asked a question on Stack Overflow about inheritance. I have said I design chess engine in OOP fashion. So I inherit all my pieces from Piece abstract class but inheritance still ...
0
votes
1answer
342 views

How Should a model and controller be distributed between subviews of the View?

In many User Interface libraries, we have concept of views and subviews. so according to MVC pattern every view should update the model as soon as it changes. For that view should have a reference ...