I have a class RoomDesign which holds information about the measurements and color of the room for example. I need to be able to render this same information in different ways by a different class. Such as display it graphically with a diagram, or just simple with text. What is the best pattern to use for this kind of design.
Asked
Active
Viewed 469 times
3 Answers
2
You should look into the model-view-controller pattern.
The views would be your renderers (diagram, text etc.) and the model would be your RoomDesign
class or maybe a container for multiple room designs.

Thomas
- 87,414
- 12
- 119
- 157
0
If you view your RoomDesign
as the Model part of Model-View-Controller (MVC), it pretty much speaks for itself. Just keep in mind not to store any purely visual-specific information in your model.

Smutje
- 17,733
- 4
- 24
- 41
0
Build and design a room. Aside from model-view-pattern, you can take a look at Builder pattern. Here's a good SO reference.
An example.

Community
- 1
- 1

Sajal Dutta
- 18,272
- 11
- 52
- 74