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)

1
vote
1answer
345 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
876 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
3k 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 ...
247
votes
24answers
108k 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 ...
11
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 ...
181
votes
13answers
52k 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
2k 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
324 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
173 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
234 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
967 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
544 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
489 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
785 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
263 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
763 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
607 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 ...
24
votes
10answers
31k 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
344 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 ...
6
votes
4answers
4k views

When or why should one use getters/setters for class properties instead of simply making them public properties?

I program primarily in ColdFusion but this is a general OOP question. Is there any benefit to using: getProp() { return prop; } setProp(val) { prop = val; } As opposed to simply obj = ...
0
votes
3answers
408 views

Any enlightenment for understanding Object Oriented Programming? [closed]

I studied computer science near the end of 1980s, and wasn't taught OOP that formally. With Pascal or C, when I understand the top-down design of functions, and the idea of black box, then everything ...
139
votes
13answers
92k views

Why do we need private variables?

Why do we need private variables in classes? Every book on programming I've read says this is a private variable, this is how you define it but stops there. The wording of these explanations always ...
4
votes
2answers
2k views

OOP - Composition, Components and Composites Example?

I've been reading a bit about OOP in relation to Composition, Components and Composites. I believe I understand the fundamental principle (not sure). Can someone please provide a code example of a ...
7
votes
2answers
23k views

Recommended reading for (Object Oriented) application design architecture? [duplicate]

Possible Duplicate: Best books on the theory and practice of software architecture? In life it doesnt matter if you do one thing for 15 years. You will end up waking one day and asking stuff ...
9
votes
2answers
7k views

best practice for initializing class members in php

I have lots of code like this in my constructors:- function __construct($params) { $this->property = isset($params['property']) ? $params['property'] : default_val; } Is it better to do ...
8
votes
2answers
3k views

Which open source PHP project has the 'perfect' OOP design I can learn from? [closed]

I am a newbie to OOP, and I learn best by example. You could say this question is similar to Which Scala open source projects should I study to learn best coding practices - but in PHP. I have heard-...
11
votes
5answers
1k views

Why is my class worse than the hierarchy of classes in the book (beginner OOP)?

I am reading PHP Objects, Patterns, and Practice. The author is trying to model a lesson in a college. The goal is to output the lesson type (lecture or seminar), and the charges for the lesson ...
3
votes
4answers
362 views

As a tooling/automation developer, can I be making better use of OOP?

My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, VMWare,...
2
votes
3answers
260 views

Turning your code inside out (functional style) compared to a OO paradigm

I have find this article Turning Your Code Inside Out and I want to know how this approach described in article is for OO programmers/languages. Is this style of design used in OO programmers/...
5
votes
4answers
375 views

How to decide whether to implement an operation as Entity operation vs Service operation in Domain Driven Design?

I am reading Evans's Domain Driven Design. The book says that there are entity and there are services. If I were to implement an operation, how to decide whether I should add it as a method on an ...
20
votes
1answer
5k 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 ...
16
votes
8answers
29k views

Web Developer interview questions [closed]

I read an article today that listed some basic questions about web development: Describe how POST data was submitted to a server by a browser. Explain a number of HTTP status codes (except maybe 404 ...