DOC PREVIEW
UW CSE 341 - Lecture 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:

CSE341, Fall 2011, Lecture 7.5 SummaryStandard Disclaimer: This lecture summary is not necessarily a complete substitute for attending class,reading the associated code, etc. It is designed to be a useful resource for students who attended class andare later reviewing the material.We now fulfill our promise to motivate the topics covered in this course now that we have enough sharedexperience to have a productive conversation.We can break the question of, “what is this course good for” into four parts:1. Why should we learn programming languages other than popular industry ones like Java, C, C++,Perl, etc.?2. Why should we learn fundamental concepts that appear in most programming languages, rather thanjust learning particular languages?3. Why should we focus on languages that encourage (mostly) functional programming (i.e., that discour-age mutation, encourage recursion, and encourage functions that take and return other functions)?4. Why are we using SML, Racket, and Ruby as complements to your Java experience (remembering thatthe course is more about the concepts than the languages)?The answers are numerous. Some may resonate with you more than others. The following discussion isnecessarily incomplete.Why Different LanguagesOne good analogy is with automobiles. There will never be a best programming language much as there willnever be a best car. Different cars serve different purposes: some go fast, some can go off-road, some aresafer, some have room for a large family, etc. Yet there are remarkable similarities and while drivers or automechanics may have preferences and specialties, they learn enough fundamental principles to work with newkinds of cars easily. Still, it can be uncomfortable to switch cars, as anyone who has ever had trouble findingthe windshield wipers in a friend’s car can attest.When learning automotive principles, it is probably helpful to start with simple and elegant cars where eachpiece has a clear and simple purpose rather than an “industrial-strength” car with features that have beenadded over many years.Are All Languages The Same?You should also know that in a very precise sense all programming languages are equally powerful: If youneed to write a program that takes some input X and produces output Y , there is some way to do itJava or ML or Perl or a ridiculous language where you have only 3 variables and 1 while loop. The equalexpressiveness is basically the Church-Turing Thesis, a core topic in courses on the theory of computationsuch as CSE431. But just because there is always some way to implement your program, does not mean itis easy, clear, or robust. A related concept is the, “Turing tarpit” where a language’s powerful features arelauded for what they can do, but it remains difficult to use them (like moving in a tarpit). Arguing over“which language is better” in terms of which has more useful features is also often unilluminating since thereis always some way to get the job done in your favorite language.The similarities among languages we focus on in this course have more to do with fundamental languageconcepts, such as variables, abstraction, support for one-of types, recursive definitions, etc. We won’t repeatthose here because that would require repeating most of the course!So are all languages really the same and picking one just a matter of personal preference? No, that wouldtake things too far. A good analogy might be different human cultures: On many levels, “people are people”1and there are universal experiences in the human condition. Yet there are also fascinating differences amongcultures and communities: their customs, their language, their values, and so on. In fact, one of the bestways to learn more about your own culture (maybe Java or C) is to immerse yourself in other cultures(maybe ML). In fact, you may bring experiences “back home” that make you a better and happier person.In terms of programming languages, in addition to syntactic differences, often the most important differencesis that what is “primitive” and really easy in one language is awkward in another. For example, returninga pair in Java is annoying. Conversely, setting up the equivalent of subclasses in ML is not very pleasant.Reality and Why We Ignore Most of ItIt is also fair to point out that when choosing a language for a software project, whether the language is anelegant design that is easy to learn and useful for writing correct, concise code is only one consideration. Inthe real world, it also matters what libraries are available, what your boss wants, and whether you can hireenough developers to do the task. We have the luxury in the classroom of ignoring these issues to focus onthe fundamental truths underlying programming languages. Doing so is important, so it is fine to ignoreother important real-world issues.Why is precisely defining the semantics and idioms of a programming language so important? Because thereis no other way to reason about what your software is doing: If you do not know the language definitionyou are stuck with vague notions about “what this code might mean.” This is a horrible recipe for softwaredevelopment. Only with semantics can we resolve issues like whether a library user or a library implementoris at fault for a bug.More generally, much of software development is about designing interfaces and explaining as precisely aspossible how they should be used. A programming language is one such interface: It takes a program andreturns an answer. So it is a really good example of an interface needing a precise definition.While it is unlikely you will be involved in designing a new general-purpose programming language likeJava, ML, or C++, it is surprisingly likely that you will end up designing a smaller new language for somespecific project. This happens all the time — whenever some application wants a way for users to extendits functionality. Editors (like emacs), game engines (like Quake), CAD tools (like AutoCAD), desktopsoftware (like Microsoft Office), and web browsers are all examples (corresponding languages include elisp,JavaScript, QuakeC, etc.). Seeing a range of programming languages and understanding their essentialdesign is invaluable.Finally, there is a place at universities to learn beautiful works of art that teach us about the universeand enrich us as people. Elegant programming languages are such works of art, just like the play Hamlet.Educated citizens should know SML


View Full Document

UW CSE 341 - Lecture 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 Lecture 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 Lecture 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 Lecture 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?