Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.

learn more… | top users | synonyms

6
votes
3answers
9k views

Practical size limits of a Hashtable and Dictionary in c#

What are the practical limits for the number of items a C# 4 Dictionary or Hashtable can contain and the total number of bytes these structures can reasonable contain. I'll be working with large ...
66
votes
16answers
35k views

Is it better to return NULL or empty values from functions/methods where the return value is not present?

I am looking for a recommendation here. I am struggling with whether it is better to return NULL or an empty value from a method when the return value is not present or cannot be determined. Take ...
2
votes
1answer
609 views

Dependency Injection: Only for single-instance objects?

What if I want to also decouple my application, from classes like Product or User? (which usually have more than one instance) Take a look at this example: class Controller { public function ...
13
votes
7answers
3k views

OO best practices for C programs

"If you really want OO sugar - go use C++" -- was the immediate response I got from one of my friends when I asked this. I know two things are dead wrong here. First OO is NOT 'sugar', and second, C++ ...
5
votes
2answers
243 views

What defines an encapsulation properly?

I find the encapsulation concept a bit confusing. So far I have read that the members of the class should be private and any access to private members must be through getter and setter methods, which ...
7
votes
4answers
616 views

What books or resources would you recommend to learn practical OO design and development concepts? [closed]

I'm a self taught programmer; I understand the foundations of programming and what classes are, but my code tends to be messy with class methods interacting with a half a dozen other classes, and my ...
8
votes
2answers
361 views

When following SRP, how should I deal with validating and saving entities?

I've been reading Clean Code and various online articles about SOLID lately, and the more I read about it, the more I feel like I don't know anything. Let's say I'm building a web application using ...
7
votes
4answers
4k views

Can I consider interface methods as abstract methods?

I was thinking about that, and I had some doubts. When I declare an interface, for example: public interface MyInterface { public void method1(); public void method2(); } Could these ...
5
votes
1answer
125 views

Checking members and instantiating in properties

Consider this: public MyClass { private Resource _myResource; public Resource MyResource { get { if(_myResource == null) { ...
7
votes
3answers
621 views

Long parameter list versus long state variable list

In a C++ book, the author says we no longer need a function with a long parameter list because most of the parameters can be refactored into state variables in a class. On the other hand, a ...
5
votes
4answers
388 views

Constant database calls or store in objects?

I'm creating a pretty simple database driven application. Whenever I create a db app, I create classes that mimic the data in the db. Is this good practice? Am I better off making one big call to the ...
5
votes
1answer
318 views

Influences on the design of Dynamic objects by Alan Kay

Alan kay in his paper, The power of Context pdf link, page 8, enumerates some of his motivations for dynamic objects. Some of the influences like Paper on lisp, early paper on the design of functional ...
5
votes
3answers
3k views

How do you annotate instantiation in UML class diagrams?

Given this pseudo code: class B { } class A : B { int val; }; alpha = new A(); What arrow do I draw between alpha and A in a UML class diagram? Is this even something UML is meant to do? ...
15
votes
5answers
910 views

Is SRP (Single Responsibility Principle) objective?

Consider two UI designers who want to design "user attractive" designs. "User attraction" is a concept that is not objective and only resides in the mind of designers. Thus designer A could for ...
3
votes
1answer
392 views

Teaching Programming: drawbacks of using unit tests in problem statement for assignments?

I am experimenting with marking assignments for a programming course using unit tests. Is it likely to harm the learning process if I publish some of the tests I use as part of the problem statement? ...
4
votes
6answers
247 views

Using all the parameters of a function

Code Complete (2nd ed.) says: "If you pass a parameter to a routine, use it. If you aren't using it, remove the parameters from the routine interface." However, in the past I sometime had to do ...
0
votes
1answer
280 views

Designing classes containing the same objects but different amount of them

I am creating a main object, MACHINE, which will contain a diversity of several other objects -- AXIS, AMPLIFIER, ENDEFFECTOR, etc. The number of contained objects will vary depending on the MACHINE ...
1
vote
1answer
320 views

Are XML databases good for small to medium non-programming business project management?

Last couple of weeks I've been searching for some project management solution for a place where I work at the moment. There we rely on excel spreadsheets, but we meet limitations like access rights ...
15
votes
5answers
954 views

How are mock objects commonly misused?

I read an article recently which said that mock objects are often misunderstood and misused. Are there any clear mocking anti-patterns which I can look out for?
11
votes
7answers
2k views

From a design perspective, what are the best practices for logging? [closed]

I want to add logging to an application I'm currently working on. I've added logging before, that's not an issue here. But from a design perspective in an object-oriented language, what are the best ...
5
votes
2answers
104 views

Simplified Interfaces or Object Abstraction

i've been facing a common situation at work that has happened quite often when handling objects. The situation goes like this: You have to realted classes A and B, class A has an instances of class ...
15
votes
9answers
7k views

When should you use a private/inner class?

To clarify, what I'm asking about is public class A{ private/*or public*/ B b; } vs. public class A{ private/*or public*/ class B{ .... } } I can definitely think of some ...
5
votes
6answers
2k views

Software design for procedural programming

Right now, I'm trying to learn a well documented software engineering. I knew that if we code using Object Oriented concept, we can do software design concept using UML. But what if we code using ...
10
votes
2answers
727 views

Design: Object method vs separate class's method which takes Object as parameter?

For example, is it better to do: Pdf pdf = new Pdf(); pdf.Print(); or: Pdf pdf = new Pdf(); PdfPrinter printer = new PdfPrinter(); printer.Print(pdf); Another example: Country m = new ...
21
votes
7answers
10k views

Why avoid Java Inheritance “Extends”

Good day! Jame Gosling said “You should avoid implementation inheritance whenever possible.” and instead, use interface inheritance. But why? How can we avoid inheriting the structure of an object ...
1
vote
7answers
510 views

Quick OOAD Question

Given the following set of classes: Camera, Photo, Photoshoot, Subject. How would they interact to model the following sentence? The next subject is called and has their photo taken. I want to ...
1
vote
1answer
1k views

best practices for solving Object Oriented design questions during technical interviews

after getting a Object Oriented design question during technical interview - for example, design a car rental program - what would be the general steps (a.k.a best practices) that the interviewee ...
8
votes
11answers
3k views

What is the point of properties?

Here are some arguments for properties and my counter-arguments: Easier to use than writing getter and setter methods Getter and setter method pairs are a code smell. Making it easier to write ...
6
votes
3answers
1k views

Duplication in parallel inheritance hierarchies

Using an OO language with static typing (like Java), what are good ways to represent the following model invariant without large amounts of duplication. I have two (actually multiple) flavours of the ...
1
vote
2answers
404 views

want to learn more about implementation of object oriented design in web application using asp.net c#

Can some one guide me about How can i have complete grasp for object oriented design. basically i am looking for a book about that or any good website you people can share . bottom line is that i want ...
8
votes
10answers
975 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 ...