Title: VO class hierarchy a good idea? Post by: laczoka on January 29, 2009, 10:39:32 Hi,
I’m developing a graphical editor using PureMVC in which one can create “pages’ with different kind of “page items”. These page items share some properties like position, dimension. I simply created a concrete VO class for each of them which hold the properties of them. Similarly, there is a corresponding VC for each page item which renders its visual appearance based on the current property values. In the course of implementation every time I added an object it involved a lot of repetitive coding. (VO, Proxy, Meditator…) and I had a gut feeling that if my domain model could mirror the shared properties than I could have saved myself a lot of boring coding. I figured that this would involve building an inheritance hierarchy instead of having concrete VOs. So I would have PageItemVO abstract class with (x,y,width,height) and ButtonVO that extends PageItemVO and adds the “label” property. This approach would make a dozen of Mediators unnecessary since some of them are only interested in position and dimension properties. Would this be a viable approach? It just sound weird to me since all application I had a chance to look at used simple, concrete VO classes. Any suggestion, comment is highly appreciated. Thx, Laszlo Title: Re: VO class hierarchy a good idea? Post by: puremvc on January 30, 2009, 07:38:50 Sure, its appropriate to inherit these props that are common to all yor VOs. Or you could do it by composition, and have a PositionVO that the PageItemVOs have as a complex property.
-=Cliff> Title: Re: VO class hierarchy a good idea? Post by: laczoka on February 01, 2009, 12:52:15 Thanks for the supportive advice!
Regards, L |