This is part of a series of posts to understand Network Automation Principles.
The Principle of Least Astonishment or Principle of Least Surprise describes the contract between the developer and another party such as a user, another developer, or contributor. The principle is based on two underlying rules about code:
To give a few contrived examples:
add_vlan()
should not configure all switchports for that VLAN.switchport trunk allowed vlan add 100
should not remove other VLANs from the port.In your daily life, there are countless examples of how this applies. How navigation bars work, how to exit a program, what a clicked link should look like, etc. When a process does not follow the principle, it often leaves the user confused or frustrated.
Even decades later Windows XP, though dated, is still lauded for it’s design. This is in large part since every application within the system followed the same rules. There was always a single top navigation bar that indicated what the shortcut key was by underlining a letter. Later, Microsoft office would introduce a ribbon in lieu of that standard navigation bar and remove the underline indicator. Individually, you can argue that the new systems are better, but as a whole the user does not have a consistent feel.
View this example, taken from a uxmovement article.
The selected styling on the left does not indicate clearly which is selected, as it does not build on your previous experience, but rather your understanding of the single site’s styling.
While not exactly specific to network automation the read the docs rendering style, which is an implementation of sphinx, has become somewhat of a de facto standard within the industry. In any given instance, I suspect there is a better user experience, but if you are accustom to many of the tools used in network automation such as NetBox, NAPALM, or Ansible and Python libraries such as requests, flask, and netaddr then having a consistent structure and components lowers the barrier to entry and sets expectation for users.
Often times following logical naming conventions in code will lead to following the principle. However, it is worth noting, as you build your systems and integrations to consider how the user generally interact with systems.
-Ken
Share details about yourself & someone from our team will reach out to you ASAP!