Customizing Object Names

Customizing Object Names

Squish has been using a set of property->value tuples for a while now to identify an object. For instance, to name an object of type ‘Label’ with the text ‘Hello World’, you might have something like:

{type='Label' text='Hello World'}

One inherent problem with this is that it’s hard to decide on the set of properties to use for identifying an object. In particular you want object names to be

  • Unambiguous; there mustn’t be more than one object in the
    application which matches the given set of property->value pairs.
  • Minimal; you don’t want to have more properties in your object name than necessary, so that you maximize the robustness.

It’s very hard for Squish to fulfill both requirements, since Squish has no knowledge of how your application is built: which properties can be used to identify an object, and which shouldn’t (because they are likely to change, for instance).

Fortunately, with Squish 3.2, you will be able to change this. For each Squish edition, there will be a corresponding XML file which describes which properties shall be used for generating the real (the ‘{..}’) name and the symbolic name (the one starting with ‘:’) for a given type. Squish will come with a default configuration of course, but if you know that e.g. using the ‘id=’ attribute in object names for your Web application isn’t a good idea because those id’s have rather volatile values, then you can edit the corresponding XML file and tell Squish not to use the ‘id’ attribute.

I’m currently implementing this for all our editions, and I’m sure it’s going to be very useful for many of our customers (and for ourselves, too: we are able to throw away a lot of code which becomes obsolete with this system!).


Leave a reply

电子邮件地址不会被公开。 必填项已用*标注