You are on page 1of 5

Six Exception handling

Try - Marks the protected block, where an exception may occur


Throwable - is the superclass of all exceptions
Exception - An exception is a program execution event that must not or cannot be
handled in normal control flow
Throw - actually raises the exception
Throws - identifies the list of exceptions that can be thrown
Catch - Exception handler

Static Variables

A C functions local variable can remember its value from one invocation to the next, if it
is designated static.

Fortran calls it save; Algol calls it own.

C clears the static variable upon the owning functions first invocation.

A static variable is invisible outside the function, so its data abstraction exceeds global
variables.

A static variable obviously cannot be changed outside the function, because it is invisible
there.

Unbounded for Loop

Cs for is an unbounded iterator, because its body can change its expressions:
for (i = initial; i <= final; i += step) { body }

The first expression is initially evaluated. The body executes only once, if the last
expression is zero. Otherwise, it repeatedly executes the last expression, while the middle
expression is true.

Cs for is an abbreviation of:


i = initial;
while (i <= final) {body; i += step;}

Imperative Language

Inspired by computer hardware architectures.


Got environment functions.
Got memory functions.

Declarative Language

Functional; e.g., LISP


Logic programming; e.g., Prolog
Like the language of mathematics and abstract logic.
Stateless.
Got environments.
(Almost) no memory functions.

Postfix

The postfix or reverse Polish notation puts the operator after its operands, also without
parentheses; e.g., the infix expression (a + b) * (c + d) translates into a b + c d + * .

Programmable Hewlett-Packard calculators use reverse Polish notation.

In both Polish notations, one operator can apply to any number of operands.

Polish also is easier for computers to evaluate.

Heap

Blocks grow according to the Fibonacci series; i.e., slower than powers of 2.
This offers less internal fragmentation than the buddy system.

Static Chain Pointer

When a called function is declared inside the calling function (e.g., fcnB inside fcnA), the
called functions (Bs) static chain pointer must point at the callers (As) activation
record.

When a called function is declared outside the calling function (e.g., fcnB outside fcnE),
the caller (E) calculates the called procedures (Bs) static chain pointer by dereferencing
its own static chain pointer a number of times equal to their nested separation.

Dynamic Chain Pointer

Variables current values can be stored in the stacks activation records.

Or LISP stores them in an association (linked) list for each environment. Each branch is
labeled with a variable name, and its leaves include type, location, active/inactive flag.

Definitions
1. Representational gap: Lowered by object and operation names echoing requirements.
2.
3.
4.
5.
6.

Visibility: Wherever an objects declared value can be seen.


Scoping rules: How coders predict where an objects declared value can be seen.
Aliases: Multiple pointer names referring to a single object.
Parameter: An object possibly renamed inside a function.
Language layers: Programming languages whose abstraction increases as they range
farther away from the computer hardware.
7. Operation: An O-O method (verb).
8. Physical machine: Computer hardware and firmware.
9. Object: An O-O data item (noun).
10. Abstract requirements: Generally written in natural language -- prototype demos are
better.
11. Pointers: Locations of command sequences or data in memory.
12. Data abstraction: Programmers hiding language developers actual objects by changing
their names to nouns in the customers requirements.
13. Primitive operations: Programming languages operations, whose names are reserved
words, system functions or symbols.
14. Control abstraction: Programmers hiding language developers actual operations by
changing their names to verbs in the customers requirements
15. Declaration: Code segments in which programmers or language writers abstract names
are associated with memory locations.
16. Names: Code segments in which programmers or language writers abstract names are
associated with memory locations.
17. Environments: Code segments in which programmers or language writers abstract
names are associated with memory locations.
18. Naming: declaring an objects label upon block entry.
19. Object creation: allocating objects memory at runtime.
20. Reference: invoking, assigning or using an object by name.
21. Deactivation: preventing references to external objects.
22. Reactivation: enabling references to external objects.
23. Unnaming: destruction of an internal name upon block exit.
24. Object access: coding an abstract name reads data from memory.
25. Object modification: assigning abstract name stores data in memory.
26. Object destruction: deallocating objects memory at runtime.
27. Object lifetime: object passed by value outlives assocn & dealloc.
28. Dangling reference: deallocating an object passed by reference.

Object Name Binding

When the language is designed (+ binds to add ()).


When coder writes program (partial binding).
At compile time (relative memory addressing).
At daily build (absolute addresses, O.S. service calls).
At runtime (all dynamic allocations--all static allocations occur earlier).

Fourteen Definitions
1. Undecidability: Many important properties of programs cannot be discovered
automatically by an algorithm.
2. Computability: We can be sure a function is computable, when we see a program
compute it.
3. Partiality: A function can be defined for some but not all possible arguments.
4. Turing completeness: All functions that can be computed by other programming
languages also can be computed by the ultimately simple Turing Machine.
5. The halting problem: A static semantic analyzer cannot discover an infinite loop that
depends upon user input.
6. Programming languages expressive power: Flexibility of use, pragmatics and
abstraction principles.
7. Existing languages equivalence: Every programming language can be interpreted into
every other.
8. Turings finite state machine: A controller that reads programs and data from a paper
tape and overwrites the tape with intermediate results and the programs ultimate outputs.
9. More functions than algorithms: We Software Engineers will never run out of problems
to solve.
10. Churchs thesis: We probably never will discover an intuitively computable function that
is not programmable.
11. Static semantic analyzer: A program that checks code against programming standards,
which have been shown to prevent errors.
12. Dynamic semantic analyzer: A program that exposes runtime errors by executing code
in a controlled testing environment.
13. Pragmatic test engineers: Artists who derive test cases from customer requirements,
which anticipate all operational modes.
14. Software testing as art: Every combination of inputs cannot be tested, so a few benign
errors remain in every software product.

Grammar: A set of correct phrases.

Lexical G.a finite alphabet and all correctly spelled words.


Syntaxcorrect phrases comprised of words.
For example, an easy-to-read recipe for cooking squash.
Semantics: The singular meaning (significance) of each correct phrase.

A (dictionary or thesaurus) mapping from a little known word or phrase to commonly


known words and phrases.
A mapping from a program to the mathematical function(s) that the program represents.
For example, an understandable definition of the word recipe.
Pragmatics: The many effective ways in which programmers can use correct sentences
comprised of correct phrases.
For example, an author may guess how cooks will use her recipe.
Implementation: Software and procedural language designers create processes that change
states and data.

For example, a recipe process that transforms raw squash into food.

Compiler: Microprogram that executes instructions one at a time.


Interpreter: Machine-specific binary code that hardware executes directly.

You might also like