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,737 questions
1vote
2answers
158views
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 ...
8votes
11answers
3kviews
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 ...
5votes
5answers
909views
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: ...
0votes
1answer
130views
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'...
2votes
0answers
223views
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 ...
3votes
4answers
2kviews
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 ...
2votes
5answers
253views
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 ...
1vote
3answers
262views
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 ...
2votes
3answers
951views
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 ...
0votes
2answers
174views
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 }; ...
2votes
3answers
313views
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 ...
0votes
1answer
121views
Which approach do I choose for representing objects and scenes in my 3D drawing library?
I'm creating my own drawing library in C++ to provide shared rendering code for my projects. Since the library is designed to be used as a component of other projects, the renderer's representation of ...
2votes
6answers
939views
Is it ok to assert on the behavior of return values of a testable class?
So I have a dialog for generating a random password. The user can set min, max, character categories (upper, lower, etc.). What the user basically does is configuring a StringGenerator that does the ...
0votes
5answers
616views
Is it bad to pass builders as constructor arguments?
Note. It's a "spin-off" from my previous question. Not a duplicate — it focuses on a different topic I got to know builders from Bloch's Effective Java. However, I made two changes to his ...
1vote
3answers
418views
Should everything be buildable?
You have some class that performs a certain job public class MyClass { public MyClass() { // ... } // ... } Then, a spec change comes around. The responsibility of the class is the ...