![]() |
Mandatory properties and Object properties |
Post Reply
|
| Author | |
vladimir
Member
Joined: 17.Feb.2012 Points: 2 |
Post Options
Thanks(0)
Quote Reply
Topic: Mandatory properties and Object propertiesPosted: 17.Feb.2012 at 11:10 |
|
Hi,
I'm new to MetaEdit+. I have been working with it for several days now and I have two questions. First: can I make some object's properties mandatory? I need to define some of them to be mandatory so when someone wants to place them on the graph he must first enter all of the object's mandatory properties. Second: lets say I have hierarchy of objects. One parent and three child objects inheriting the parent. I need to have one property in another object that can be of type of some of those child objects but not the parent itself. So when I set the property to be of parents datatype, although child objects can be set here, the parent object can be set to. How can I solve this problem? Thanks in advance for any help. Best regards, Vladimir |
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 17.Feb.2012 at 11:32 |
|
Hi Vladimir - welcome to MetaEdit+ and the forum!
You can make properties mandatory by defining a regular expression for them, e.g. .+ would require a property to be non-empty. Just fill the regular expression in to the Property Tool's Value Regex field. However, be careful not to be too strict - as Postel's Law indicates, try to accept any input. Where possible, make your generators cope with empty values by outputting suitable defaults. This reduces the work the modeler needs to do, and reduces the amount of information other modelers need to read. Convention over configuration! (BTW, being too strict is just one of the 20 anti-patterns mentioned in the IEEE Software article on Worst Practices for DSM, based on experience over 76 cases.) If you want to allow only some types in a hierarchy to be instantiable, make the other types abstract by changing their name to start with an underscore, _. Hope this helps, Steve Edited by stevek - 17.Feb.2012 at 11:34 |
|
![]() |
|
vladimir
Member
Joined: 17.Feb.2012 Points: 2 |
Post Options
Thanks(0)
Quote Reply
Posted: 17.Feb.2012 at 19:15 |
|
Steve,
Thank you for your quick and very comprehensive answer. Those directions helped me a lot. Best regards, Vladimir |
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |