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.

Filter by
Sorted by
Tagged with
2 votes
3 answers
226 views

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
0 votes
6 answers
291 views

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
3 answers
275 views

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
5 votes
5 answers
977 views

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
3 votes
0 answers
259 views

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
2 votes
5 answers
296 views

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
2 votes
3 answers
998 views

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
2 votes
3 answers
546 views

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
2 votes
6 answers
1k views

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 ...
Sergey Zolotarev's user avatar
1 vote
3 answers
467 views

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 ...
Sergey Zolotarev's user avatar
0 votes
3 answers
178 views

You take a non-testable class with a lot of static dependencies and expose, and expose until they are all explicitly declared in a constructor But halfway through that nice plan, you notice your ...
Sergey Zolotarev's user avatar
1 vote
2 answers
248 views

We have a desktop Swing application. It executes operations against a DB. It could be plain DML, it could be procedures. In both cases, it could result in an error. In that case, we need to display a ...
Sergey Zolotarev's user avatar
1 vote
1 answer
379 views

I am working on two applications that serve the same purpose. The first application is more feature rich and its types are more complex, but uses old technologies and will be retired. It will ...
vicch's user avatar
  • 127
2 votes
2 answers
425 views

Disclaimer: I am learning unit testing. I am also kind of beginner in object-oriented design. Currently, I am involved in the development of an application to manage the finance of a humble food ...
Siva Sankaran's user avatar
6 votes
4 answers
1k views

According to https://softwareengineering.stackexchange.com/a/334994/432039, I know init is a code smell and should be avoided, and one of the solutions is to use a builder to hold the state first ...
wcminipgasker2023's user avatar
3 votes
1 answer
611 views

I want to understand what is considered best-practice to better align with OOP when handling relational databases. I cannot find any online examples where classes and a more maintainable/re-usable ...
Yannis's user avatar
  • 147
24 votes
16 answers
19k views

A getter is a failure to design an object. It violates encapsulation which is a core principle of object oriented programing. Now please tell me, how do you design a libraries hash table collection ...
candied_orange's user avatar
2 votes
2 answers
938 views

In python we use a leading _ to make object attributes implicitly "private". If we want to give people set/get access we can use the @property decorator. Or, if setting/getting is allowed ...
Alexander Soare's user avatar
19 votes
6 answers
9k views

I'm currently writing an MVC application and I need a class that can: A: get, add and remove data(specifically a TreeSet of sorted strings that I want stored in memory, but I doubt the data itself is ...
Tyler Del Rosario's user avatar
14 votes
5 answers
5k views

According to Explanation on how "Tell, Don't Ask" is considered good OO, I know the following is bad: if(a.isX){ a.doY(); } public class A{ public boolean isX; public void ...
wcminipgasker2023's user avatar
-3 votes
1 answer
302 views

Cricket scoring is complex and I want to build an app in part to practice good design principles/patterns and develop a clean solution. A few high level classes I have in mind are: Match | Innings | ...
zadane's user avatar
  • 407
0 votes
1 answer
169 views

Assume we are designing a typical bank account management system. Customers can have one or more accounts. Customers can deposit cash, withdraw cash or transfer money to another account (and, of ...
A. Darwin's user avatar
  • 109
0 votes
1 answer
225 views

I'm working on designing a shopping cart system that respects the single responsibility principle. However, I'm facing a challenge when it comes to handling cart creation and updating separately. ...
Thiago Dias's user avatar
0 votes
4 answers
292 views

There are two ways to provide a way unsubscribe in Observer Design Pattern. 1. Provide a simple void UnSubscribe method: public void UnSubscribe(IObserver observer){ // remove observer from List of ...
SamuraiJack's user avatar
2 votes
5 answers
431 views

I inherited some code that I have spent some time reviewing to get a better handle on its design. There is one class that I came across that I have an idea for refactoring, but I am wondering if it I ...
user1154644's user avatar

1
2 3 4 5
35