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

0
votes
3answers
63 views

where should put showSchedule method in school system

In my school management system I have this partial class diagram: 1- In one use case student want to see his schedule of classes in week. this is what i suppose to do: get student object from ...
1
vote
2answers
57 views

How do you decide member objects?

So OOP is about breaking down functionality, making each class responsible for one thing etc. But let's take the example where an object is using another object. First thing that comes to mind ...
0
votes
1answer
52 views

Object creation: when should I expose a factory vs wrapping class?

I am having some problems trying to figure out when to use a factory or to wrapper class. This question is slightly geared towards C# I guess, so I'm not sure if this is the correct place to ask. Say ...
1
vote
2answers
62 views

many to many relation in database schema and oop class diagram

I have Student and Group entities. Student can have many groups and Group can have many students too. so in database I should have middle class and change many-to-many relation to one-to-many and ...
0
votes
4answers
686 views

Why 'List<E>' is an 'interface' but not 'abstract class'?

While defining the hierarchy, one can think to embed the abstract method(behaviour) in abstract class only because the derive concrete class posses that as core behaviour with it's specific ...
1
vote
2answers
60 views

Query on hiding implementation details in java

With the below piece of thread related code, I see that author of Thread class is hiding the details about the working of start() method. What a user of Thread class need to know is, class Thread ...
0
votes
2answers
92 views

Interface inherits from interface without specifying new member

