cs 330 programming languages 09 / 07 / 2006 instructor: michael eckmann
Post on 20-Dec-2015
218 views
TRANSCRIPT
CS 330Programming Languages
09 / 07 / 2006
Instructor: Michael Eckmann
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Today’s Topics• Introduction• Review the syllabus• Review the policies on academic dishonesty and
improper collaboration• First chapter stuff• Fill out a questionnaire on programming
experience
Homework• Read chapter 1 in Sebesta.
• Check the webpage for written assignment to be due 11:59 pm. September 13 via email to [email protected]
• I prefer plain text files, but will accept the typical word processing format.
• Also, check your email sometime tonight --- I'll email the whole class and ask that you each reply to me (not reply all) so I know I have your email address correct.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Syllabus
• Office hours
• Text book
• Class room
• Assignments – programs– homeworks
• Collaboration policy
• Grading schema
• Attendance
• Workload
• Readings
Note: The most up-to-date syllabus will be found on the course web page.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Work• We won't work just for the sake of doing
work. I designed the course and the assignments with purpose in mind.
• Different types of assignments will require different types of thinking and skills.
• Informative, challenging.
• Theoretical and practical value
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Reason to study Prog. Langs.• Increased ability to express ideas
– Hard to conceptualize what you can't describe
– Limited grasp of lang. -> limited complexity of thought
– (read paragraph from text) page 2.
– May be able to apply what is learned in one language to another. How?
• For choosing appropriate languages
– The more you know, the better you can fit the job to the language
– What language will you choose if you only know one language?
– What advantages are there to choosing the one you know?
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Reason to study Prog. Langs.• Understand significance of implementation
– Use language more intelligently, e.g. Faster execution, find bugs easier
• Ability to design new languages
• Overall advancement of computing
Application Areas of Prog. Langs.• Question: What are some differences between the needs of a scientific
application and a business application? What about vs. systems applications (e.g. OS's and their support programs.)
• Scientific applications
– Fortran, Algol 60, et al.
• Business applications
– Cobol
• Artificial intelligence
– Lisp, Prolog, Scheme
• Systems programming
– C
• Scripting languages
– Perl, JavaScript, PHP, et al.
• Special-purpose languagesMichael Eckmann - Skidmore College - CS 330 - Fall 2006
Language Evaluation• When we talk about Language evaluation we're talking
about evaluating how effective the features of a language are at allowing programmers to create programs that are readable, writeable, reliable, costly etc.
• In that way we can then compare languages to each other in terms of how readable, writeable, reliable, costly, etc. the programs in each of those languages tend to be.
• This is different from comparing, for instance, how readable 2 programs written in the same language are.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Language Evaluation• Readability
– Why is it important?
– Software lifecycle (time/$ spent on maintenance vs. on initial coding)
– Simplicity (1 way vs. mult., operator overloading)
– Orthogonality (set of primatives combined in few ways in all combinations to build data structures)
– Control (e.g. gotos vs. loops)
– Types (e.g. Using an int where a boolean is best)
– Structures (e.g. Records vs. arrays of individuals)
– Syntax (identifier rules (size, valid chars), special words can be variable names --- any advantage to this?)
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Language Evaluation• Writability
– Orthogonality• if small set and all combinations make sense +
• if large set and all combinations exist but some don't make sense to ever use or would be rarely used – (could cause undeteced errors)
– Abstraction (functional (methods/functions) & data (classes))• don't need to know/be reminded of/replicate the implementation
details, just need to use what you wrote
– Expressivity (e.g. count++, for vs. while ...)
• Reliability
– (+)Type checking (at run-time vs. compile-time vs. neither)• when is better?
– (+)Exception Handling
– (-)Aliasing (why?)Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Language Evaluation• Cost (time == $)
– training programmers in the language– writing --- IDEs– compiling, executing --- compiler optimization
tradeoff– Implementation system (e.g. The compiler and/or
interpreter available for free?)– Poor reliability– Maintenance (up to 4 times cost of developing)
• Can you think of others?Michael Eckmann - Skidmore College - CS 330 - Fall 2006
A few Imperitive Languages
• C, Pascal and many others
• C++ has imperitive features although it is OO
• Java is imperitive-based although it is OO
von Neumann Architecture
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
von Neumann bottleneck
• transmission/piping between memory and CPU takes longer than executing instructions within the CPU.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Imperitive Language Features• Imperitive languages are built FOR the von
Neumann architecture – Data and programs stored in same memory– Memory is separate from CPU– Instructions and data are transmitted from memory
to CPU
• Variables model memory cells
• Assignment statements model transmission
• Iteration is efficient (b/c instructions are in adjacent memory cells) – recursion is inefficient.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Functional vs. Imperitive Languages
• Functional (e.g. Lisp, Scheme, et al.)– Apply functions to parameters– different use of variables– No assignment statements– No iteration
– Many programmers feel that there are extreme benefits to computing using functional languages. So, why aren't they used more?
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Functional vs. Imperitive Languages
• Because of von Neumann, that's why!
• What might be a drawback to using a functional language on a von Neumann machine?
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Imperitive Languages
• Von Neumann => imperitive languages
• But many programmers do not realize this and think that imperitive languages are the natural way to program.
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
The major Language Groups
• Imperitive– And visual langs (drag/drop code)
• Functional• Logic
– Rule based, no order of execution
• Object-Oriented
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Some Language Design Trade-offs
• Reliability vs. cost of execution– e.g. Run-time array range checking --- Java vs. C
• Readability vs. writability (expressivity)– Compactness
• Flexibility vs. safety– e.g. Multiple types allowed in same memory location
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Compilation, Interpretation, Hybrids
• What is a compiler?
• What is an interpreter?
• What is a hybrid of these?– Java, Perl– Compiler generates intermediate code that is then
interpreted– Any advantages/disadvantages?
Michael Eckmann - Skidmore College - CS 330 - Fall 2006
Let's think about some stuff
• Any other language evaluation criteria you can think of?
• What are the pros and cons of case sensitivity in user defined names?
Michael Eckmann - Skidmore College - CS 330 - Fall 2006