dimanche 15 septembre 2019

Design excercise, code should be extended with no changes

I have an exercise to design and implement a system for furniture. Each furniture has different attributes such as manufacturer, type (chair, sofa,) etc. and each furniture has a concrete class, for example RobertoSofa. Each furniture has getAttributes function that returns all of its attributes.

The requirements are:

  1. Use design patterns
  2. If someone in the future will want to add a new attribute there should be no change in the existing code.

My thoughts are using Db for attributes so my code will not change, but is there a design pattern I can use instead?? Thanks!

Aucun commentaire:

Enregistrer un commentaire