At first, you got a nicely structured Alloy controller, but as you go on, new features keep getting added, and slowly but surely you end up with a monster. Your XML file might still look okay, but your controller file starts getting hundreds of lines and the end is not in sight.

However, a short gist of how it would work: Then, in your replaceableImage controller: As you can see, the same rule applies to events here as well, add "on" in front of your event name, and upper-case the first character of your event.

Of course, you can also set this property in tss, and in tss you even have to ability to nest data or structure it (with objects), but that is off-topic right now.

The pre-Alloy 1.14 version of the above, or of course when you want to add some logic to things, is to do something like this: In this blog post, I have illustrated a couple of improvements you can do to simplify and clean up your code, without having to restrict yourself in any way.

Related Articles