Questions tagged [object-oriented-design]
Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.
87
questions with no upvoted or accepted answers
6
votes
0
answers
7k
views
Assembler vs Entity Translator and Entities vs DTO
I was hoping that someone could explain the exact difference between an Assembler and Entity Translator.
Martin Fowler describes the Assembler as a sort of Mapper(?) which converts DTOs into Domain ...
5
votes
0
answers
3k
views
Generic Type Parameters where one is itself Generic with a Type Parameter of the Other
I have a couple of classes with the following pattern that I am uncomfortable with. Is this the only way to do this, or are their other design patterns that would be more reliable.
public class ...
4
votes
0
answers
296
views
Should I pass presenter to use case when implement clean archeiture using scala
This question came to me when I was trying implement Clean Architecture using Scala, and come across this post.
In the accepted answer, @candiedorange emphasis on the separation of responsibility, and ...
4
votes
0
answers
919
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-...
3
votes
0
answers
313
views
Efficient BACnet device polling strategy
Example BACnet network:
Some help is needed to solve a problem around architecting an efficient method of polling BACnet devices across multiple networks (i.e. MS/TP networks) where client software ...
3
votes
0
answers
60
views
How Best To Store Data Structures Around Flow
I'm working on building a simulator for HVAC units. The conceptual model I am working with is basically that an HVAC unit has inputs and outputs, and I need to be able to calculate the outputs for a ...
3
votes
0
answers
719
views
Is this an example of cyclic dependency?
I'm an undergraduate student and I have this assignment on a Discrete Event simulator. Currently I have completed to the end of v1.2 here. Attached also, is an algorithmic overview.
I have wrote my ...
3
votes
0
answers
97
views
Creating bindable input handler in C++ spanning two separate modules
I have a wxWidgets application. This is the first, main module. The second module is an openGL engine. It's a model-view-(controller) structure, where application is the view (and the controller), ...
3
votes
0
answers
81
views
Memento and releasing resources
Let's suppose we have a class whose state has to be saved and later restored, and we resorted to the Memento pattern for that.
What if the state includes resources that have to be explicitly ...
3
votes
0
answers
468
views
How to separate data layer from business layer?
My current .NET project looks like below:
Solution (.sln)
--BusinessProject A (.proj)
--BusinessProject B (.proj)
--DataLayer (.proj)
--A separate project calling ExternalService 1 (folder)
--A ...
3
votes
0
answers
97
views
Nested containers with subclasses
I have nested containers A and B. The attributes are there to show that classes have some other members. One of my functions f takes another container of such containers (let's say vector again).
...
3
votes
0
answers
216
views
Object oriented design of a plugin framework based on user defined classes?
I would like to design a plugin framework, but I have not been able to find an object oriented design that fits my objectives.
My broader design goal is for me to let users define classes in a ...
3
votes
0
answers
730
views
Two-way adapters
In GoF there is a two way adapter concept:
A potential problem with adapters is that they aren't transparent to
all clients. An adapted object no longer conforms to the Adaptee
interface, so ...
3
votes
0
answers
569
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 ...
3
votes
1
answer
167
views
How to model workflows
I'm building a helpdesk-type system, where there are:
Customer - can submit/resubmit tickets;
Manager - can review submitted tickets, assign to developers (one ticket to multiple developers), review ...
3
votes
1
answer
197
views
Message Mapper Design Considerations
Long question context, skip to tl;dr for the meat of it.
I am designing an integration between two web applications, and have come to the conclusion that a message pattern would be an appropriate ...
2
votes
0
answers
387
views
What Design Pattern to use to render PDF pages for a PDF Proposal?
I want to create a set of patterns to use for rendering a PDF Proposal (a set of PDF pages). I have made a good start, but not clear on how to proceed when more complexity is involved.
I am using ...
2
votes
0
answers
121
views
Access modifiers in combination of interpreter pattern with template method pattern
Motivation: (Skip to "The Problem" if you don't need motivation for it)
As a project for myself, I'm writing an expression parser for certain kinds of mathematical expressions, and I'm using the ...
2
votes
0
answers
450
views
Reporting Logic vs Domain Logic
Should the reporting logic to extract domain data in a certain format reside in domain objects or separate reporting objects?
The reporting logic needs to:
select entities/data which match selection ...
2
votes
0
answers
598
views
How should Object Model wrapper classes behave when underlying objects are deleted?
I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several ...
1
vote
0
answers
125
views
Refactoring code for template class
I have a template class in c++ that depends on a few nontype template parameters. The implementation of some methods, and some field member, depend on the value of the template parameters, in a ...
1
vote
0
answers
297
views
Should I extract my functions/types to new files in TypeScript?
Basically I have this class file which was getting quite large with functions and type definitions.
Is it best practice to keep all the code that works on the same aspect in the same file for "...
1
vote
0
answers
471
views
Avoiding forward declaration and circular reference in C++
Consider a card game (something like Magic or Legends of Runeterra) program, with BaseCard, Deck and GameState classes/structs. The way I've conceptualized the relationship between these classes would ...
1
vote
1
answer
264
views
State Pattern when the Behavior in Object of Type A is Dependent on the State of the Object of Type B
I have used the state pattern for my web application where a user can be in one of three states: activated, required_activation and suspended. I have created 3 states classes as given below (source is ...
1
vote
0
answers
206
views
Removing duplicate code with multiple APIs
I have multiple APIs doing the same thing but the code is copied for each API. The names of fields and formats of certain fields like dates are different between the various APIs, but everything is ...
1
vote
0
answers
105
views
Appropriate way to organize dependency with external class avoiding high coupling
I was design a server communication module of native application.
As starting point for now I have 3 classes:
HttpSession — class which contain all necessary data for sending requests.
...
1
vote
0
answers
37
views
avoid passing dbsession object to multiple modules
I have a project which has a service-oriented architecture. for example, anything relates to payment is inside payment module.
-dao
-config
-constatnts
-middlewares
-modules
-payment
-user
-...
1
vote
0
answers
123
views
How to represent a set of ephemerides?
I am writing software that deals with ephemerides—tables describing the positions and orientations of celestial bodies or spacecraft—and I am struggling with how to represent them in the ...
1
vote
0
answers
86
views
Expected behavior from client when thinking about design patterns?
I'm confused about the behavior I should expect from a client when thinking about design patterns. To be more precise, I'm reading the Head First Design Patterns book, and on the difference between ...
1
vote
0
answers
336
views
How to create an "internal" api for my library which is not exposed to the user?
Note that my question is not platform specific so that's why I don't add the [kotlin] tag (the code is in Kotlin). If there is a Kotlin-specific answer I'd like to hear about it though
I am working ...
1
vote
0
answers
79
views
How to follow MVC in a standard iOS App theoritically?
I want to understand one thing in plain english that how do I actually use an standard MVC design pattern in iOS App.
I know about Modal View and Controller and theoretically I know what they do(...
1
vote
0
answers
502
views
Dependency injection in the template class
I have a template wrapper class around the container std::priority_queue that supports multithreading. The short version of it is below. In this class I employ the function IsReady() that checks ...
1
vote
0
answers
127
views
Should all classes and interfaces ultimately derive from one Class, and how does this affect type safety?
If I have "Object" as the top level class, then I have various interfaces, ISomething, ISomethingB, ISomethingC, then I have Class x,y,z, all ultimately deriving from the class Object (these ...
1
vote
0
answers
112
views
Representing all possible values or a subset of values
I have a class that needs to return a set of values e.g
public abstract class AbstractRule {
public abstract String getName();
//Property is an example here.
public abstract Set<Property&...
1
vote
0
answers
180
views
Designing object oriented programming
Basically, I want to make api calls using an SDK I am writing.
I have the following classes:
Car
CarData (stores input values needed to create a car like model, make, etc)
Basically to create a ...
1
vote
0
answers
232
views
DAO Design with Child Objects
If I have objects that represent a hierarchy of relationships. For example:
Person
Spouse
Spouse Contact
Spouse Address
...
1
vote
1
answer
329
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
0
answers
48
views
Setting Dependency Design
Hello I'm currently designing an GUI application who's main job is to update and display settings and some other data. For context, I'm using QT framework. I'm starting to refactor the settings ...
0
votes
0
answers
200
views
better structure of a software project to prevent circular dependencies
I am contacting you today regarding a recent problem with circular dependencies. It's about a Spring boot application that accepts data via a Rest API and then forwards it to an internal Spring ...
0
votes
0
answers
62
views
Is using @Transactional together with @Test annotation on the same test method a good practice?
In my current Java project, there is such style of integration test:
@Test
@Transactional
public void testBusinessTransaction() throws Exception {
//...complicate set up code and execution code
...
0
votes
0
answers
65
views
Should I separate algorithms that rely on a data structure into different classes
I'm learning about graph algorithms, so to learn them better I'm beginning to write some of them using c++. For example, I created the code for implementing the Depth First Search algorithm. Here's ...
0
votes
0
answers
86
views
How to handle multiple-state domain object?
Let's take an example of Order.
An order can have the state new, canceled, shipped, or processing.
The new order can be processed.
The new order can be canceled.
The processing order can be shipped.
...
0
votes
0
answers
171
views
How to handle dependency injection in a library to avoid frequent breaking changes?
Let's say I have a C# .NET library with the following classes:
public class FooService
{
private readonly IDependencyA a;
public FooService(IDependencyA a)
{
this.a = a;
}
...
0
votes
1
answer
198
views
Is it OK to stick with object graph in React State and should I make helpers for handling it?
I am trying to build ERP application using React frontend and I have not found decisive answer whether to use object graphs in React state?
E.g. I would like to build Invoice view and I have the ...
0
votes
0
answers
46
views
Pattern For A Load Behavior That Can Act On Any Class
I have a class called ContentLoader. This class has one method LoadContent<T>(T model, int?loadLogicDecider1, int? loadLogicDecider2, etc). It runs through the input class looking for a ...
0
votes
1
answer
340
views
Validation in a simple DDD example
I'm doing a simple project that represents a CI Pipeline in a low scale. So I'm trying to model "the best way possible" to practice DDD.
Basically I have the following information:
...
0
votes
0
answers
179
views
Splitting nested entities keeping invariant within aggregates
I'm currently developing message imap-based module in crm app and i'm trying to connect dots using ddd principals.
I've started with three main entities, all bound under Account Aggregate:
Account - ...
0
votes
0
answers
70
views
State Pattern: Changing object behavior based on more than one field and consistency between their values and state value
I'm Trying to learn about State Pattern.
In most of State Pattern examples that I have seen, methods of class change their behavior based on just one field (I mean before applying State Pattern and I'...
0
votes
0
answers
165
views
How can I allow sub-services to use concrete types, without having an ever-growing type argument list on the primary service?
NOTE: I believe I have a bit of an X/Y problem here, so please, bare with me. Also, I have trouble explaining things sometimes, so feel free to ask me to elaborate, and I will improve anything I can ...
0
votes
0
answers
145
views
Which Design pattern (C#) should I use for binding / mapping unrelated models and data contracts and for service using them? Code sample below
New Design:
We are porting Legacy code to C#.
We have Request and Response Data Contract for each set of Business Data. These are POCO generated using Schema of External vendor. We will be creating ...