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.

89 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10 votes
3 answers
2k views

Balance between aggregate boundaries and domain consistency in DDD

Designing an Aggregate and choosing an Aggregate Root getting tricky for me all the time especially when it comes to ensuring right transactional contexts and consistency constraints so I'm wondering ...
ovnia's user avatar
  • 461
5 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 ...
user2308097's user avatar
4 votes
0 answers
274 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 ...
Brian Hsu's user avatar
  • 201
4 votes
0 answers
825 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-...
Trevor Hickey's user avatar
3 votes
0 answers
274 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 ...
Tyler B. Long's user avatar
3 votes
0 answers
40 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 ...
Marshall Tigerus's user avatar
3 votes
0 answers
700 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 ...
Prashin Jeevaganth's user avatar
3 votes
0 answers
92 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), ...
Karlovsky120's user avatar
3 votes
0 answers
78 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 ...
olegst's user avatar
  • 179
3 votes
0 answers
456 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 ...
now he who must not be named.'s user avatar
3 votes
0 answers
92 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). ...
Utka's user avatar
  • 31
3 votes
0 answers
204 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 ...
MrSynAckSter's user avatar
3 votes
0 answers
724 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 ...
Narek's user avatar
  • 1,143
3 votes
0 answers
547 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 ...
DFord's user avatar
  • 1,240
3 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 ...
RosieC's user avatar
  • 279
3 votes
1 answer
145 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 ...
Deniss Kozlovs's user avatar
3 votes
1 answer
193 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 ...
Aj_76's user avatar
  • 98
2 votes
2 answers
170 views

Data getter inside Model or ViewModel in MVVM

I'm working on an app I created for myself using the MVVM architecture. On my ViewModel I have a list_items that, when changed, updates the corresponding UI element on the View. The list of items ...
João Pedro's user avatar
2 votes
0 answers
343 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 ...
Dennis's user avatar
  • 8,157
2 votes
0 answers
118 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 ...
Umer Amjad's user avatar
2 votes
0 answers
439 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 ...
jags's user avatar
  • 167
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 ...
Avner Shahar-Kashtan's user avatar
1 vote
0 answers
140 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 "...
Eliaz's user avatar
  • 21
1 vote
0 answers
324 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 ...
Janilson's user avatar
  • 121
1 vote
1 answer
188 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 ...
Khuram's user avatar
  • 137
1 vote
5 answers
299 views

Specialization and LSP violation?

I have Document and ExternalDocument classes in my system, where ExternalDocument extends Document. The main distinction is that ExternalDocument holds onto externalDocumentId and externalEventId data ...
plalx's user avatar
  • 389
1 vote
0 answers
173 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 ...
d368811's user avatar
  • 11
1 vote
0 answers
104 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. ...
Liastre's user avatar
  • 171
1 vote
2 answers
944 views

How to design an API wrapper with bulky operations on domain object? (Need guidance)

I need some guidance in designing an API wrapper for my backend APIs. I have tried to keep it as specific as possible. Context: We have a project which supports certain file operations like edit, ...
lazyloader's user avatar
1 vote
0 answers
36 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 -...
amir's user avatar
  • 133
1 vote
0 answers
115 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 ...
2012rcampion's user avatar
1 vote
0 answers
85 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 ...
aderchox's user avatar
  • 184
1 vote
0 answers
314 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 ...
Adam Arold's user avatar
  • 1,180
1 vote
0 answers
78 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(...
Ritesh.mlk's user avatar
1 vote
0 answers
477 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 ...
Konstantin's user avatar
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 ...
johnny's user avatar
  • 3,669
1 vote
0 answers
110 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&...
Hav3n's user avatar
  • 31
1 vote
0 answers
179 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 ...
Pota Onasys's user avatar
1 vote
0 answers
231 views

DAO Design with Child Objects

If I have objects that represent a hierarchy of relationships. For example: Person   Spouse     Spouse Contact     Spouse Address   ...
cldfzn's user avatar
  • 21
1 vote
1 answer
311 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 ...
sinθ's user avatar
  • 1,311
0 votes
0 answers
43 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. ...
Ngọc Nguyễn 's user avatar
0 votes
0 answers
83 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; } ...
srk's user avatar
  • 117
0 votes
1 answer
80 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 ...
TomR's user avatar
  • 1,003
0 votes
2 answers
81 views

Where to specify UI views in a hierarchy of model objects?

In a Flutter app I'm developing, I have a class hierarchy of model objects of a certain base class. To take a typical example, the abstract base class could be Vehicle. Then I have a (pretty much) ...
Anakhand's user avatar
  • 177
0 votes
0 answers
77 views

From the ECB & DAL perspectives, is this design acceptable?

I've been recently trying to go slightly further in arch. patterns (specifically layered arch.). I decided to go though an old project of mine (a CLI-based cinema reservation system) and evaluate my ...
Ahmed Alhallag's user avatar
0 votes
0 answers
43 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 ...
Stevenfowler16's user avatar
0 votes
1 answer
199 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: ...
Martin Gonzalez's user avatar
0 votes
0 answers
139 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 - ...
devmr97's user avatar
0 votes
0 answers
65 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'...
Mohammad Mehdi Sarfejoo's user avatar
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 ...
Hazel へいぜる's user avatar