Support the ongoing development of Laravel.io →
Architecture
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

The problem with it is that it's simply unnecessary and pointless. The whole work is being done in each class anyway.

Last updated 2 years ago.
0

@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?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.