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

1
vote
3answers
198 views

Inheritance from the objects themselves

Making new inheritance hierarchy with the help of C++ I think about: Why there is no inheritance from the class objects? Abstract example (on abstract C++): struct Foo { int v; Foo(int a) : v(a) ...
2
votes
1answer
489 views

Liskov substitution and abstract classes / strategy pattern

I'm trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much! P.S. ...
3
votes
3answers
492 views

Override methods should call base method?

I'm just running NDepend against some code that I have written and one of the warnings is Overrides of Method() should call base.Method(). The places this occurs are where I have a base class which ...
3
votes
2answers
4k views

How to design a scalable notification system? [closed]

I need to write a notification system manager. Here is my requirements: I need to be able to send a Notification on different platforms, which may be totally different (for exemple, I need to be ...
1
vote
3answers
211 views

OOD: All classes at bottom of hierarchy contain the same field

I am creating a class diagram for what I thought was a fairly simple problem. However, when I get to the bottom of the hierarchy, all of the classes only contain one field and it is the same one. ...
3
votes
4answers
331 views

Representing complex object dependencies

I have several classes with a reasonably complex (but acyclic) dependency graph. All the dependencies are of the form: class X instance contains an attribute of class Y. All such attributes are set ...
1
vote
1answer
2k views

Use decorator and factory together to extend objects?

I'm new to OOP and design pattern. I've a simple app that handles the generation of Tables, Columns (that belong to Table), Rows (that belong to Table and have Columns) and Values (that belong to ...
3
votes
1answer
547 views

Too complex/too many objects?

I know that this will be a difficult question to answer without context, but hopefully there are at least some good guidelines to share on this. The questions are at the bottom if you want to skip the ...
0
votes
2answers
305 views

Examples of Liskov Substitution [closed]

I'm facilitating a session next week on the Liskov Substitution Principle and I was wondering if anyone had any examples of violations 'from the trenches'? I'm looking for something other than uncle ...
6
votes
4answers
263 views

Do functional generics exist and what is the correct name for them if they do?

Consider the following generic class: public class EntityChangeInfo<EntityType,TEntityKey> { ChangeTypeEnum ChangeType {get;} TEntityKeyType EntityKey {get;} } Here EntityType ...
0
votes
1answer
368 views

would a composite design pattern be useful for group membership?

I'm trying to think about the best way to handle group memberships on a website. People sign up and select checkboxes in a list of interests. Every week we send out interest-themed emails to those ...
1
vote
3answers
237 views

Should I use an interface when methods are only similar?

I was posed with the idea of creating an object that checks if a point will collide with a line: public class PointAndLineSegmentCollisionDetector { public void Collides(Point p, LineSegment s) { ...
1
vote
2answers
655 views

REST API wrapper - class design for 'lite' object responses

I am writing a class library to serve as a managed .NET wrapper over a REST API. I'm very new to OOP, and this task is an ideal opportunity for me to learn some OOP concepts in a real-life situation ...
2
votes
2answers
271 views

Strategies for invoking subclass methods on generic objects [duplicate]

Possible Duplicate: Alternatives to type casting in your domain I've run into this issue in a number of places and have solved it a bunch of different ways but looking for other solutions ...
4
votes
6answers
190 views

Where should I put a method that returns a list of active entries of a table?

I have a class named GuestbookEntry that maps to the properties that are in the database table named "guestbook". Very simple! Originally, I had a static method named getActiveEntries() that ...
10
votes
6answers
6k views

What are the differences between abstract classes, interfaces, and when to use them

Recently I have started to wrap my head around OOP, and I am now to the point where the more I read about the differences between abstract classes and interfaces the more confused I become. So far, ...
0
votes
2answers
179 views

When modeling a virtual circuit board, what is the best design pattern to check for cycles?

To make it simple assume you have only AND and OR gates. Each has two inputs and one output. The output of two inputs can be used as an input for the next gate For example: A AND B -> E C AND D -> F ...
5
votes
1answer
1k views

Why doesn't Java's BigInteger class have a constructor capable of taking a numeric literal? [closed]

Why doesn't Java's BigInteger class have a constructor capable of taking a numeric literal? Every single time I use BigIntegers, and many times I merely think about them, I wonder this. What reason ...
2
votes
3answers
691 views

What kind of programs/solutions can only be written with OOP or are too hard to achieve without it? [closed]

Paraphrasing a recent question: What is Object Oriented Programming ill-suited for? I would like to ask the opposite question: What kind of programs cannot be written unless you use OOP? What kind ...
2
votes
2answers
489 views

design a model for a system of dependent variables

I'm dealing with a modeling system (financial) that has dozens of variables. Some of the variables are independent, and function as inputs to the system; most of them are calculated from other ...
2
votes
2answers
3k views

DB Object passing between classes singleton, static or other?

So I'm designing a reporting system at work it's my first project written OOP and I'm stuck on the design choice for the DB class. Obviously I only want to create one instance of the DB class ...
4
votes
1answer
296 views

Object oriented wrapper around a dll

So, I'm writing a C# managed wrapper around a native dll. The dll contains several hundred functions. In most cases, the first argument to each function is an opaque handle to a type internal to the ...
21
votes
5answers
2k views

Do unit tests sometimes break encapsulation? [duplicate]

I very often hear the following: "If you want to test private methods, you'd better put that in another class and expose it." While sometimes that's the case and we have a hiding concept inside our ...
18
votes
8answers
2k views

What can go wrong if the Liskov substitution principle is violated?

I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what ...
73
votes
7answers
6k views

Is this a violation of the Liskov Substitution Principle?

Say we have a list of Task entities, and a ProjectTask sub type. Tasks can be closed at any time, except ProjectTasks which cannot be closed once they have a status of Started. The UI should ensure ...
1
vote
1answer
199 views

Object behaviour or separate class?

When it comes to OO database access you see two common approaches - the first is to provide a class (say "Customer") with methods such as Retrieve(), Update(), Delete(), etc. The other is to keep the ...
53
votes
10answers
3k views

My proposed design is usually worse than my colleague's - how do I get better? [closed]

I have been programming for couple of years and am generally good when it comes to fixing problems and creating small-to-medium scripts, however, I'm generally not good at designing large scale ...
4
votes
3answers
2k views

How to avoid javascript becoming spaghetti code?

I've done quite a lot of javascript over the years and I'm using a more object-oriented approach, specifically with the module pattern. Which kind of approach do you do use to avoid a bigger code-base ...
1
vote
2answers
63 views

Making a design for a Problem [closed]

I have written many codes using OOPS and I am still to understand when is a code good enough to be accepted by experts. The thought procedure of every man is different and so is the design. My ...
1
vote
3answers
370 views

Any tips/tricks/resources on actually TEACHING a class on OOP? [closed]

I may slowly be getting into teaching an Object-Orientated Programming class at my school in a year or two. I just graduated and work at my school as an Application Programmer. I'd first start off as ...
2
votes
1answer
291 views

How can I design my classes to include calendar events stored in a database?

I'm developing a web calendar in php (using Symfony2) inspired by iCal for a project of mine. At this moment, I have two classes: a class "Calendar" and a class "CalendarCell". Here you are the two ...
2
votes
1answer
220 views

Finding the best practice for a game simulating tool

I'm studying Java right now, and I'm thinking of this tool as my practice project. The game is "League of Legends" in case anyone knows it, I'm not actually simulating the game as in simulating game ...
3
votes
1answer
457 views

The Meaning of Unified in UML

UML and other related modelling languages are exists in most of the system engineering fields to represent the system, flow, relations in a structured way. UML also is one of the modelling language ...
5
votes
3answers
402 views

What is a good design model for my new class?

I am a beginning programmer who, after trying to manage over 2000 lines of procedural php code, now has discovered the value of OOP. I have read a few books to get me up to speed on the beginning ...
19
votes
6answers
921 views

Should an object know its own ID?

obj.id seems fairly common and also seems to fall within the range of something an object could know about itself. I find myself asking why should my object know its own id? It doesn't seem to have a ...
20
votes
3answers
14k views

Where to put business logic in MVC design?

I have created a simple MVC Java application that adds records through data forms to a database. My app collects data, it also validates it and stores it. This is because the data is being sourced ...
1
vote
1answer
221 views

design pattern advice: graph -> computation

I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and ...
3
votes
1answer
672 views

Domain Models (PHP)

I have been programming in PHP for several years and have, in the past, adopted methods of my own to handle data within my applications. I have built my own MVC, in the past, and have a reasonable ...
2
votes
2answers
1k views

Relationship between SOA and OOA

Thomas Erl defines SOA as follows in his site: Service-oriented computing represents a new generation distributed computing platform. As such, it encompasses many things, including its own ...
2
votes
1answer
723 views

Design patterns and multiple programming languages

I am referring here to the design patterns found in the GOF book. First, how I see it, there are a few peculiarities to design pattern and knowing multiple languages, for example in Java you really ...
2
votes
5answers
457 views

software architecture (OO design) refresher course [closed]

I am lead developer and team lead in a small RAD team. Deadlines are tight and we have to release often, which we do, and this is what keep the business happy. While we (the development team) are ...
10
votes
7answers
3k views

Interfaces on an abstract class

My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when ...
0
votes
5answers
2k views

Inheritance vs composition in this example

I'm wondering about the differences between inheritance and composition examined with concrete code relevant arguments. In particular my example was Inheritance: class Do: def do(self): ...
4
votes
1answer
191 views

What is a “behavior rich object” and why would it be advantageous?

I am referring to the article Mocks aren't Stubs by Martin Fowler. When naming cases when he think "mockist" TDD will be advantageous, he said It's particularly worth trying if you are having ...
5
votes
4answers
1k views

Can a loosely typed language be considered true object oriented?

Can a loosely typed programming language like PHP be really considered object oriented? I mean, the methods don't have returning types and method parameters has no declared type either. Doesn't ...
4
votes
1answer
280 views

Whats a better way of designing this class

Currently I have some code like this: OntologyGenerator generator = new OntologyGenerator(); generator.AddOntologyHeader("Testing"); generator.AddClassDeclaration(owlBuilder); ...
6
votes
3answers
3k views

Is it a better practice pre-initialize attributes in a class, or to add them along the way?

I'm sorry if this is a ABSOLUTELY sophomoric question, but I'm curious what the best practices are out there, and I can't seem to find a good answer on Google. In Python, I usually use an empty class ...
15
votes
6answers
1k views

Does multiple inheritance violate Single Responsibility Principle?

If you have a class which inherits from two distinct classes, does not this mean that your subclass automatically does (at least) 2 things, one from each superclass? I believe there is no difference ...
1
vote
2answers
861 views

Replacing Multiple Inhertance with delegation

I was going through "Object Oriented Modelling and Design" by James Rumbaugh et al and it said that in languages where multiple inheritance is not supported like Java three mechanisms can be used as ...
7
votes
4answers
595 views

Do some best practices depend on skill?

Is there evidence that some software development best practices depend on programming skill level? I mean, these methods are good, but maybe the way the are used or the extent might vary? This ...