1 / 10

A Few Key Ideas

A Few Key Ideas. No particular language is a prerequisite for this course However you should be proficient in at least one language A working knowledge of C++ is worth pursuing as you go We’ll work on many paradigms in C++ “How we communicate influences how we think and vice versa.”

dmarian
Télécharger la présentation

A Few Key Ideas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Few Key Ideas • No particular language is a prerequisite for this course • However you should be proficient in at least one language • A working knowledge of C++ is worth pursuing as you go • We’ll work on many paradigms in C++ • “How we communicate influences how we think and vice versa.” • [Louden and Lambert 3rd Ed. pp. 2] • “Similarly, how we program computers influences how we think about computation, and vice versa.” • [Louden and Lambert 3rd Ed. pp. 2]

  2. Abstraction in Programming LD R1 FIRST • Von Neumann Architecture • Program instructions and data are stored in a memory area • CPU executes a sequence of instructions • Machine instruction sets: lowest level of abstraction • Binary representation that the CPU can process • Or that a virtual machine can process (e.g., byte code) • Assembly language is only slightly more abstract • “Readable” labels: operations, registers, location addresses 0010 001 000000100 (opcode) (register) (location)

  3. Evolving to Higher Levels of Abstraction • Algebraic notation and floating point numbers • E.g., Fortran (John Backus) • Structured abstractions and machine independence • E.g., ALGOL (a committee), Pascal (Niklaus Wirth) • Architecture independence (on beyond Von Neumann) • E.g., based on Lambda Calculus (Alonzo Church) • E.g., Lisp (John McCarthy)

  4. Data Abstraction • Basic abstractions • Variables, data types, declarations • Structured abstractions • Data structures, arrays • Unit abstractions • Abstract data types (ADTs), classes, packages, namespaces • Key ideas • Information hiding, modularity, reusability, interoperability

  5. Control Abstraction • Basic abstractions • Algebraic statements, “syntactic sugar” • Structured abstractions • Loops, branch instructions • Procedures, iterators, cursors, manipulators, etc. • Unit abstractions • ADTs, classes, packages, namespaces (same as for data!) • Key ideas • Selection, iteration, formal/actual parameters, composition

  6. Some Programming Paradigms • Imperative/procedural (E.g., C, C++) • Variables, assignment, other operators • Functional (E.g., Lisp, Scheme, ML, Haskell, C++) • Abstract notion of a function, based on lambda calculus • Logic (E.g., Prolog, but can develop structures in C++) • Based on symbolic logic (e.g., predicate calculus) • Object-oriented (E.g., Java, Python, C++) • Based on encapsulation of data and control together • Generic (E.g., C++ and especially its standard library) • Based on type abstraction and enforcement mechanisms • We’ll cover informally via examples throughout the semester

  7. Language Definition • Syntax • Lexical structure, tokens, grammars (E.g., BNF) • Basic semantics • Informal description, may be incomplete • Formal semantics • Operational semantics (execution specification) • Denotational semantics (specification as functions) • Axiomatic semantics (assertions about program state)

  8. Language Design • Goals (potentially conflicting) • Efficiency of coding or execution, writability, expressiveness • Specific design criteria • Regularity (how well language features are integrated) • Generality (how few cases have to be handled specially) • Orthogonality (how widely features still behave the same) • Uniformity (consistent appearance/behavior across features) • Safety or “security” (how difficult it is to produce errors) • Extensibility (how easy and effective is feature addition)

  9. Comparing Programming Languages • Different languages usually have different goals • E.g., C++ focuses on expressiveness and efficiency of execution, at some cost to writability and efficiency of coding • Accordingly, they may focus on different design criteria • E.g., although Java, C++, and Python are all designed with the object-oriented programming paradigm in mind… • … operator overloading increases extensibility but reduces safety (e.g., operator precedence of ^ for exponentiation) • … generality and uniformity are aided by a simpler and smaller set of language features • … and so forth

  10. Today’s Studio Exercises • We’ll explore Visual Studio and a few coding ideas • Built incrementally from simple to more complex abstractions • We’ll work in C++, a multi-paradigm language • Please form teams that put people less (or without a) C++ background together with those familiar with C++ • Ask for help as needed • Use the on-line C++ reference and also the material at http://www.cse.wustl.edu/~cdgill/courses/cse332/ • Record your answers as you go and e-mail them (with the studio name in the subject line), when you’re done • E-mail them to the course account, cse425@seas.wustl.edu • You should get an e-mail back acknowledging receipt • Please track which studios you have (and have not) sent

More Related