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

2
votes
2answers
140 views

Sharing POJO between different handlers

I am trying to automate Business Process which can be characterized as a pipeline with distinct stages. Pipeline can be perceived as A->B->C, where A,B,C are distinct Business Steps that work ...
2
votes
0answers
104 views

What are the benefits of an input/output component design?

For the company I work at, all of our projects, including a new one started last year, are written in C89. We write for vxWorks (a real time embedded operation system). Our software runs multi-...
0
votes
1answer
140 views

What kind of data structure should be used to store components in an electrical schematic program?

Is there a specific data structure, object oriented programming methodology, and/or approach for achieving what programs like LT Spice, Altium Designer, and Cadence Virtuoso use to manage components/...
3
votes
1answer
209 views

User Authentication in REST API (domain driven design)

I am using REST API as a presentation layer of a DDD project. In order to secure API calls, I am using token based security. Security in Web APIs-Basic Authentication and Token based custom ...
2
votes
3answers
143 views

Command Pattern - Correct usage?

I have a scenario wherein I need to do certain specific steps in a specific order. For clarity lets take a simple example. Let's say I have a Student and some Student Properties which I encapsulate ...
-1
votes
0answers
31 views

What is the difference… no, relationship… between coupling and cohesion in OOP? [duplicate]

What is the relationship between coupling and cohesion in OOP? I am especially thinking of how these concepts apply specifically in a multi-tiered/multi-layered project. I find that my applications (...
5
votes
3answers
217 views

Is it ever appropriate to use subtyping for a has-a relationship?

One of the basic precepts of object oriented programming is that subtyping represents the "is-a" relationship. That is, the child is always a specific form of the parent. A common example is that a ...
2
votes
3answers
106 views

How to clearly define boundaries of a bounded context

After a month or so of reading and researching DDD, I decided to start my own project and created DDD with these bounded contexts> Clients Products Orders Billing Each bounded context has rest API ...
3
votes
1answer
177 views

Checking preconditions the proper way

I have a class with around 1300 lines and it has many CRUD-like methods that need parameters to be checked, for some of them it's more than just a few rules. For clarity purposes, I am going to use ...
3
votes
1answer
233 views

How to pass data to OOP objects?

I'm new to this whole thing, so please tell me if I'm doing this wrong of if there's a better spot for my question. I'm making a game with basic systems for projectiles, npcs and items. This game ...
2
votes
2answers
191 views

Law of Demeter and its applicability

Let's say I'd like to perform the following command: house.getFloor(0).getWall(WEST).getDoor().getDoorknob(); To avoid a NullPointerException, I'd have to do the following if: if (house != ...
2
votes
2answers
144 views

Best way to enforce constraints in Class

I have a class, something like this one (C#): public class MyFavoriteClass { public string Name { get; set; } public string Description { get; set; } (...) public ReferencedClass1 ...
8
votes
2answers
177 views

How to resolve LSP violation based on minimum precondition

I have a class Party that has a constructor that takes a Collection<Foo>. I plan to have two subclasses NpcParty and PlayerParty. All Party instances have an upper limit on the size of the input ...
-1
votes
1answer
43 views

algorithm to convert technical specification into object model [closed]

I have detailed specification of what should my program take as input, and give as output. How to convert this specification into classes/methods/properties? I used such algorithm: Take ...
-1
votes
2answers
108 views

Do you say “this” on protected members? [closed]

Background I have never had a formal class in OOP/OOD although I understand how the protected members work. Being accessible by any instance/derived class, they are thereby less private (more ...
5
votes
3answers
188 views

Should unit tests always overlap

This is a test design question. I have a class 'handler' that accepts a 'validator' that checks some business logic on what's passed to the handler. I made the unit tests for the validator and now I'...
0
votes
0answers
42 views

How to design MVC in JavaFX with respect to performance of the non-gui task

I'm working on a huge application and we got some serious troubles regarding the performance of the software. I don't want to bother you with too many details, so in short: in one JVM runs the GUI (...
0
votes
2answers
82 views

Proper design for function doing one job but involving many little tasks

I have a class in Python that its only responsibility is receive text, a font path, max font size and min font size and print the text on an image if it fits. I have a function named word_wrap() and ...
3
votes
2answers
123 views

Proper design for models

I have a class called ReplaceRule this is used by 2 classes DocumentRuleViewModel and SectionRuleViewModel as a List<ReplaceRule> in both Question 1: In my database implementation I have 2 ...
0
votes
4answers
58 views

Returning cloned list and getSize

class A{ private List<Item> itemsList; public List<Item> getClonedItemsList{ return new ArrayList<Item>(itemsLIst); } public int getItemsCount{ ...
2
votes
1answer
136 views

Deciding the best way of modeling a timeslot or period of time for a schedule

I am making a sport events scheduler to calculate possible schedules out of initial data and configurations. There are three main domains: players, courts and timeslots. My question regards the latter....
0
votes
1answer
77 views

How to use link tables in backend code?

This is more of an open ended question regarding design best practice. Say I have two classes; one is a Vehicle, and the other is an InformationSource (for maintenance/repair information). An ...
4
votes
3answers
76 views

Verifying objects

If a method takes an object of class A as parameter and analyzes its properties somehow, performs calculations etc. to verify this object, is it okay for class A to have a boolean valid field? After ...
-1
votes
3answers
182 views

Modularity vs Polymorphism (OOD main concepts)

Booch gives 4 main concepts (principles) of OOD (see his book Object-oriented analysis and design with applications ): Abstraction Encapsulation Modularity Hierarchy Usually we encounter to these ...
2
votes
5answers
254 views

Constructor overloading or allow null?

Which is the preferred design to use, one constructor that allows null, or two constructors where one throws an ArgumentNullException on null? Two constructors with exception throwing public class ...
0
votes
0answers
43 views

How to save the differences between objects which are the result of random changes?

I keep a state object of the following form: class State { int num1, num2; List<String> strings; MyObject myObject; // A class I wrote // etc. } The state changes many times ...
1
vote
0answers
12 views

Refactoring Code into a MVC Pattern under the Constraint of a Library God Object [duplicate]

I have 1000 LOC that I plan to refactor into different files and functions. The goal is to be able to test the business logic independently from the visual display. Hence, I am considering an MVC ...
5
votes
1answer
153 views

Three classes and get methods

class A{ private List<T> list; public int getListSize(){ return list.size(); } } class B{ private A objectA; public int getSizeOfListInA{ return objectA....
6
votes
2answers
253 views

MVP (Supervising Controller) Does the view update the model?

I've been reading about MVP, specifically Supervising Controller. One thing I'm having difficulty wrapping my head around is how the View interacts with the Model. It was my understanding that the ...
1
vote
2answers
156 views

How to store state data when the data is related to another entity?

In order to increase the parallel-ability of my objects, I try to make them read-only and include only data that naturally belong to the entity. I have class Object { ... }; class Processor { ...
5
votes
2answers
114 views

Design pattern for too many ctor parameters within class hierarchy

Is there some design pattern for handling situation where class hierarchy constructors parameters force the most bottom classes to have too many parameters? Ideally this would be in C++, if language ...
-1
votes
1answer
104 views

Is there an official name for the “one object disease” anti-pattern (iterative single object operations on databases, services etc.)?

It is caused by the naive programming paradigm: focus on just a single object, do something with it, and if you have to work with many objects, you loop, iterate and traverse, repeating the operation ...
3
votes
4answers
244 views

Is Template Pattern a good way to implement DRY?

Here is my problem: I have and class structure like this: class Base { private: SomeType something; bool isSomeValue; public: virtual void myMethod() = 0; }...
4
votes
2answers
94 views

Should I use the same object for individual instances and collections?

One of the functions of an application I manage is to operate a fleet of vehicles. I have an object vehicle with which I can do tasks that are vehicle-related; getMileage(), setDriver(), etc. I also ...
4
votes
1answer
108 views

When to use traits, as opposed to inheritance and composition?

There are three common ways, AFAIK, to implement reusability when it comes to OOP Inheritance : usually to represent is-a relationship (a duck is-a bird) Composition: usually to represent has-a ...
2
votes
2answers
247 views

Best practice for using StringBuilder

I'm writing a camera control program which uses many methods for each of the different commands. One example is: public void CameraPan(int Id, string Direction, int Speed) { StringBuilder sb = ...
0
votes
1answer
80 views

Project structure for Web, Api, DAL and ViewModels

I have a ASP .NET WebApi and a Web Project. I'm about to create a DAL class library... Which will be my codefirst/POCO's or possibly edmx files. I'm wondering do I need to have another class library ...
4
votes
2answers
53 views

Referencing extendable ordinal numbers

I have a class that is basically a container (or composite) of 4 other objects. I'm trying to figure out the "best" way of referring to these objects, while still allowing it to be robust enough, so ...
2
votes
0answers
60 views

Mocking third party web service

I am working on a project to create a wrapper library which will be used to interact with a web service provided by the client's IT team. The reason for this library is that we interact with this ...
9
votes
4answers
698 views

How to argue against this “completely public” mindset of business object class design

We're doing a lot of unit testing and refactoring of our business objects, and I seem to have very different opinions on class design than other peers. An example class that I am not a fan of: ...
3
votes
1answer
119 views

Is it good practice to access database in mapping between object

Situation I receive message from a 3rd party, and these messages are use to create or update database information. Message and data to be updated can be de-serialize in object form, but are not ...
5
votes
1answer
72 views

How to design class with multiple modules

I have something like this Class App Module A Module B Module C Module D Each of the modules have a single responsibility and are pretty well encapsulated (public interface, private ...
1
vote
2answers
310 views

Multiple instance of the same class?

I have a class named "Category" to handle all the operations and data about my categories. Now, my class is created however I need to find a way to build an object for each of the categories in my ...
2
votes
3answers
75 views

Calculating a score and a breakdown of the score in different places - should I use the same methods?

I am creating a plugin that uses a metric to determine a score on one page and allows the user to click through to see a more detailed breakdown of the score on a separate page. The trouble is: I can'...
0
votes
2answers
161 views

Should I create a new class?

Let's say I have a Car class. Objects of this class will be stored in a collection, and every object should know about other elements in the collection, because for each car there's a value to be ...
2
votes
1answer
125 views

Lower class count vs explicitness

To help with an application that manipulates and works from an XML structure to produce other information, I've created a class structure that closely follows the XML structure. So, the XML is: <...
0
votes
0answers
61 views

Test Utility in Spring: Singleton or Static

I'm working on Test Utility in a spring project, this utility contains a methods to convert an object to JSON object and vice versa..etc and I'm confused if it's better to make the methods as ...
1
vote
0answers
143 views

OOP - Modeling a Chat Design Review [closed]

Seeking thoughts on the following design. I know the design could be lot simpler if use Sockets. But I wanted to think of a design with pure POJO classes. User string id; string displayname; ...
1
vote
5answers
155 views

Can variable names match field names? [closed]

Microsoft suggested that variable names should not match field names. However I saw this extensively in Java (e.g., this tutorial), especially in setters and constructors. So, among these two styles: ...
0
votes
2answers
131 views

OO design: separation of concerns

I have a collection of classes which model Logical(Boolean) Expressions. There is a base abstract class LogicalExpression, and derived classes : UnaryLogicalExpression, BinaryLogicalExpression, ...