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)

12
votes
3answers
2k views

Why should we preferably use first class collections?

As per rule number 4 of Object Calisthenics by Jeff Bay (RTF) in The ThoughtWorks Anthology, it is recommended that one should "Use first-class collections". Rule 4: First class collections ...
3
votes
4answers
3k views

What are the most important OO skills to show off in the job hunt? [closed]

I am in the market for new employment, and found a position were they asked me to create a programming sample based off an assignment. I blew the sample trying to get it done quickly one night, and ...
4
votes
2answers
277 views

Help needed with class design and structure

This question is mostly about the best way to approach this problem. Any input is appreciated. The Problem In my application i need to send some data to a number of different destinations (we will ...
1
vote
4answers
3k 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 ...
47
votes
20answers
11k views

Does Object Oriented Programming Really Model The Real World? [closed]

I've seen it commonly repeated the object oriented programming is based on modelling the real world, but is it? It seems to me that is not true of anything outside of the business layer. My GUI ...
1
vote
1answer
421 views

Is Rule 9 of Object Calisthenics applicable in Objective C?

Rule 9 in Object Calisthenics by Jeff Bay (RTF) is: Rule 9: No getters/setters/properties The last sentence of the previous rule leads almost directly to this rule. If your objects are now ...
17
votes
8answers
2k views

A Class named Class?

This is more of a style question, but it is something I am currently pondering for a project of mine. Assume that you're creating an application which is modeling a school. So there are entities like ...
24
votes
5answers
8k views

should I throw exception from constructor?

I know I can throw exception from constructor in PHP but should I do it? For example, if a parameter's value is not as I expected it. Or should I defer throwing an exception till a method is invoked. ...
0
votes
2answers
618 views

Is this bad design for a Shape interface?

I'm creating a vector editing program in C++, and I need a Shape interface which other concrete classes will implement. There is a requirement that no implementation inheritance is allowed. The design ...
9
votes
7answers
2k views

Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?

Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private void VerifyAccount() { if (!ValidateCredentials(txtUser.Text, ...
4
votes
2answers
4k views

Is this a proper implementation of an iOS MVC pattern?

After browsing the apple docs, I came across this sample of their MVC pattern: Using NSNotificationCenter and without using KVO, would this diagram below represent a correct implementation of the ...
2
votes
1answer
3k views

Object orientated data structures in database driven applications

I've started working for a company that maintains a small/medium sized commercial website. The website is written in c# asp.net, and uses SQL Server as a database. The structure of the code is very ...
5
votes
2answers
4k views

Why multiple calls to same classes' Constructor from within a Constructor wouldn't work?

Please have a look at following snippet: public class Foo { int digit; String name; Foo (int d, String n) { this(d); // cannot do following. //compile-time error: Constructor call must ...
3
votes
2answers
922 views

Using Map in Java (or other strongly-typed languages) to work with unstructured data

After looking at the core data type for frameworks that deal with unstructured data in java: json java library: JsonObject Mongodb java api: BasicBSONObject SolrJ (Solr java client): SolrDocument ...
8
votes
6answers
917 views

Static functions vs classes

Let's say that I want to build some utility functions to do some basic maths with the BigDecimals, for example I want to have a function that computes the average of a List<BigDecimal>. What is ...
4
votes
1answer
697 views

Rewriting a Procedural PHP App - Should we use a framework?

We have an app that's currently only got about 120 users. The userbase will probably grow by 50% over the next 12 months - but we're going to have to separate storage etc. because we're looking at ...
19
votes
4answers
6k views

How should I add functionality to an object that already exists?

I have an interface that has a certain amount of well-defined functionality. Let's say: interface BakeryInterface { public function createCookies(); public function createIceCream(); } This ...
6
votes
3answers
6k views

When is method overloading appropriate?

Suppose I am working on an existing, reasonably large system. I have an object, myObject of class MyClass (for the example's sake, suppose I'm working in Java). myObject is a composition containing a ...
68
votes
12answers
11k 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 ...
5
votes
3answers
518 views

Is there a specific term for an accessor method that returns a boolean value?

I seem to recall that there is a specific term for an accessor method that returns a Boolean value but it escapes me. For example: typical methods such as: class Example { bool isDirty(); ...
4
votes
2answers
523 views

Program more professionally (planning, notation, …) [closed]

I program a data-analysis framework for my company (20000LOCs by now). There are 2 programmers who help writing individual module for interfaces I have predefined. So far I haven't used much planning ...
71
votes
14answers
29k views

What is the ideal length of a method for you? [closed]

In object-oriented programming, there is of course no exact rule on the maximum length of a method , but I still found these two quotes somewhat contradicting each other, so I would like to hear what ...
3
votes
5answers
720 views

Using XML field Vs. creating a table for unstable organization

I am in the middle of design an application to issue and store invoices for an organization. The problem is the organization is not stable at all. There are many types of invoices and they may ...
0
votes
3answers
173 views

Roadblock-confused about structure of program

I'm new to programming, and I'm working in C. I know that this is structured programming but if I use blocks, say for local variables: { int i; for(i=0; i<25; i++){ printf("testing...\n"); ...
10
votes
4answers
741 views

What's wrong in returning hashtable from public method and when does it make sense to do so?

What are the design problems in returning a hashtable from a public method when you want to return multiple items instead of creating a class and returning object of that? If it does have problems ...
10
votes
7answers
3k views

What are the features required for Object Orientation?

I am just wondering, what exactly are the features a language or a library must provide in order for it to be defined as 'Object Oriented'. Is Object Orientation something that can, more or less, be ...
13
votes
4answers
10k views

How did you get good practices for your OOP designs?

I realized I have a difficulty creating OOP designs. I spent many time deciding if this property is correctly set it to X class. For example, this is a post which has a few days: ...
6
votes
3answers
4k views

Should I use friend classes in C++ to allow access to hidden members?

Here is my situation (a simple example). Say I have a class called HiddenData Then I have another class called StoreHiddenData And finaly a class called OperateHiddenData Here's the thing, my ...
6
votes
4answers
854 views

Object-oriented design question

I am using a class through a dll to which I do not have direct control. So in effect, I am only a client of this class. The class represents a form that can be printed, sent to clients and tracked ...
4
votes
3answers
785 views

Can you point me to a nontrivial strategy pattern implementation? [closed]

We are faced implementing a registration workflow with many branches. There are three main flows which in some conditions lead to one another. Each flow has at least four different steps; some steps ...
16
votes
8answers
24k views

What is the point of an interface? [duplicate]

Possible Duplicate: When to use abstract classes instead of interfaces and extension methods in C#? What other reasons are there to write interfaces rather than abstract classes? This ...
6
votes
3answers
2k views

Various programming concepts (from a Python viewpoint)

Ever since I've started lurking on stackoverflow, I keep coming across programming concepts such as abstract classes, virtual functions, contracts, interfaces, etc., from a questions about other ...
8
votes
9answers
2k views

Should I pass an object into a constructor, or instantiate in class?

Consider these two examples: Passing an object to a constructor class ExampleA { private $config; public function __construct($config) { $this->config = $config; } } $config = new ...
6
votes
4answers
2k views

What is the best way to access multiple child properties?

I have a situation where I have to access several "sub-properties" of an object and find it quite appalling to write such code. I was wondering how best to deal with this situation: void Main() { ...
8
votes
2answers
913 views

What is the name for the programming paradigm characterized by Go?

I'm intrigued by the way Go abandons class hierarchies and seems to completely abandon the notion of class in the typical object oriented sense. Also, I'm amazed at the way interfaces can be defined ...
7
votes
1answer
146 views

Private interfaces within a package

This is basically the same as Coding to interfaces, but played out in the real world of com when there are various engineering complexities such as immutability of published interfaces and ...
26
votes
10answers
3k views

How would Functional Programming proponents answer this statement in Code Complete?

On page 839 of the second edition, Steve McConnell is discussing all the ways that programmers can "conquer complexity" in big programs. His tips culminate with this statement: "Object-oriented ...
2
votes
2answers
135 views

Would be semantically correct to make a “Login” constructor in an api class?

Since the methods of the class will only work if the user is logged in, is it right or is there some problem that might make my code slow/inneficient?
5
votes
5answers
1k views

Object oriented programming concepts

Specifically, programming without inheritance is distinctly not object-oriented; we call it programming with abstract data types. I found this great line from Grady Booch's "Object-Oriented ...
4
votes
7answers
561 views

Employer appeal; OOP use in mainstream; solutions that blossom with OOP

I'm currently in the process of what I hope to be a career change into the programming field. Despite my wide range of knowledge in the field and additional exposure to concepts in college (which in ...
3
votes
4answers
2k views

OOP - How to handle multiple instances of a class

In OO programming, what's the preferred way of handling multiple instances (objects) of a single class? Say you want to write a program where a random number of circles get drawn on screen, where ...
3
votes
4answers
2k views

Can you call any php model class in an MVC from the controller?

I'm creating a simple MVC at the moment and am wondering if it's 'correct' to be able to call any model class directly from the controller to get the data to send to the view? I have the following ...
2
votes
3answers
321 views

Basis of definitions

Let us suppose we have a set of functions which characterise something: in the OO world methods characterising a type. In mathematics these are propositions and we have two kinds: axioms and lemmas. ...
2
votes
2answers
395 views

Is there a better way to design these classes?

I have two business classes: TimesheetDay and TimeSlot. One TimesheetDay can have one or more TimeSlots. The TimesheetDay and TimeSlot classes will be dependent on an object that implements a ...
4
votes
1answer
183 views

How often is appropriate to destroy objects?

I know this is hard to answer without examples, so I'm looking for general principles or guidelines here. I'm thinking within the realm of small- to medium-sized mobile games and apps. I've read a ...
10
votes
6answers
11k views

Can we say objects have attributes, states and behaviors?

I was reading through Oracle's introduction to OOP concepts and I came across this description: Real-world objects share two characteristics: They all have state and behavior. Dogs have state ...
13
votes
7answers
1k views

How do you keep track of large projects?

When dealing with a project that has many different files, I always seem to loose track of how the parts interact with one another. I've never really had much of a problem understanding smaller ...
6
votes
6answers
1k views

Organizing Class Members in Regards to Access Modifier

If we look at typical implementation of a Class, we usually see the private members defined at the beginning and public( mostly functions and Accessors) defined towards the bottom. Now, is this a ...
4
votes
4answers
3k views

Is this the correct approach to an OOP design structure in php?

I'm converting a procedural based site to an OOP design to allow more easily manageable code in the future and so far have created the following structure: /classes /templates index.php With these ...
6
votes
4answers
205 views

Are there any languages that allow the static context of a method call to be available at runtime?

Is it possible for a method to know the type of the method it is called under? So for example in the following object orientated psuedo code: Instance io = new InstanceSubclass(); io.doStuff(); Is ...