Some material copyright © 1998 by Addison Wesley Longman, Inc. 1CMSC331CMSC331Programming Programming LanguagesLanguagesIntroductionSome material copyright © 1998 by Addison Wesley Longman, Inc. 2Agenda• Introductions• Review material on web– Course– Objectives– Syllabus– Homework, exams, grades– Discussion board, announcements, etc.– Academic integrity• Questions• Chapter oneSome material copyright © 1998 by Addison Wesley Longman, Inc. 3Some questions• What’s the best programming language?• What’s the most lucrative programming languages to know?• Have we arrived at the end of history w.r.t. programming languages?• Will there always be programming languages?Some material copyright © 1998 by Addison Wesley Longman, Inc. 4How to study programming languages• There are several approaches to studying programming languages, e.g.:–Learn lots of languages?–Study the underlying concepts?–Implement a programming language?• We’ll do all of the above.Some material copyright © 1998 by Addison Wesley Longman, Inc. 5Chapter OnePreliminaries, including–Why study PL concepts?–Programming domains–PL evaluation criteria–What influences PL design?–Tradeoffs faced by programming languages–Implementation methods–Programming environmentsSome material copyright © 1998 by Addison Wesley Longman, Inc. 6Why study ProgrammingLanguage Concepts?• Increased capacity to express programming concepts• Improved background for choosing appropriate languages• Increased ability to learn new languages• Understanding the significance of implementation• Increased ability to design new languages• Overall advancement of computingSome material copyright © 1998 by Addison Wesley Longman, Inc. 7Programming Domains• Scientific applications• Business applications• Artificial intelligence • Systems programming• Scripting languages• Special purpose languagesSome material copyright © 1998 by Addison Wesley Longman, Inc. 8Language Evaluation Criteria• Readability• Writability•Reliability• Cost•Etc…Some material copyright © 1998 by Addison Wesley Longman, Inc. 9Evaluation Criteria: ReadabilityHow is it for one to read and understand programs written in the PL?Arguably the most important criterion!Factors effecting readability include:–Overall simplicity»Too many features is bad as is a multiplicity of features–Orthogonality»Makes the language easy to learn and read»Meaning is context independent–Control statements–Data type and structures–Syntax considerationsSome material copyright © 1998 by Addison Wesley Longman, Inc. 10Evaluation Criteria: WritabilityHow easy is it to write programs in the language?Factors effecting writability:–Simplicity and orthogonality–Support for abstraction–Expressivity–Fit for the domain and problemSome material copyright © 1998 by Addison Wesley Longman, Inc. 11Evaluation Criteria: ReliabilityFactors:- Type checking- Exception handling- Aliasing- Readability and writabilitySome material copyright © 1998 by Addison Wesley Longman, Inc. 12Evaluation Criteria: CostCategories:–Programmer training–Software creation–Compilation–Execution–Compiler cost–Poor reliability–MaintenanceSome material copyright © 1998 by Addison Wesley Longman, Inc. 13Evaluation Criteria: othersPortabilityGeneralityWell-definednessEtc…Some material copyright © 1998 by Addison Wesley Longman, Inc. 14Language Design InfluencesComputer architecture- We use imperative languages, at least in part, because we use von Neumann machines- John von Neuman is generally considered to be the inventor of the "stored program" machines -the class to which most of today's computers belong. - CPU+memory which contains both program and data- Focus on moving data and program instructions between registers in CPU to memory locationsSome material copyright © 1998 by Addison Wesley Longman, Inc. 15Von Neuman machine• Pronounced von noi-man• An early computer created by Hungarian mathematician John von Neumann (1903-1957).• It included three components used by most computers today: a CPU; a slow-to-access storage area (e.g., disk) and secondary fast-access memory (e.g., RAM ).• The machines stored instructions as binary values (creating the stored program concept) and executed instructions sequentially - the processor fetched instructions one at a time and processed them. • "von Neumann architecture" often refers to the sequential nature of computers based on this model. Some material copyright © 1998 by Addison Wesley Longman, Inc. 16Language Design Influences: Programming methodologies• 50s and early 60s: Simple applications; worry about machine efficiency• Late 60s: People efficiency became important; readability, better control structures. maintainability• Late 70s: Data abstraction• Middle 80s: Object-oriented programming• 95-today: distributed programs, the web• Future: who knows -- autonomic computing, AI, pervasive computing, digital rights management, …Some material copyright © 1998 by Addison Wesley Longman, Inc. 17Language CategoriesThe big four:Imperative or procedural (e.g., Fortran, C)Functional (e.g., Lisp, ML)Rule based (e.g. Prolog)Object-oriented (e.g. Smalltalk, Java)Others:Scripting (e.g., Perl, Tcl/Tk)Constraint (e.g., Eclipse)Some material copyright © 1998 by Addison Wesley Longman, Inc. 18Language Design Trade-offsReliability versus cost of executionAda, unlike C, checks all array indices to ensure proper range.Writability versus readability(2 = 0 +.= T o.| T) / T <- iN is an APL one liner that produces a list of the prime numbers from 1 to N inclusive.Flexibility versus safetyC, unlike Java, allows one to do arithmetic on pointers.Some material copyright © 1998 by Addison Wesley Longman, Inc. 19Implementation methods• Direct execution by hardware– E.g., machine language• Compilation to another language– e.g., C• Interpretation – Direct execution by software– E.g., csh, Lisp (traditionally)• Hybrid – Compilation to another language (aka bytecode) which is then interpreted, e.g., Java, Perl– Special purpose hardware (e.g., Lisp machine)Some material copyright © 1998 by Addison Wesley Longman, Inc. 20Implementation issues• Complexity of compiler/interpreter• Speed of translation• Speed of execution• Portability of translated code• Compactness of translated code• Debugging easecompile interprethybridSome material copyright ©
View Full Document