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
1answer
138 views

Where to put entity model classes in case of using a dataservice layer?

If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong? At first i thought putting them in the ...
5
votes
2answers
268 views

Does increasing the number of classes increase code complexity? [duplicate]

To illustrate the question, let's say we have two programmers of comparable skill that both solve the same problem. The code they turn out has roughly the same lines of code, but one programmer uses 5 ...
11
votes
3answers
1k views

How to create better OO code in a relational database driven application where the database is poorly designed

I am writing a Java web application that consists mainly of a bunch of similar pages in which every page has several tables and a filter that applies to those tables. The data on these tables comes ...
0
votes
1answer
139 views

How should I implement “queueing” of approval on my objects?

I have a list of objects that will need to go through an approval process. I am curious if it would be best to simply add some properties to my object, like ApprovedBy, and ApprovedOn. Another ...
1
vote
1answer
268 views

How to avoid peppering the code with IFs [duplicate]

I need to add a new payment type to an existing code base. That means that I'm going to have a few methods looking like this: if (old payment type) process old type of payment else process ...
1
vote
2answers
116 views

How to deal with requirements and use cases in this kind of situation?

Recently I've started to work with object oriented analysis and design and it seemed very interesting to me as a way to get work done better. But I'm still in doubt with one kind of situation. If this ...
3
votes
3answers
220 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 ...
29
votes
3answers
2k views

Is a “start”, “run” or “execute” method a good practice?

I'm currently working on a code base that has many classes that implement a Start method. This seems like two-phase construction to me, which I had always considered a bad practice. I can't tell the ...
0
votes
1answer
106 views

Creating Set Subclasses or Allowing Outside Configuration

I have a TriggerCaller and a TriggerAction class. The Caller "calls" the do() method on the action, which is set with the TriggerCallers setAction() method. The rest of the program should deal with ...
0
votes
3answers
469 views

Have Superclass Contain List of Subclass?

For the GUI of a program, I want it to list several items, all of which are, from a programming side, just subclasses. They can add one of these items to a list. I don't want to hard-code which ...
16
votes
10answers
867 views

Object Oriented Design

Suppose you have the following: +--------+ +------+ | Animal | | Food | +-+------+ +----+-+ ^ ^ | | | | ...
1
vote
1answer
157 views

Component design: getting cohesion right

I currently have a set of components named DataValues, ValueParsers, ValueFormatters and ValueValidators. The first one defines an abstract base class DataValue and contains a whole load of ...
8
votes
4answers
899 views

Is the List interface a leaky abstraction?

If I have a variable containing a List it could contain objects of a lot of different types e.g. ArrayList or LinkedList. The difference between a LinkedList and an ArrayList is pretty big. The big O ...
14
votes
6answers
1k views

Loose Coupling in Object Oriented Design

I am trying to learn GRASP and I found this explained (here on page 3) about Low Coupling and I was very surprised when I found this: Consider the method addTrack for an Album class, two possible ...
5
votes
5answers
305 views

How to organise OO code [duplicate]

If you have a method that doesn't need access to any non public fields, properties or methods where should you put the method ? should it just be a normal method in the class, a static method that ...
6
votes
3answers
737 views

Is it a good practice to wrap all primitives and Strings?

According to Jeff Bay's Essay on Object Callisthenics, One of the practices is set to be "Wrap all primitives and Strings" Can anyone elaborate on this ? In languages where we already have wrappers ...
2
votes
2answers
1k views

When to use inheritance or composition/aggregation?

In general, how do I decide whether to use make a class a super class, or to make it a private data member of another class? For example, given two classes, how does one decide whether to do this: ...
5
votes
3answers
451 views

OO - are large classes acceptable? [duplicate]

Despite many years in IT, I still struggle with OO design. One particular problem I seem to keep ending up with is large classes, often containing many hundreds of lines of code. The OO world talks a ...
2
votes
1answer
147 views

Help me to understand following points about the strategy pattern, how it relates to open/closed principle

I am learning design patterns. I read this article. Point no. 3 is not clear to me. The writer said that strategy lets you change the guts of an object. But this is a violation of the open-close ...
2
votes
2answers
461 views

Is it a Single Responsibility Principle violation?

I'm designing an OO graph library and at the moment I'm trying to figure out the design for a GraphEdge class. I've added setters and getters for it's nodes, direction and weight. This seemes ...
1
vote
1answer
149 views

Design pattern advice required for sending xml files to different destinations

I am using an Export Module, now I want to extend it for different connections. I have a database which contains products Its Description, Review, Images etc. I use the serialize function to save it ...
0
votes
2answers
267 views

Which could be a good design pattern for complex numeric calculations between three or more different data models?

The source code I'm working on at the moment performs numeric calculations between a bunch of different properties belonging to different data models. All the calculations are coded in a big method ...
0
votes
3answers
309 views

Object design where hard-coded values are used to instantiate objects?

I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a ...
-1
votes
2answers
122 views

Design suggestion required to create an Export plugin

I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here to get some guide lines. In our database we have a list of Products, which can be ...
6
votes
2answers
434 views

Is it good to have an interface plenty of methods which belong to different concepts, just to preserve the Liskov's Principle?

