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.
1,742 questions
0
votes
1
answer
77
views
What is the recommended way to gather multiple user input to be processed? - C++ [closed]
I am working on an application that has gui. The gui exposes a number of options to the user. What is best practice in gathering the user selections to be processed? In particular, should I create an &...
2
votes
3
answers
205
views
Adding "caller specific" special cases to a factory
So I have this setup with a factory:
class Base;
class A : public Base;
class B : public Base;
...
class Factory
{
public:
Base* CreateBase(std::string TypeToCreate, const Parameters& P)
...
1
vote
2
answers
220
views
How to Handle Data Persistence In Domain Driven Design
I am currently reading about domain-driven design and n-tier architecture with a service layer, and comparing them to try to understand how each architecture is executed.
For n-tiers (specifically 3-...
0
votes
6
answers
272
views
Design pattern for exposing different parts of interface to different entities
In a certain program I would like to have three objects, say, a, b, and c, with c being a shared private member (sub-object) of a and b. The data between the three objects shall only go this way:
a &...
1
vote
1
answer
110
views
When does encapsulating a primitive field into its own class make sense? [duplicate]
Let's say I have the following Java code:
public record Person(String firtName, String lastName, int age) {}
Can it makes sense to have instead:
public record Person(FirstName firtName, LastName ...
1
vote
3
answers
260
views
How does Object-Oriented Design fit into N-Layered Architecture?
Normally an N-Layered application is structured as follows.
User Interface layer
Business Logic Layer
Data Access Layer
DAL contains objects (data containers) representing business entities. The BLL ...
10
votes
11
answers
4k
views
Difficulty understanding benefit of Separation of Concerns
One of the motivations for separation of concerns is so a change in one place does not affect the other. I am going to make an argument with my limited understanding. Here is a scenario where I fail ...
5
votes
5
answers
954
views
Handling class specific behavior: polymorphism vs instanceof
I'm designing a system with different types of components, and I'm trying to decide whether to use polymorphism or instanceof checks for handling type-specific behavior.
I see two possible approaches:
...
0
votes
1
answer
141
views
LabVIEW Object-Oriented Scripting Engine
This question is for LabVIEW 2019. Highlighting that fact first because some of the "standard" object-oriented techniques like interfaces, type inference, template specialization, etc. aren'...
3
votes
0
answers
252
views
How to encapsulate functions inside a library
I'm working on a project that uses an in-house library, which is also used by other projects.
There are some classes and methods in other classes that are not used outside the library itself, is there ...
3
votes
4
answers
2k
views
Avoiding instanceofs with GUI composites
I have a stack of custom Row widgets. Each of them is a label with some editComponent (often a JTextComponent). Rows are aware of their previous and next siblings (if a Row has no such sibling, the ...
2
votes
5
answers
269
views
Refactoring object of large set of properties
I have a class that looks like:
class Vehicle:
coordinates: GeoCoordinates
speed: float
rpm: float
egt: float
// 100+ other parameters
A repertoire of concrete classes that use ...
1
vote
3
answers
298
views
How to allow users to provide their own child classes in a factory design pattern in c++?
I am building a c++ project that will allow users to essentially model and create their own fleet of cars.
Right now, the approach I have in mind is a Car Factory Class that will implement all of the ...
2
votes
3
answers
983
views
Is breaking encapsulation a necessary compromise for serialization?
I've been considering the way to solve this problem for a while, and I'm currently stuck between two options I both feel are suboptimal. Here's an abstract example of what I'm dealing with:
I have a ...
0
votes
2
answers
186
views
Designing a Two-Party Protocol
I want to design a two-party protocol that runs on two different processes;
each process is one party of the protocol.
My implementation of a Protocol looks as follows:
enum class Role { P1, P2 };
...