Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Readability Control Statements - Programming Languages - Lecture Slides, Slides of Programming Languages

Readability Control Statements, Readability Syntax, Variable names, Writability, Support for abstraction, Expressivity, Orthogonality, Type Checking, Exception handling are key points of this lecture. Programming languages is basic subject of computer science. Its not about any specific language but almost cover all of them.

Typology: Slides

2011/2012

Uploaded on 11/10/2012

omni
omni 🇮🇳

4.6

(9)

46 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Readability - Control Statements
Hazards of goto
Restricted use was needed and useful as
well
Probably not an issue any more
Docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Readability Control Statements - Programming Languages - Lecture Slides and more Slides Programming Languages in PDF only on Docsity!

Readability - Control Statements

  • Hazards of goto
  • Restricted use was needed and useful as

well

  • Probably not an issue any more

Readability - Syntax

  • Variable names
  • Special keywords for signaling the start and end of key words.

if (some condition) do this now do this

if (some condition) then do this end if now do this

Writability

  • Support for abstraction
  • Expressivity
    • Constructs that make it convenient to write programs e.g. for set data type in Pascal we do not have an equivalent in C

Orthogonality

  • Relatively small number of components that can be combined in a relatively small number of ways to get the desired results.
  • Closely associated with simplicity
  • The more orthogonal the design the fewer exceptions - makes it easier to learn, read, and write
  • The meaning of an orthogonal feature is independent of the context – symmetry and consistency. - e.g. pointers

Orthogonality

  • C
    • You can return structures but not arrays
    • An array can be returned if it is inside a structure
    • A member of a structure can be any data type except void or the structure of the same type
    • An array element can be any data type except void
    • Everything is passed by value except arrays
    • Pointer arithmetic
      • a+5 means what?
      • a + b
    • Use of void as a type in a structure

Orthogonality

The Other side

  • In C – all statements return some value

and hence can be used in expressions.

  • Logic and arithmetic expressions can be intermixed
  • Can cause side effects
  • Can cause cryptic code
  • A[i] , i[A]
  • Since languages need large number of

components, too much orthogonality can cause problems.