I'm currently studying a course based on Software Design and I had a discussion in class with my professor and some classmates about a problem represented by the next scenario: Scenario Imagine ...
0
votes
3answers
119 views

Should a complex unifying class be doing computation?

I have a large application in Java filled with independent classes which are unified in a PlayerCharacter class. The class is intended to hold a character's data for a game called the Burning Wheel, ...
5
votes
6answers
272 views

Passing an object between different handlers or a Superclass that contains most of the logic

I'm going to try to make this as concise and concrete as possible, but apologies since I can think of multiple ways to make it work. This question might also relate to handling production workflows ...
3
votes
2answers
131 views

Is it a good idea to put declaration of protocols for delegates in a private category interface?

I have a View Controller or a View that implements delegate and dataSource methods of UITableView. These methods are not going to be used outside this class. So is it a good idea to make the ...
1
vote
0answers
925 views

How should I structure modules in an Angular.js application?

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS ...
2
votes
3answers
252 views

Dependency injection and ease of use

I'm writing a handy library (we'll call it Thinger) that goes off and fetches an XML document, does some X-Path query on it and does something helpful with the result of that. (What I'm actually doing ...
2
votes
2answers
256 views

Where should I parse data obtain with a DAO

I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the ...
3
votes
2answers
168 views

Are there any well-known quantitative approaches to evaluate a particular design whether it satisfies or violates the SOLID design principles? [duplicate]

I designed an application framework by considering the SOLID design principles and supported by design patterns. However, I wonder if there are any automated tools or well-known approaches to evaluate ...
4
votes
2answers
491 views

Why do most java classes end with “ers”? [closed]

...Provider ...Searcher ...Resolver ...Builder ...Manager ...Importer ...Descriptor ...Helper ...Indexer Is it a global convention to refer a thing with "..ers" or "..ors". In contrast, a "thing" ...
0
votes
0answers
87 views

DAO Design with Child Objects

If I have objects that represent a hierarchy of relationships. For example: Person   Spouse     Spouse Contact     Spouse Address ...
0
votes
4answers
1k views

Best OOP design pattern for a sequence of operations

I am working on an application, a module of which does the following financial operations sequentially: When a user requests for a certain amount to be transferred into her bank account: check ...
4
votes
6answers
433 views

Should a User class only contain attributes and no methods apart from getters/setters?

I'm trying to improve my OOP code and I think my User class is becoming way too fat. In my program a user has rights over "lists". Read, Write, Update, Delete. So I made a User class class User { ...
0
votes
4answers
2k views

Software Design and architecture from Scratch [duplicate]

I know a lot about programming syntactically. What I am unsure is about how should I go to build a software from scratch. How should be the objects be designed and how should they interact with each ...
0
votes
1answer
66 views

Program Structure for Table Cells Representing Objects

So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the ...
2
votes
4answers
424 views

Derived Class Method Naming

I'm having a hard time coming up with a good naming convention for methods in derived classes that serve the same purpose as the methods in the base class. For example, if both the base class, and the ...
13
votes
3answers
1k 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; ...
4
votes
2answers
479 views

Log design approach

Logging was always a nightmare for me! Now I have to implement it again for a proxy system. In this proxy application, some systems ask proxy system to call some other services. What I have to log is ...
0
votes
2answers
156 views

How to design member access for an Article-type class? [duplicate]

I am doing a final project in a C++ class writing a very simple usenet-like client/server. I figure that since it's usenet-like I'll have a NewsGroup class and an Article class, I'm now working on my ...
2
votes
4answers
314 views

What should I look for when job-hunting to find a strong OOD focus?

I'm currently seeking a job. I've got a good CV, but little industry experience, and so my difficulty is that I'm not entirely certain what I'm looking for. What I've done is a good BSc in Computer ...
0
votes
1answer
331 views

Is object-oriented conceptual thinking something you build with experience? [closed]

I know that the answer is pretty clear because you get better on everything with time and experience. But I'll tell you where I'm coming from: A couple of months ago I decided to learn iOS ...
4
votes
2answers
989 views

Which of these OOP examples demonstrate proper OOP concepts?

I'm still trying to wrap my head around OOP. All of the following examples work, of course, but is there one (or possibly another) that best exemplifies OOP concepts? /** * For the following ...
2
votes
5answers
520 views

Why sequential cohesion for operations in a method is not a good idea?

I read from the seminal Code Complete book that method statements that require to be executed in order passing parameter from one to the next is a code smell and is an example of a sequential ...
2
votes
1answer
295 views

Understanding high cohesion principle for methods in object oriented design

I know the idea of strong cohesion applies to methods as much it applies to classes. Just to be clear when I say strong cohesion of a method I mean a method which does only one task and does it well. ...
4
votes
3answers
709 views

C++ vs Objective-C design principles of setters and getters

In C++ I was told that my classes shouldn't have getters and setters: Doing it wrong... blog post. On the other hand, in Objective-C, the direct use of ivar is discouraged, because the getters allow ...
4
votes
1answer
628 views

Explanation of Object-parameter-coupling as mentioned in Code Complete book

I have been reading up on the seminal and excellent book Code Complete. It discusses about the various kinds of couplings that can happen between modules(which may be classes as well as methods): ...
4
votes
2answers
289 views

Preventing Liskov Substitution violation

I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . ...