Skip to main content
The 2024 Developer Survey results are live! See the results

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 vote
2 answers
127 views

Passing required args of same type to super constructor

Imagine an abstract superclass with several required (and final) properties of the same type How do you pass the args in its subtype safely? This is not safe since you can confuse the order by mistake ...
Sergey Zolotarev's user avatar
1 vote
1 answer
264 views

Mapping complex objects to other similar complex objects

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
231 views

Optimal way to share data between different classes

I have a C++ code that performs simulation of a physical system which deals with motion of objects. It has the following classes: Class Main, containing all the main calculation methods and the data ...
grjj3's user avatar
  • 131
2 votes
2 answers
329 views

In unit testing: How to abstract a dependency of subject under test?

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
2 votes
1 answer
127 views

For N and NBuilder, should N be an instance variable of NBuilder, or all parameters of N be instance variables of NBuilder,finally new N() in build()?

As far as I know about builder pattern, for example, an object, Student: public class Student{ private String name; private int age; //setter and getter } to apply builder pattern to ...
wcminipgasker2023's user avatar
6 votes
4 answers
1k views

How to avoid init methods when 2 objects need the reference of each other?

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
160 views

Seeking Clarification on the Abstract Factory Pattern

I am seeking clarification on the exact purpose and definition of the Abstract Factory pattern. According to the GoF (Gang of Four) book, the intent of the pattern is to: Provide an interface for ...
Codisattva's user avatar
3 votes
1 answer
221 views

Object-oriented programming design with relational database tables

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
14 votes
3 answers
5k views

My use case diagram is a mess. What can I do?

I was asked to build a use case diagram for a case study of a charter boat company. I said that the system will implement a shift away from their use of manual forms into an online booking and payment ...
Ivan's user avatar
  • 249
25 votes
15 answers
18k views

How far can you push Object Oriented Programming?

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
0 votes
1 answer
144 views

Is it good practice for object APIs to be required to be called in sequence to gather information?

I had this discussion with someone and it ended ambiguously. Suppose you have a class that needs to Parse a file to gather some information. It can expose this information to you after the fact. ...
user129393192's user avatar
2 votes
2 answers
267 views

Should private attributes or public attributes be the default in Python classes?

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
1 vote
2 answers
121 views

How do I reduce number of FieldValidator derivations?

I am trying to write RSQL Parser which checks if the RSQL is logically correct. while the RSQL Java library checks whether the RSQL expression is grammatically correct, it doesn't check if the ...
Govinda Sakhare's user avatar
19 votes
6 answers
7k views

Is utilizing a singleton for a cache an antipattern?

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
0 votes
1 answer
160 views

Function objects with no state shouldn't be object oriented? [closed]

My question relates to this topic here: Are classes with only a single (public) method a problem? There I read in the comments often something like that: It is no longer object oriented. Because ...
Robin Kreuzer's user avatar

15 30 50 per page
1
2 3 4 5
115