Then post your suggestions. How would you do it then? I think you can't just say something is wrong without explaning WHY.
AreaCalculator is just accepting 'Shape' objects and calculating sum of their areas. What's the problem with it?
The problem with it is that it's simply unnecessary and pointless. The whole work is being done in each class anyway.
@behnampmdg3 // Did you even watch the whole video?
No offense, but it looks like to me that you don't even understand the video. Like I wrote in my previous post, give us your suggestions. How would you do it?
Do you realize that the AreaCalculator is just a helper class? Right? The video was about the Shape objects and their design.
The AreaCalculator can be used in multiple clients when you need to get total areas of multiple shapes. Please don't tell me you think it's better to loop through shape objects and call 'area' everytime you want to calculate the value. Wouldn't it be better to pass an array of shape objects and just get the value?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community