I am having a little design crisis, I am making a Plane class, which is made of
an engine
2 wings
and N seats
The engine takes in a engine size, and the wings have a span.
would this still be feasible to have a PlaneFactory, when the factory may have to take in multiple parameters to setup the plane (wings, engine, no of seats)
thanks in advance
bones
if your plane object is turning into a complex one you could use builder design pattern to create the object part by part
you can easily apply the famous pizza example found in wikipedia on your problem , the builder class will have methods like build wings , build engine …. and finally getplane().
you can have different builder classes that implement the abstract builder class , each builder creates a different plane (using different components)