DOC PREVIEW
UW CSE 341 - Study Notes

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 341, Winter 20031CSE 341, Winter 20031CSE 341: Programming Languages• The Team:– Alan Borning, instructor– Andrei Alexandrescu, teaching assistant– Eric Bessette, teaching assistant• “It’s on the Web”– www.cs.washington.edu/341• Add yourself to the class listserv– Directions are on the class web pageCSE 341, Winter 20032Course topics• Three languages:– Java– Scheme (like Lisp … lots-o-parentheses)– Haskell (a pure functional language with an interesting type system)• General programming language concepts• Maybe:– perl– squeak– CLP(R) (constraint logic programming)CSE 341, Winter 20033Required work• Warmup and moderate-sized program in each language• Course project of your own choosing– Probably in Java, but we’re willing to discuss doing projects in another language– Can be done in groups– Eclipse and cvs recommended for Java group projects• Midterm, final• Some written homeworkCSE 341, Winter 20034Books• Required text:– Allen Tucker and Robert Noonan, Programming Languages: Principles and Paradigms, McGraw-Hill, 2002• Additional reference books for the different languages are on 4 hour reserve in the Engineering Library (along with other useful references – complete list is on the web)– List of reserve books is on the class web page– ACM library in Sieg may also have some of these booksCSE 341, Winter 20035Grading Policy• Grading scale:– homework (45%)– project (15%)– midterm (15%) – final (25%)• Late policy:– Each student is granted two late days to use at his/her discretion during the quarter (see the web page for detailed rule)– No other late days or extensions except under very unusual circumstancesCSE 341, Winter 20036Collaboration Policy• Collaboration policy: “Gilligan’s Island Rule” (see the web page)– OK (and encouraged) to talk with other students in the class about assignments– Don’t take away any written material from the discussion– Do something mindless for 0.5 hours– Then do your assignment• Freedom of Information Rule– Write the names of your collaborators on any assignment• Cases of academic misconduct will be turned over to the Cheating CommitteeCSE 341, Winter 20032CSE 341, Winter 20037History of Programming Languages1955 1960 1965FortranAlgol 60Lisp CPLSnobolPre-Fortran: machine code or assembly languageCSE 341, Winter 20038History ofProgramming Languages1965 1970 1975BCPLAlgol 68BPrologCUnixrewrittenin CSimulaSchemeSmalltalk-72The first object-oriented language!CSE 341, Winter 20039History ofProgramming Languages1975 1980 1985K&R PublishedThe C ProgrammingLanguageANSI X3J11convened tostandardize CC with ClassesCPreC++ObjectiveCSmalltalk-80IconCSE 341, Winter 200310History ofProgramming Languages1985 1990 1995Stroustrup’sThe C++ ProgrammingLanguageANSI X3J16Formed forC++ StandardOakProjectC++ PL2nd Ed.JavaHaskellPerlPerl5CSE 341, Winter 200311What is a programming language for?• Instructing machines?• Communicating among programmers?• Expressing high level designs?• Notation for algorithms?• Tool for experimentation?Languages are for both humansand computers!CSE 341, Winter 200312Effective Use of Programming Languages“Learning the fundamentals of a programming language is one thing: learning how to design and write effective programs in that language is something else entirely.”—Scott MeyersCSE 341, Winter 20033CSE 341, Winter 200313Why do we care?• Whorf-Sapir hypothesis for natural languages• Tradeoffs among languages– reusability, maintainability– performance, robustness– flexibility, dynamicism– libraries– aesthetics (i.e., “fun-ness”)CSE 341, Winter 200314Language classification• Imperative (Fortran, Algol, C)• Object-oriented (Smalltalk, Java, C++)• Functional (“Pure” Scheme/Lisp, Haskell)• Logic/Constraint (Prolog, CLP(R))Languages may encourage a certain style even if they do not force it on you!CSE 341, Winter 200315What’s wrong with imperative?int i = 7;printf("%d\n",i*2);• What gets printed?CSE 341, Winter 200316Assignments makereasoning difficult!int i = 7;i = 3;printf("%d\n",i*2);CSE 341, Winter 200317Imperative programming• Nice for execution, translation… BUT:• Harder for humans tounderstand and reason about• Harder for sophisticated software tools– Proving correctness is harder– Restricts code motion, limits optimizer(especially important for parallel machines)CSE 341, Winter 200318Object-Oriented programming• A kind of imperative programming language• Metaphor: objects that communicate with each other by sending and receiving messages• Each object is an instance of a class• Classes come in hierarchies• Big benefits of OO programming:– Natural way of decomposing many problems– Modular– Good for supporting software reuse (frameworks)CSE 341, Winter 20034CSE 341, Winter 200319Examples of object-oriented languages• Java• C++• Squeak (a Smalltalk dialect)– Interesting features:– a pure object-oriented language – control structures are handled just by sending messages (no special syntax)CSE 341, Winter 200320The Functional Approach• In a pure functional language, there are no side effects (for example, no assignment statements)• Like functions in mathematics• Pure model, easy to reason about• (Arguably) not a good fit for modeling objects that change over timeCSE 341, Winter 200321Scheme• Very simple syntactically• Still an imperative language, though• But encourages a functional style• Can write in a purely functional subset– we will do this in the beginning– still has assignment statement• Dynamically typedCSE 341, Winter 200322Haskell• A pure functional language• Statically-typed• “Lazy” evaluationSample Haskell function definition:factorial n = product [1..n]CSE 341, Winter 200323Constraint Logic Programming• Metaphor: theorem proving and equation solving• Again, no side effects• Variables are like those in mathematicsSample CLP(R) rule:centigrade_fahrenheit(C,F) :- 1.8*C=F-32.Use:?-


View Full Document

UW CSE 341 - Study Notes

Documents in this Course
Macros

Macros

6 pages

Macros

Macros

6 pages

Macros

Macros

3 pages

Mutation

Mutation

10 pages

Macros

Macros

17 pages

Racket

Racket

25 pages

Scheme

Scheme

9 pages

Macros

Macros

6 pages

Load more
Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?