Is it some kind of bad design to have something like this: public interface IFooStream { long Length { get; } long Position {get; set;} //... } public interface ...
4
votes
2answers
381 views

What are the valid uses of static classes?

I noticed that nearly every time I see programmers using static classes in object oriented languages such as C#, they are doing it wrong. The major problems are obviously the global state and the ...
3
votes
3answers
167 views

Is it misleading to label code as a particular design pattern if it only loosely fits the definition?

Background: I have a rough, but working understanding of ~15 design patterns. It's been my experience using design patterns in my own projects that the resulting implementations usually end up as some ...
3
votes
3answers
196 views

Best OOP Practice in C#: Passing the object as parameter VS creating a new instance of the object

First things first, I would like to know if passing an object as parameter is much better than creating another object AGAIN in a class that will use it again and second what are the pros and cons of ...
0
votes
1answer
364 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
3
votes
4answers
296 views

Separation of construction and initialization

I'm confused by this post by Mark Seeman. And his comment on IInitializable below: The problem with an Initialize method is the same as with Property Injection (A.K.A. Setter Injection): it ...
2
votes
1answer
210 views

C# OOP Class Usage [duplicate]

I am just being picky and really wanted some of my code to look, feel, and be used a specific way but am not sure if its possible. I have a class I created that can be used like this ...
5
votes
5answers
200 views

Specific empty children classes

Is having empty children classes, just to specify, a bad practice? Lets suppose I've a generic Product class. There are electrical, electronic and mechanical products. I need to represent all them ...
1
vote
2answers
225 views

Updating an Entity through a Service

I'm separating my software into three main layers (maybe tiers would be a better term): Presentation ('Views') Business logic ('Services' and 'Repositories') Data access ('Entities' (e.g. ...
0
votes
1answer
173 views

Logic based on modified fields of a Hibernate entity

I have a Hibernate entity object MyObject with several attributes and a service MyObjectService containing business logic dealing with MyObject. I also have a view model dealing with user input/output ...
2
votes
2answers
120 views

How do I recreate this Access Control/Group/ whatever methodology in OO/MVC

I am looking at trying to rewrite an application that is mostly procedural to an MVC/OO approach in order to teach myself a deeper understanding of both. BUT, I am having some conceptual issues with ...
2
votes
3answers
174 views

Getters and Setters unclear example

I know autmatic getters and setters are considers bad as they tend to break object's encapsulation. They also move the work that should have been done within the object outside. Allen Holub is a big ...
1
vote
4answers
211 views

Is DDD not appropriate for my website or should I introduce a Query Layer?

I have inherited an ASP.NET website application and the previous developer has used what I believe are some DDD concepts. I am new to DDD and I have to admit I am struggling with the practical side of ...
1
vote
0answers
55 views

Extend, wrap, or both to add generics to a class that should have had them?

So I'm using a C# framework that has a great example of where generics would be useful, except they weren't used. For simplicity's sake, we will say it was a list (I know C# has its own list), but ...
2
votes
0answers
64 views

Sharing constructor code between classes that do not inherit from each other

There is a PHP library of classes (generated from a WSDL) that cannot be changed. These look like the below for simplicity. class System extends \SoapClient { public function __construct(array ...
3
votes
3answers
487 views

Should an object load itself?

although I'm programming in C++ for some time now, I'm always faced with design decisions (probably due to the language's flexibility). One such problem is deciding if a method should be part of the ...
0
votes
1answer
81 views

Should Form Object be considered a DTO?

I got this from one of online video tutorials. Author binds form data not to Value Object directly, but first to validable DTO, and THEN to Value Object, using service. Example: package ...
1
vote
1answer
53 views

Do the implementations of the Node interface in Web API violate Liskov Substitution Principle?

MDN article on Node interface states that interfaces [that inherit from Node interface] may return null in particular cases where the methods and properties are not relevant. They may throw an ...
2
votes
2answers
176 views

Separation of concerns between objects

I have two objects which work together to provide interaction with HIDs on a machine. One object is responsible for the communication (read/write) to the HID and the other object is responsible for ...
1
vote
2answers
63 views

Class template specialization for implementing Automata

I'm implementing classes for simulating and generating different kind of automata. I'd prefer to use the same State and Transition classes for all the automata: NFA, DFA, PDA, etc. For a PDA a ...
1
vote
2answers
256 views

When should I refactor a private class into a package-private class?

When I began implementing a class in my system (let's call it A), I realized I needed some kind of object that does something. So I needed a new class (let's call it B), but I made it a private static ...
0
votes
1answer
71 views

What are the key areas to evaluate software (codebase) on? [closed]

I have been asked to do a code review of about 50 applications over a period of 6 weeks. (Management has changed and the new CTO asked for an full internal software audit) I am wondering, what are ...
2
votes
4answers
215 views

Determining a class structure

I'm currently in the early stages of designing an e-commerce application. I'm working out some designs for my classes which have so far been fairly straightforward, but I've run into something of a ...
0
votes
1answer
228 views

Separating UI from logic

I'm trying to develop a little game and for this I'd like to separate the UI from the game logic. So I'm thinking of using an "Animator" class that will be responsible for rendering the objects, but ...
0
votes
1answer
139 views

The ViewController design in iOS vs MVC in tradiational web apps design

As I came from the background of webapps and move to iOS programming, I am wondering why we can't just apply the MVC design approach to native apps, i.e. in iOS, the view and controller are tightly ...
1
vote
0answers
82 views

Too many parameters to data processing class constructor

I have a conceptually simple application: data comes in as small encrypted packets, they decrypted and validated, some are stored in the database, some rules are applied, and a reply might be ...
1
vote
0answers
58 views

Need to refactor file downloader and post processing utility [duplicate]

Not sure whether this is the right forum to ask this but here goes. Using this solution - http://stackoverflow.com/questions/26571351/replacing-if-else-logic-with-state-strategy-pattern I was able to ...
1
vote
4answers
714 views

try/catch open/closed principle violation

I have three or more different custom exceptions that a class can throw and I need to use try/catch in order to discover which exception was thrown. In my point of view this piece of code violates ...
14
votes
2answers
2k views

Illegal in PHP: Is there an OOP design reason?

The below interface inheritance is illegal in PHP, but I think it would be fairly useful in real life. Is there an actual antipattern or documented problem with the below design, that PHP is ...
28
votes
8answers
6k views

When writing object-oriented code, should I always be following a design pattern?

Is there a conceivable design pattern for any object-oriented program? I ask this because recently I saw an implementation of a Door class with a Lock. It was part of a test and the answer said that ...
0
votes
0answers
49 views

OO Design Question - Library/Objects for API which includes id references

Public api: getClients / getClientById - returns a json object like: { clientid: 1, name: "Client1" } getProjects / getProjectById - returns a json object like { projectid: 5, name: ...
1
vote
0answers
108 views

Program Architecture: How to manage objects that are interdependent

Consider the following case, image I making a simple chat program; I want it to be extensible such that it would be fair easy to add add different scripting and user interfaces. I want the core ...
17
votes
4answers
2k views

Using public final rather than private getters

I see most immutable POJOs written like this: public class MyObject { private final String foo; private final int bar; public MyObject(String foo, int bar) { this.foo = foo; ...
0
votes
3answers
118 views

OOP: relying on protected properties in a class-subclass contract

I'm coding in Python, but the question seems independent of programming language. I have a class that represents some system check: class Check: @abstractmethod def run() """ You have to ...
7
votes
2answers
208 views

Autoreleasing objects in Reference Counting Systems

I'm experimenting a bit in C and I'm trying to implement my own Reference Counting System. I've mainly worked with Objective-C in the past but AFAIK autoreleasing objects is something that is unique ...
1
vote
1answer
47 views

DDD: storing additional data with the model

Our domain is operated within certain context. This context is described by some additional values, like a fooId - id that does not have a meaning in domain business, but it's more a flavor for the ...
2
votes
1answer
94 views

DDD: Global unique identities vs surrogate

Let's start with an example: we have an entity: Book. It has unique identity: Isbn - a value object that wraps a String. This is an UUID. The Book entity also needs a surrogate id from the repo (sql ...
0
votes
1answer
72 views

DDD: Alternative view of the Model?

I have a model class, let's say it's a Book. I need it to be displayed on the screen. I want to have an escaped version of it, so I do not need to escape fields manually. What should I do? I can ...
5
votes
2answers
1k views

Visitor stability vs instanceof flexibility

I am working on a GUI application which generates a configuration file. I have a class hierarchy for the configuration model and I use an object tree of that hierarchy in several different contexts. ...
3
votes
2answers
162 views

Model object and additional attributes

I have a model e.g. Book. Besides 'natural' attributes of a book, I have some mandatory IDs I need to carry on, like companyId, groupId. They are related to which organization unit this book belongs ...
0
votes
2answers
135 views

Should I have an object as attribute or primitive id? [duplicate]

I am wondering which principle should I use. Here is my situation. I have a class named TravelOffer. This class looks like this: public class TravelOffer { private final long id; private ...
3
votes
1answer
210 views

How to store a potentially large amount of optional properties of objects?

I'm using Entity Framework Code First with ASP.NET MVC. This handles my database design based on the domain models within my application. As it stands, the engine I'm writing will have a website ...
3
votes
0answers
139 views

Lightweight data modeling vs traditional classes [closed]

I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
0
votes
1answer
138 views

What should be in a PIMPL?

I am kinda trying to implement a windowing library in C++, the circumstances are forcing me to implement it all myself, that's not the point of this question however. My question is: What should be ...