CSC302 2006S, Class 1: About the Class Admin: * Course Site: http://www.cs.grinnell.edu/~rebelsky/Courses/CS302/2006S/ * Readings distributed * Book not needed for a few weeks * Warning! Sam's pedagogical approach is R^4: Rebelsky round-robin recitation * Short Survey Overview: * What is a programming language? * Why study programming languages? * How should we study 'em? * Course details /Short Survey/ * Goal: Give me some sense of what you do and don't know * Scheme topics * Continuations? 0 * Closures? 0 * Macros? 0 In general, a macro provides a shorthand for longer pieces of code * Currying? 2, maybe * Java topics * Generics (parameterized classes)? 0 * Anonymous Inner Classes 0 * Reflection 0 * Other languages * SQL? About 1/2 * C? Everyone, but not true C hackers while (*c++ = *d++) ; * C++? About 1/2 * C#? 1 * Ruby? 0 * Smalltalk? 0 * Prolog? 0 What is a programming language? * Syntactic and semantic systems that permits you to represent functions and ... Maybe * A standardized communication technique for describing instructions to a computer [Wikipedia, 2006] * Syntax describes how you communicate * Semantics describes what it means * Sam's correction: "Communicate with computer *or human*" * Sam's next correction: Communicate *algorithms* Why study programming languages? Why are you here? Why does Grinnell require CSC302? * A major subdiscipline of CS; you should know the ideas * Let students learn other languages * Help students understand similarities and differences * Psychotic * Reinforce principles * Historical aspect: "Those who forget history are doomed to repeat it"; "Those who forget history are doomed to rewrite Cobol or Fortran 1"; To help predict the future * Recaps many courses (including compilers) * Since we use them, some understanding of how they function might be helpful (although that's more a topic for compilers) * Compare and contrast: Advantages, efficiencies, etc. * Most large systems involve their own languages How do we study languages? * Language of the week (some of that) * Explicitly address design principles (some of that) * Implement (little of that) * History of Programming languages: Learn about contexts! * We will do a combination! What kinds of languages are there? (Key language paradigms) * Imperative (Fortran, Pascal, C, ...) Algorithms expressed as sequences of basic operations, which include data movement (assignment, I/O) and arithmetic. * Functional (LISP, Scheme, FP, Haskell, ...) Algorithms expressed by function definition and application, including functions as first-class data Traditional imperative/functional contrast: inner product int sum = 0; for (int i = 0; i < n; i++) { sum += A[i]*B[i]; } (apply + (map * A B)) * Object-Oriented (Simula, Smalltalk, C++, Java, Ruby, ...) Algorithms expressed in terms of communicating objects Lots of focus on how you describe objects: Inheritance, Polymorphism, Encapsulation * Declarative (Prolog, SQL, All functional languages ...) Algorithms expressed in terms of "facts"; No or little explicit control Regular expressions are a good everyday declarative language * Dave's observation: These overlap somewhat; * Sam's response: When we talk about a language, we look at its key focus