Secondary notation

Last updated

Secondary notation is the set of visual cues used to improve the readability of a formal notation. Examples of secondary notation include the syntax highlighting of computer source code, sizes and color codes for easy recognition of consumer symbols such as bank notes or coins, or the regular typographic conventions often found in technical books to highlight sections with the same type of content.

Contents

Secondary notation provides redundant (more than necessary) information; if the visual cues are the only way that some information is provided, such as in traffic lights, or a chart's key, it is not secondary. Secondary notation is often not a part of the formal notation itself. Rather, it is a method of organizing the formal notation to allow it to be more easily understood. Thus, secondary notation does not change the actual meaning of the formal notation, rather it allows for the meaning to be readily understood. In text such as programming languages, this can be done using cues such as indentation and coloring. In formal graphical notations, this can be done through the use of symmetry or proximity to indicate relatedness.

In different contexts

Secondary notation annotates formal notation in a number of contexts which can be broken down to two main domains: text and graphics.

Textual context

There are a number of common instances of secondary notation that are seen in text. Secondary notation is common in typography and in code editors appearing as boldness, italics, and spacing/indentation.

Textual secondary notation in computer source code

Secondary notation in the form of coloring and indentation is commonly implemented in integrated development environments to make source code more readable and make the formal notation more understandable. The following C source code does not use secondary notation to ease the interpretation of the formal notation:

int main(){while(true){printf("I'm stuck in an infinite loop!");}}

The following is the same code, but with indentation and syntax highlighting. As a result, the formal notation of C is easier to read:

intmain(){while(true){printf("I'm stuck in an infinite loop!");}}

Textual secondary notation in typography

A number of examples of secondary notation that commonly appear in English writing include

  • Boldness which is used to put emphasis on a certain area of text.
  • Italics which is another method of applying emphasis on a certain area of text.
  • The following example effectively uses indentation to separate items on a shopping list that must be bought at different stores. Indented items all must be bought at the store within which the items are nested.
1. Allison's Frozen Foods  -Frozen Tuna -Chicken patties -Fish sticks -2lb of hamburgers 2. Sarah's Groceries -3 boxes of cereal -2 boxes of fruit juice -2 dozen eggs  3. Jim's Formal Wear -2 dress shirts -1 orange tie 

Graphical context

Secondary notation is commonly used in graphical contexts to better convey information beyond what the formal notation of the graphic makes explicit.

Flowcharts

This is a well drawn model of the steps a user would take to place an order for some products on a website. Well drawn process model (vertically oriented).png
This is a well drawn model of the steps a user would take to place an order for some products on a website.
This is a poorly drawn model of the steps a user would take to place an order for some products on a website. Poorly drawn process model of ordering from a website.png
This is a poorly drawn model of the steps a user would take to place an order for some products on a website.

A graphical representation that has been well studied and can be heavily impacted by secondary notation is a flowchart and especially drakon-charts. Research has shown that there are a number of layout factors unincorporated into the formal notation that impact a flowchart's ease of understanding:

  1. Minimize arc crossings: the number of times lines cross should be kept to a minimum to ease traceability. In drakon-charts all the arc (line) crossings are forbidden.
  2. Minimize line bends: additional bends add to the visual complexity of the model. In drakon-charts all the line bends are minimized.
  3. Leverage symmetry: position elements symmetrically when possible
  4. Align labels horizontally: textual labels are easier to read when aligned horizontally
  5. Use of locality: group related items together to be easily recognizable

The examples on the right show how these techniques can drastically affect the ease of understanding when looking at a process model. The model depicts a simplified process for ordering products from a website. Both diagrams contain exactly the same blocks with the same interconnections. However, the one that uses better secondary notation can be readily understood whereas the other model requires careful analysis to understand its contents.

Misuse

While inadequate use of secondary notation can significantly increase the amount of effort necessary to understand a model, misuse of secondary notation can also be a detriment. Use of symmetry can make a graphic more visually appealing, but can also convey misconceptions if used incorrectly. For instance, placing unrelated items close together may cause a reader to perceive them as being related. Additionally, arbitrary use of coloring may distract a reader as they wonder about the meanings of the various colors.

