black626 / Launchcode-Projects

Launchcode Projects
1 stars 0 forks source link

Pyramid factory #4

Open mpmenne opened 5 years ago

mpmenne commented 5 years ago

Great job using StringBuilder for your Pyramid! I like how you initialized it in the constructor.

One suggestion for your Pyramid class. Break it out into two separate classes. Create a Pyramid object that you can pass around and create a PyramidFactory that allows you to generate pyramids. Also, consider passing in the size of the pyramid to the constructor. Immutable objects are always preferred to mutable objects. If you ever need a new pyramid, you can just generate a new one without changing your existing pyramid.

black626 commented 5 years ago

Thanks Mike!

I went ahead and implemented the factory to handle instantiation and Pyramid objects. Thanks for the reminder on immutable vs mutable objects as well, memory wastes end up adding up real quick, especially on mobile devices.