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

9
votes
3answers
630 views

Do I suffer from encapsulation overuse?

I have noticed something in my code in various projects that seems like code smell to me and something bad to do, but I can't deal with it. While trying to write "clean code" I tend to over-use ...
-1
votes
3answers
329 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 ...
0
votes
1answer
466 views

How do I start correctly in building database classes in c#?

I am new in C# programming and in OOP. I need to dive into web applications for my company, and I need to do it fast and correct. So even that I know ASP.NET MVC is the way to go, I want to start ...
8
votes
4answers
645 views

Design in “mixed” languages: object oriented design or functional programming?

In the past few years, the languages I like to use are becoming more and more "functional". I now use languages that are a sort of "hybrid": C#, F#, Scala. I like to design my application using ...
0
votes
2answers
318 views

how should I design Objects around this business requirement?

This is the business requirement: " A Holiday Package (e.g. New York NY Holiday Package) can be offered in different ways based on the Origin city: From New Delhi to NY From Bombay to NY NY itself ...
4
votes
4answers
241 views

How do I handle priority and propagation in an event system?

Let's say I have a simple event system with the following syntax: object = new Object(); object.bind("my_trigger", function() { print "hello"; }); object.bind("my_trigger", function() { print ...
10
votes
9answers
1k views

SOLID vs. static methods

Here's a problem I frequently run into: Let there be a web shop project that has a Product class. I want to add a feature which allows users to post reviews to a product. So I have a Review class ...
2
votes
1answer
408 views

CQRS and cache invalidation (while load balancing)

I'm slowly trying to migrate our web application to use CQRS principals. In particular, I have separated "write" and "read" interfaces into commands and queries. I have implemented a "reader" ...
5
votes
3answers
317 views

Modularity vs Single class simplicity

I have been part of the organization I work in for the past year and a half or so. The company basically writes Perl code and they have large amounts of legacy code which originally prevented the ...
2
votes
1answer
1k views

Subscribe/Publish Model in Web-based Application (c#) - Best Practices for Event Handlers

I was recently exposed to a desktop application that uses an publish/subscribe model to handle commands, events, etc. I can't seem to find any good examples of using this in a web application, so I ...
7
votes
6answers
1k views

Triggering custom events in AJAX callbacks

I'm pretty new to JavaScript, but one of the things that's been frustrating is that our AJAX callbacks have been getting packed with different functionality, making it difficult to keep everything ...
0
votes
1answer
155 views

Which one of these implementations is more appropriate for my REST api?

Background So I have a REST API that allows for client applications to access and manipulate users' data. I'm in the process of writing an Objective-C class for simple utilization of this REST API, ...
2
votes
1answer
539 views

Sanity of design for my in-memory object representations of database rows

I've been trying to revise the structural design of the C#.NET-based system I'm currently working on. The new design involves a rather light-weight object-relational mapping framework (we're trying ...
3
votes
2answers
599 views

What are some good small-scale refactoring tests?

I'm looking to test potential candidates on their ability to develop concise, reusable code. I feel like a good test of that skill would be to give them a very small scale application or class ...
10
votes
7answers
2k 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 ...
22
votes
17answers
2k views

What is the value in hiding the details through abstractions? Isn't there value in transparency?

Background I am not a big fan of abstraction. I will admit that one can benefit from adaptability, portability and re-usability of interfaces etc. There is real benefit there, and I don't wish to ...
6
votes
10answers
488 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.) ...
22
votes
10answers
2k 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 ...
0
votes
1answer
422 views

Wrapping a 3rd party API - Gateway Pattern connections

Given a 3rd party API with a very cumbersome object with many different responsibilities-- we decide to wrap using small, manageable, single-responsibility objects. This is the gateway pattern (I ...
3
votes
3answers
354 views

Is partial classes modern Subject-Oriented programming?

Important discussion follows: C# and other language have made partial classes more popular. But isn't this really a tool that have reinvented the subject-orientated programming wheel? What do you ...
17
votes
3answers
13k views

Best design for Windows forms that will share common functionality

In the past, I have used inheritance to allow the extension of Windows forms in my application. If all of my forms would have common controls, artwork, and functionality, I would create a base form ...
6
votes
3answers
6k 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 ...
56
votes
16answers
20k 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
533 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 ...
11
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
232 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
561 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
287 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
3k 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
122 views

Checking members and instantiating in properties

Consider this: public MyClass { private Resource _myResource; public Resource MyResource { get { if(_myResource == null) { ...
7
votes
3answers
567 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
324 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 ...
4
votes
1answer
313 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 ...
3
votes
3answers
2k 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? ...
13
votes
5answers
833 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
368 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
239 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
244 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
302 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
840 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
96 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 ...
12
votes
9answers
5k 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 ...
4
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
701 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 ...
20
votes
7answers
7k 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
435 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
892 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 ...
6
votes
11answers
2k 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
930 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 ...