Experts vs. novices

The ability of individuals to understand and use secondary notation has been shown[ citation needed ] to vary based on experience within the relevant field. Experts in a field are generally more able to utilize the clues provided by secondary notation. Specifically, while reading diagrams, experts have been shown to have more skill at reading the larger structure of the diagram and using it to guide their examination of the details provided by the formal notation. This compares to novices who often focus on the details of the formal notation, ignoring the hints provided by the secondary notation.

There are also differences based on level of experience/expertise when creating documents that utilize secondary notation. Experts tend to be more consistent in their use of conventions while novices tend to vary between conventions, sometimes adhering on a surface level, but failing to convey the desired information. In the case of circuit diagrams, this is illustrated by common novice mistakes such as creating visual symmetry where there is no logical symmetry and frequent transitions between differing secondary notation conventions.

As part of formal notation

In some cases, secondary notation is part of the formal notation. Such formal notations attempt to improve readability by enforcing the presence of visual cues. The trade-off is that, what in many other cases is only secondary notation (like, for example, indentation in free-form languages), is now part of the formal notation, and thus is not optional.

For example, the Python programming language requires source code to follow strict indentation rules. This is intended to improve readability of the code, by ensuring that statements that are at the same level of nesting within a block are aligned to the same column. Other types of secondary notation, however, are not part of the formal notation. [1] For example, when wrapping long lines, every line that is a continuation of a previous line can be indented arbitrarily. [2]

ifx==1:print("x is 1")print("x is odd")print("This is always printed")# this is illegalprint("Hello world")str=" ".join("these words are indented","for better readability")

Markdown also uses indentation as part of the formal syntax of the language. Indentation is required in Markdown when creating certain source code representations of block quotations as well as when creating sections of source code to be rendered as the code itself. [3]

#Heading 1#       #Indented Markdown source code that will be rendered as source code#   

See also

Notes

  1. "Python: Myths about Indentation". www.secnetix.de. Retrieved 2017-05-22.
  2. "PEP 8 -- Style Guide for Python Code". www.python.org. Retrieved 2017-05-22.
  3. Gruber, John (2015-04-19). "Markdown Syntax". Daring Fireball. Retrieved 2015-04-19.

Related Research Articles

Computer programming is the process of performing particular computations, usually by designing and building executable computer programs. Programming involves tasks such as analysis, generating algorithms, profiling algorithms' accuracy and resource consumption, and the implementation of algorithms. The source code of a program is written in one or more languages that are intelligible to programmers, rather than machine code, which is directly executed by the central processing unit. To produce machine code, the source code must either be compiled or transpiled. Compiling takes the source code from a low-level programming language and converts it into machine code. Transpiling on the other hand, takes the source-code from a high-level programming language and converts it into bytecode. This is interpreted into machine code. The purpose of programming is to find a sequence of instructions that will automate the performance of a task on a computer, often for solving a given problem. Proficient programming thus usually requires expertise in several different subjects, including knowledge of the application domain, specialized algorithms, and formal logic.

In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages with informal, usually self-explanatory, notation of actions and conditions. Although pseudocode shares features with regular programming languages, it is intended for human reading rather than machine control. Pseudocode typically omits details that are essential for machine understanding of the algorithm, such as variable declarations and language-specific code. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications to document algorithms and in planning of software and other algorithms.

Programming style, also known as code style, is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers read and understand source code conforming to the style, and help to avoid introducing errors.

In computer programming, an indentation style is a convention governing the indentation of blocks of code to convey program structure. This article largely addresses the free-form languages, such as C and its descendants, but can be applied to most other programming languages, where whitespace is otherwise insignificant. Indentation style is only one aspect of programming style.

YAML(see § History and name) is a human-readable data serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from Standard Generalized Markup Language (SGML). It uses both Python-style indentation to indicate nesting, and a more compact format that uses [...] for lists and {...} for maps but forbids tab characters to use as indentation thus only some JSON files are valid YAML 1.2.

A modeling language is any artificial language that can be used to express data, information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in the structure Programing language.

<span class="mw-page-title-main">Visual programming language</span> Programming language written graphically by a user

