Creating Easy-to-Read Alloy Models
Oftentimes, Alloy models can become unreadable due to parameter structures. Learn how to enhance readability by considering atomic values as the first parameter and by changing parameter order. Explore examples and best practices for creating clear and concise Alloy models.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
How to create easy-to-read Alloy models Roger L. Costello March 24, 2018
Not Readable Oftentimes a pred or fun has two parameters, e.g., pred logsOnAs[c1, c2 : Customer] { } Let Eve and Alice be two Customers. Then the pred may be called this way: logsOnAs[Eve, Alice] Ugh! That s not readable.
Is Readable If the first parameter is an atomic value (not a set value), then the pred (or fun) can be called by: first_parameter.pred_name[second_parameter] Eve logs on as Alice can be called by: Eve.logsOnAs[Alice] That is highly readable!
Not Readable This pred is called to cut an icon from a desktop: pred cut [desktop: Desktop, icon: Icon] { } Here s how it is called, using the approach two slides back: desktop.cut[icon] Ugh! That s not readable.
Is Readable Change the order of the parameters. Change the name of pred: pred cutFrom [icon: Icon, desktop: Desktop] { } icon is cut from desktop can be called by: icon.cutFrom[desktop] That is highly readable!