I think this is violation of SRP principle. ParkingFloor should just post a notification or something instead of taking the responsibility of updating the display board.
ParkingFloor is now tightly coupled to the Display Board.
Hi @mahendra
If you check the class diagram then most of the classes have more than one function, which means the SRP approach is not followed here.
If we go with your approach and make another class for displayBoard
function, then we have to link it with the parkingFloor
class , as at the end parkingFloor
has to display it. Therefore we kept things simple and added that function in the parkingFloor
class.
If you have still something in your mind, feel free to ask.
Happy learning,