Skip to main content

All Questions

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
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 ...
wcminipgasker2023's user avatar
0 votes
0 answers
98 views

By creating an architecture, it is better to have many classes that handles different scenarios, or a single one that handles all? [duplicate]

During my limited professional experience, I have been involved in microservices projects with a common structure: The Controller takes a request and validates it using the jakarta.validation....
Paul Marcelin Bejan's user avatar
0 votes
1 answer
1k views

Pattern to convert different types of similar unchangeable objects to the same object

I have an existing system that inserts books into a library database, and I want to generalize it to include other media. The other media is similar, but not exactly the same, and all media are third ...
Kee's user avatar
  • 13
0 votes
3 answers
3k views

How to handle a new method in the interface that is not applicable for all classes?

I am faced with an interesting OOD problem: I have an interface with 3 methods: interface TestInterface { String action1(); String action2(); String action3(); } and 3 classes that ...
Zed's user avatar
  • 117
3 votes
4 answers
1k views

Should I implement one interface with two methods or two interfaces?

NOTE: This question is reposted from SO because it violates community guidelines for being opinion-based. I have two classes that are similar in nature but they have different functional signatures. I ...
Tinker's user avatar
  • 155
1 vote
2 answers
385 views

Are experienced developers and software architects able to describe an entire software application in terms of design patterns?

Do experienced developers and software architects see entire application in terms of design patterns? In other words experienced developers and software architects able to describe an entire software ...
user2330678's user avatar
4 votes
7 answers
2k views

When to use a class with a constructor vs using a method returning an object

I've been working in a rather large codebase filled to the brim with small classes such as class Person { public string name; public int age; public int height; } As a mainly front-end ...
FreshOuttaTheBag's user avatar
9 votes
2 answers
2k views

Does OOP overemphasize the importance of noun and thus put action/verb in the less importance position ? [closed]

Steve yegge wrote an article called "Execution in the Kingdom of Nouns" back in 2006, 14 years later I still find the points he made valid. For example, "Action is what gives life its ...
Qiulang 邱朗's user avatar
1 vote
3 answers
757 views

Design with subclasses being aggregates of classes implementing interfaces

I have modelled a class structure, where subclasses Rectangle and Circle inherit from an abstract superclass Figure. All subclasses share an interface IGeometry that provides for getArea() and ...
kiloton's user avatar
  • 29
0 votes
1 answer
510 views

Extension of classes - Where to put behaviour - How much direct-access is allowed

At this point i would exclude the inheritance.... So the question is about more like extend into a seperate class or into the class which should be extended, both play in the composition-league. So ...
Robin Kreuzer's user avatar
1 vote
3 answers
684 views

Best way to Model Classes associated with other Classes?

I'm trying to make a sports stats app in Java/Android + Realm. I have the following classes: Season Player Matches I would like the Season to contain a "list" of all the players that played that ...
musicalears's user avatar
3 votes
4 answers
2k views

De-coupling business logic from POJO de-serialization design pattern

I've a JSON file which I'm trying to de-serialize into POJOs. public abstract BaseClass { private String baseClassField; abstract String execute(); } ClassA extends BaseClass public ClassA ...
user1692342's user avatar
1 vote
1 answer
476 views

Design Chess - Object Oriented Design

I am trying to design online chess game(figuring out required classes). Need some suggestion on choosing better option to validate the move. So, lets say, I have below class Option 1 : My ...
Jeevi's user avatar
  • 159
-2 votes
1 answer
1k views

Pass ID or Object which has irrelavant details as RequestBody in Rest Call?

Situation: I am designing a REST API that needs one or more, potentially large objects to do it's work I am facing a decision to either Pass the large object by reference and have the API retrieve ...
john's user avatar
  • 109

15 30 50 per page
1
2 3 4 5