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,719
questions
2
votes
1
answer
221
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 ...
2
votes
2
answers
192
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 ...
2
votes
2
answers
317
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 ...
2
votes
1
answer
123
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 ...
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 ...
3
votes
1
answer
156
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 ...
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 ...
13
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 ...
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 ...
0
votes
1
answer
140
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.
...
2
votes
2
answers
262
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 ...
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 ...
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 ...
0
votes
1
answer
159
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 ...
14
votes
5
answers
5k
views
How to "Tell, don't ask" when 2 objects involves in the condition and the decision at the same time?
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 ...