Question | Answer |
Why study programming languages? | 1. Increased capacity to express ideas 2. Increase tools in toolbox -- increased knowledge of choosing the appropriate language 3. Increased ability to learn new languages |
Readability | The ease with which programs can be read and understood. Depends on four factors: 1. Simplicity 2. Orthogonality 3. Data types 4. Syntax Design |
Simplicity | The more basic constructs a language has, the more difficult it is to learn. Feature multiplicity: having more than one way to accomplish a particular operation. (Can increase confusion) Operator overloading: when a single operator symbol has more than one meaning. (Reduces readability if users can create their own overloading) Oversimplifying: causes of lack of control statements, harder to read (i.e. assembly language). |
Orthogonality | A relatively small set of primitive constructs can be combined in a relatively small number of ways to build the control and data structures of a language. If changing "A" does not change "B". The more orthogonal the language is, the fewer exceptions the language rules require, and a higher degree of regularity makes the language easier to understand. Too much orthogonality: creates unnecessary complexities -- a large number of primitives results in a large number of possible combinations. |
Data Types | The presence of adequate facilities for defining data types and structures aids readability. i.e. boolean flag = true, is easier to understand than flag = 1. |
Syntax Design | Special words: the fewer reserved words, the greater the readability. Use of special words can diminish readability if special words are allowed to be used as names for program variables. Form and meaning: when semantics (meaning) does not follow directly from syntax (form), it will be harder to read. (i.e. when two language constructs appear the same, but have 2 different meanings like reserved word "static" in C) |
Writability | A measure of how easily a language can be used to create programs for a chosen problem domain. Factors affecting writability include: 1. Simplicity and Orthogonality 2. Expressivity |
Expressivity | A set of relatively convenient ways of specifying operations In C, the notation count++ is more convenient to write than count = count + 1 |
Reliability | A reliable program is one that performs to its specifications under all conditions. Factors that affect reliability: 1. Type Checking 2. Exception Handling 3. Aliasing 4. Readability and Writability |
Type Checking | Testing for type errors in a given program, either by the compiler or during run-time. Run-time type checking is expensive. Compile-time checking is more desirable. The earlier a problem is detected, the better. |
Exception Handling | The ability of a program to intercept run-time errors (and other unusual conditions), take corrective measures, and then continue on. |
Aliasing | Having two or more distinct names in a program that can be used to access the same memory cell. Ex. When two pointers are set to point to the same variable. |
Cost | 1. Cost of training programmers 2. Cost of writing programs in the language 3. Cost of executing programs written in a language (optimization alleviates this cost) 4. Cost of poor reliability 5. Cost of maintenance |
Portability | The ease with which programs can be moved from one implementation to another. Ex. Java programs owed to Java Virtual Machines being free and easy to download |
Want to create your own Flashcards for free with GoConqr? Learn more.