2

I wonder if I have multiple objects and how to list their responsibilities where

every Object Must be Responsible for Itself

for example: If I have three objects:

Employee,Schedule,Shift.

and the setShift(), createShedule(),....etc


Where should these behaviors belong to ? in the Employee or in the objects which affected by these actions!!

It's very confusing because I ended up that most of the methods belong to one object in my case Employee! It turns to like a god/master object.

Anyname Donotcare
  • 1,374
  • 2
  • 16
  • 29

1 Answers1

4

I think you missed a domain object. The scheduler.

dayShift.setShift("7am","3pm");
shifts.add(dayShift);
Schedule schedule = evenHoursScheduler.createSchedule(shifts, employees);

Not every domain object is an object you can point to in the real world. Sometimes it's a role to be played.

Robbie Dee
  • 9,815
  • 2
  • 24
  • 53
candied_orange
  • 108,538