1 / 20

Programming Languages

Introduction to CS260. Programming Languages. WHY MORE? Wasn’t ONE ENOUGH?. Cart before the horse. Before contrasting(text), get a feel for how languages are similar But as author does -> You need to think of programming on a different level You know how to implement algorithms

quynh
Download Presentation

Programming Languages

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. Introduction to CS260 Programming Languages WHY MORE? Wasn’t ONE ENOUGH?

  2. Cart before the horse • Before contrasting(text), get a feel for how languages are similar • But as author does -> You need to think of programming on a different level • You know how to implement algorithms • Now learn to do it better • In order to assess whether you have the best approach, you need to understand consequences of your choices

  3. Does your approach take too long or too much memory? • Is your approach easy to understand? Readable? • Is it prone to errors • Is your program reasonably extendable or have you programmed yourself into a corner? • How can you possibly judge?

  4. It’s a little early • Your understanding of these concepts will become clearer with time and experience • Understanding examples from other languages to illustrate a point is basically premature • Start slowly • First look for similarities in languages and then differences • Develop a vocabulary for language issues

  5. Similarities • Learning new languages is not as difficult as it appears • Many of the languages are similar to c/c++ • This leverages you into a position of immediate knowledge of other languages • Knowing how to categorize differences leads you to know lots of other information • E.g. knowing the sex of a person leads you to be able to reach a number of other conclusions -> physical, emotional, etc

  6. Major categories • Representation of data • Flow of control • expression • statement • procedure • Interpreted vs compiled • Scope of access to data and procedures • Information hiding

  7. Influence of language • Try to think of any concept or idea without the use of words / language • LANGUAGE shapes the way you think • Greek language has a number of different words for different types of love. English tries to use the same word in different contexts. We struggle to differentiate the types of love. • Programming language dictates our solution

  8. Language influence User Interfaces Methodologies design tcl Provide access to OS create Language use utilize design create Architectural Features Applications

  9. Applications are Interaction of Operations Data Language understanding begins by examining these areas!

  10. Data • Simple data types • Aggregate data types • User/Programmer extendable types • System supplied and hardware supplied

  11. Operations • Expression level • Statement level • Procedural level • Process level

  12. Binding times • Many of the features are characterized by when the feature can change • E.g. consider allocation and initialization of a simple data type • compilation • beginning of execution • entry into procedure • entry into a code block

  13. Scope • How do you determine access to data • minimization is good • Access to procedures • should you have access to all functions and all versions

  14. Languages specialize • Business -> COBOl • Scientific -> FORTRAN • Systems (OS) -> C • General Purpose -> C/C++/Ada/java • Internet -> java • Scripting -> shell • Artificial Intelligence -> Lisp/Prolog

  15. Languages have tradeoffs • Readability (Simplicity) vs Power (Functionality) • Too little orthogonality (features dependent on other features - too many exceptions) vs too much orthogonality (independence creates too many possibilities and increased complexity) • c allows functions to return structs but notarrays(little) • allowing complicated expressions which evaluate to allocation on LHS of assignment is unreasonable • e.g. (&c)+23=y+z

  16. Syntax rules promoting readability may create programs more cumbersome to write • generally we accept the short-term inconvenience • Aside (syntax/form vs semantics/meaning) • for statement • Size of language vs cost of support tools • Reliability vs cost/speed of execution • Flexibility vs complexity/cost/safety • Our most important concern is COST • Many poor decisions are a result of not considering real costs!

  17. Compiled vs interpreted • Compiled • translate entire program into machine language • execute • Interpret • translate piece • execute • repeat • more flexibility (e.g. changing data type)

  18. Environments • Development/testing environments influence our choices • visual vs command line • debugging aids • compiler error assistance

  19. Most important factors • Machine architecture • von Neumann • in the end you have to implement what you design • Methodology • modular • structured (top-down design) • object oriented

  20. Time makes languages a melting pot of all good in other languages • Java like c like pascal like algol like fortran … • All embrace procedures/parameters/objects/etc • Fundamentally different approaches become fewer

More Related