Skip to main content

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.

2 votes
3 answers
222 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) ...
sayanel's user avatar
  • 509
1 vote
2 answers
250 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-...
Errors for life's user avatar
0 votes
6 answers
289 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 &...
Alexey's user avatar
  • 958
1 vote
1 answer
119 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 ...
Nyamiou The Galeanthrope's user avatar
1 vote
3 answers
273 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 ...
EMN's user avatar
  • 795
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 ...
EMN's user avatar
  • 795
5 votes
5 answers
972 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: ...
user avatar
0 votes
1 answer
152 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'...
Chuck's user avatar
  • 119
3 votes
0 answers
255 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 ...
ulitosCoder's user avatar
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 ...
Sergey Zolotarev's user avatar
2 votes
5 answers
296 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 ...
keelerjr12's user avatar
  • 1,273
1 vote
3 answers
311 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 ...
J K's user avatar
  • 27
2 votes
3 answers
997 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 ...
pulpicated's user avatar
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 }; ...
Mahyar's user avatar
  • 21
2 votes
3 answers
522 views

Implementing factory that return the correct type

Imagine I have a factory that must create object based on unknown input (let's say user input). class Base; class MyFactory { static unique_ptr<Base> CreateBase(Input& input); } Now this ...
sayanel's user avatar
  • 509

15 30 50 per page
1
2 3 4 5
117