In computing, a visual programming language or block coding is a programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually. A VPL allows programming with visual expressions, spatial arrangements of text and graphic symbols, used either as elements of syntax or secondary notation. For example, many VPLs are based on the idea of "boxes and arrows", where boxes or other screen objects are treated as entities, connected by arrows, lines or arcs which represent relations.

<span class="mw-page-title-main">Code folding</span> Tool of editors for programming, scripting and markup

Code or text folding, or less commonly holophrasting, is a feature of some graphical user interfaces that allows the user to selectively hide ("fold") or display ("unfold") parts of a document. This allows the user to manage large amounts of text while viewing only those subsections that are currently of interest. It is typically used with documents which have a natural tree structure consisting of nested elements. Other names for these features include expand and collapse, code hiding, and outlining. In Microsoft Word, the feature is called "collapsible outlining".

A computer programming language is said to adhere to the off-side rule of syntax if blocks in that language are expressed by their indentation. The term was coined by Peter Landin, possibly as a pun on the offside rule in association football. This is contrasted with free-form languages, notably curly-bracket programming languages, where indentation has no computational meaning and indent style is only a matter of coding conventions and formatting. Off-side-rule languages are also described as having significant indentation.

A lightweight markup language (LML), also termed a simple or humane markup language, is a markup language with simple, unobtrusive syntax. It is designed to be easy to write using any generic text editor and easy to read in its raw form. Lightweight markup languages are used in applications where it may be necessary to read the raw document as well as the final rendered output.

<span class="mw-page-title-main">Markdown</span> Plain text markup language

Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber created Markdown in 2004 as a markup language that is easy to read in its source code form. Markdown is widely used for blogging and instant messaging, and also used elsewhere in online forums, collaborative software, documentation pages, and readme files.

<span class="mw-page-title-main">Python syntax and semantics</span> Set of rules defining correctly structured programs

The syntax of the Python programming language is the set of rules that defines how a Python program will be written and interpreted. The Python language has many similarities to Perl, C, and Java. However, there are some definite differences between the languages. It supports multiple programming paradigms, including structured, object-oriented programming, and functional programming, and boasts a dynamic type system and automatic memory management.

This comparison of programming languages compares the features of language syntax (format) for over 50 computer programming languages.

Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices, and methods for each aspect of a program written in that language. These conventions usually cover file organization, indentation, comments, declarations, statements, white space, naming conventions, programming practices, programming principles, programming rules of thumb, architectural best practices, etc. These are guidelines for software structural quality. Software programmers are highly recommended to follow these guidelines to help improve the readability of their source code and make software maintenance easier. Coding conventions are only applicable to the human maintainers and peer reviewers of a software project. Conventions may be formalized in a documented set of rules that an entire team or company follows, or may be as informal as the habitual coding practices of an individual. Coding conventions are not enforced by compilers.

<span class="mw-page-title-main">Comment (computer programming)</span> Explanatory note in the source code of a computer program

In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters. The syntax of comments in various programming languages varies considerably.

<span class="mw-page-title-main">DRAKON</span> Algorithm mapping tool

DRAKON is a free and open source algorithmic visual programming and modeling language developed as part of the defunct Soviet Union Buran space program in 1986 following the need in increase of software development productivity. The visual language provides a uniform way to represent processes in flowcharts.

<span class="mw-page-title-main">Diagrammatic reasoning</span>

Diagrammatic reasoning is reasoning by means of visual representations. The study of diagrammatic reasoning is about the understanding of concepts and ideas, visualized with the use of diagrams and imagery instead of by linguistic or algebraic means.

Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.

<span class="mw-page-title-main">ERIL</span> Visual language for representing the data structure of a computer system

ERIL is a visual language for representing the data structure of a computer system. As its name suggests, ERIL is based on entity-relationship diagrams and class diagrams. ERIL combines the relational and object-oriented approaches to data modeling.

<span class="mw-page-title-main">PlantUML</span> Open-source software tool

PlantUML is an open-source tool allowing users to create diagrams from a plain text language. Besides various UML diagrams, PlantUML has support for various other software development related formats, as well as visualisation of JSON and YAML files.

References