Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: VO class hierarchy a good idea?  (Read 7320 times)
laczoka
Newbie
*
Posts: 2


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
laczoka
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: February 01, 2009, 12:52:15 »

Thanks for the supportive advice!

Regards,
L
Logged
Pages: [1]
Print