Skip to main content

All Questions

2 votes
4 answers
3k views

I wrote a class with "init" method. Should I call it from other class methods? Or leave it to the object user? (Code Design)

I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...
joker's user avatar
  • 131
0 votes
2 answers
110 views

Logical architecture based on modules and SPI

I'm looking for the most proper way to design a modular application with ServiceLoader. --MAIN IDEA-- module app.view | exports app.view.View interface that defines UI api module app.engine | exports ...
SmallDevice's user avatar
0 votes
3 answers
3k views

DDD - storing and retrieving entities of an aggregate from the outside

In my doctor's appointment booking system, I identified the following entities: Doctor Patient Appointment I also identified an aggregate, which is Doctor (aggregate root) and Appointment. It's an ...
lamb_bd85's user avatar
1 vote
2 answers
122 views

Designing UI module for an application

I have an UI module that will expose only one class - UserInterface. The class will be responsible for collecting user input and providing output (command line UI style). From logical way of thinking, ...
Wiktor's user avatar
  • 33
0 votes
2 answers
743 views

Payment Processor using polymorphism?

I am writing a payment Processor class, then will take different payment objects in input and talks to external services to process payment.My class is designed using polymorphism as follow: public ...
user124's user avatar
  • 111
0 votes
2 answers
890 views

Object Oriented Design for chess

Recently I came across some article on Chess OOPS design.Following is some snippet from it: public class Chess { ChessBoard chessBoard; Player[] player; Player currentPlayer; List<...
rahul sharma'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
1 answer
609 views

Pipeline design pattern and immutability

I'm developing a backend service that is supposed to process items in a pipeline-fashion. Each stage is essentially a Function<IN, OUT>. So the current stage's input is the previous stage's ...
IsaacLevon's user avatar
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
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
-1 votes
1 answer
1k views

Difference between objects and data structures?

So I was reading https://hackernoon.com/objects-vs-data-structures-e380b962c1d2 and I stumbled upon this quote : "A Person data structure has a first name, last name, and phone number. A Person ...
rkk1995's user avatar
  • 109
-5 votes
1 answer
81 views

How to organize the following code in a better way? [closed]

I've a class which performs an operation (say A). I've few logic which has to happen before A happens and few during A happens and few after A has happened. interface ILaunchInterface { public ...
Tom Taylor's user avatar
3 votes
2 answers
1k views

Field variable VS method variable

hey i have a difficult question. class DatabaseHelper { Database db; String defaultShema; public DatabaseHelper(Database db, String defaultSheme) { this.db = db; this....
Robin Kreuzer's user avatar
4 votes
4 answers
4k views

Is Template design pattern a bad practice due to inheritance?

I have been using Template Design pattern in my code for implementing CRUD procedures for different resources. There are some steps which are same for many resources and some which need some addition/...
Siddharth Trikha's user avatar
2 votes
3 answers
320 views

Is this design with globals bad?

I designed a Snakes and Ladders game. I divided into a reasonable amount of classes and I believe I did a good job regarding the OOP design. I have one question about a decision I made for the design,...
laegirl's user avatar
  • 131

15 30 50 per page
1
2 3 4 5
7