Announcements Programming Languages ! Monday evening GBA section has been shut down " If you were assigned to this section, please find a different section " If you cannot attend a different section, please contact one of the TAs ! Monday March 3 (next week) there will be a combination help-with-project/pizza session in Week 6 place of the 12:20 sections CS 212 – Spring 2008 " Keep an eye on the website for further information FORTRAN ALGOL ! Initial version developed in ! Example code ! Sample code 1957 by IBM C SUM OF SQUARES comment Sum of squares ISUM = 0 begin DO 100 I=1,10 integer i, sum; ISUM = ISUM + I*I for i:=1 until 10 do 100 CONTINUE sum := sum + i*i; ! ALGOL end ! FORTRAN introduced many = ALGOrithmic Language of the ideas typical of ! ALGOL 60 included programming languages ! Developed by an recursion international committee " Assignment " Pro: Makes it easy to design clear, succinct " Loops ! First version in 1958 (not algorithms " widely used) Conditionals " ! Second version in 1960 Con: Too hard to " Subroutines implement; too inefficient (widely used) COBOL Simula & Smalltalk ! COBOL = ! COBOL included the idea of ! These languages introduced COmmon Business Oriented records (a single data and popularized Object Language structure with multiple Oriented Programming ! Developed by the US fields, each field holding a (OOP) government (about 1960) value) " Simula was developed in " Design was greatly Norway as a language for influenced by Grace simulation (late 60s) Hopper " Smalltalk was developed at ! Goal: Programs should look Xerox PARC in the 70s like English " Idea was that anyone ! These languages included should be able to read and " Classes understand a COBOL " Objects program " Subclasses & Inheritance 1 Java Programming Languages at Cornell ! Developed by Sun ! Some of the languages used in Cornell’s CS Dept Microsystems; first " Java released in 1995 # 100, 211, 212 # Many of the upper level courses " C, C++, C# ! Java includes # Many of the upper level courses (networks, distributed computing) " Assignment statements, " Matlab loops, conditionals from # 100M, numerical analysis courses FORTRAN (but Java uses " ML syntax from C) # Functional programming # 312, logic-related courses " Recursion from ALGOL " SQL " Fields from COBOL # Query language for databases " OOP from Simula & # 432, database-related courses Smalltalk ! Fortran, C, C++, Matlab are used widely in Engineering ! SAS (originally, Statistical Analysis System) is used in various courses around campus Some Other Programming Languages Some Other Programming Languages ! (from a Yahoo list) ! (from a Yahoo list) ABC, ActiveX, Ada, AMOS, APL, AppleScript, Assembly, awk, ABC, ActiveX, Ada, AMOS, APL, AppleScript, Assembly, awk, BASIC, BETA, C and C++, C#, Cecil, Cilk, CLU, COBOL, ColdC, BASIC, BETA, C and C++, C#, Cecil, Cilk, CLU, COBOL,ColdC, cT, Curl, Delphi, Dylan, Dynace, Eiffel, Forth, Fortran, Guile, cT, Curl, Delphi, Dylan, Dynace, Eiffel, Forth, Fortran, Guile, Haskell, Icon, IDL, Infer, Intercal, J, Java, JavaScript, JCL, Haskell, Icon, IDL, Infer, Intercal, J, Java, JavaScript, JCL, JOVIAL, Limbo, Lisp, Logo, M - MUMPS, Magma, ML, Modula- JOVIAL, Limbo, Lisp, Logo, M - MUMPS, Magma, ML, Modula- 2, Modula-3, Oberon, Obliq, Occam, OpenGL, Pascal, Perl, 2, Modula-3, Oberon,Obliq,Occam, OpenGL,Pascal,Perl, PL/I, Pop, PostScript, Prograph, Prolog, Python, Rexx, Ruby, PL/I, Pop, PostScript,Prograph,Prolog, Python,Rexx, Ruby, SAS, Sather, Scheme, ScriptEase, SDL, Self, SETL, SAS, Sather, Scheme, ScriptEase, SDL, Self, SETL, Smalltalk, SQL, Tcl/Tk, TOM, Verilog, VHDL, VRML, Visual, Smalltalk, SQL, Tcl/Tk, TOM, Verilog, VHDL, VRML, Visual, Visual Basic, Z Visual Basic, Z Portion of a Computer Languages History from http://www.levenez.com/lang/ So Many Languages ! Formula Translation (FORTRAN) in 1954 led to… " Over 2000 computer languages ! How many languages in use today? " Difficult to say " Legacy software (using outdated languages) is everywhere ! Why can’t we just use one language? 2 Evolution of Programming Languages Evolution of Programming Languages, Cont’d ! 1940s, early 1950s ! Late 1950s ! 1960s ! 1970s " Machine Language " High level languages " APL " C # Computation can be " Fortran # Array programming # Designed specifically for “mechanized” # Compiled code can be # Functional programming systems programming ! 1950s efficient code style " Smalltalk " Assembly language " Cobol " PL/1 # First “pure” object- oriented programming # Programs should be # Idea of structures/fields # IBM attempt to combine human-readable " Lisp best of Fortran & Cobol " Prolog " # # List as the central data Simula First logic programming structure # Designed for doing language # Programs as lists discrete event simulation " ML # Here is a language so far ahead of its time, " Algol 60 Introduced object- # Functional programming that it was not only an improvement on its oriented programming # Popularized recursion predecessors, but also on nearly all its concepts successors. # Formal specification of - C. A. R. Hoare commenting on Algol 60 language syntax # Lexical scoping rules Evolution of Programming Languages, Cont’d Classifying Programming Languages ! 1980s ! 1990s " C++ " Programming for the ! How its implemented # Combined C with object internet " Compiled ! Intended domain of use oriented programming " Java " Interpreted " General purpose " Ada # Secure execution of " # Designed for systems remote code Systems programming programming ! Programming paradigm " Scripting # Developed to use in place ! 2000s " Procedural programming " Concurrent/distributed of 100s of languages used " Object-oriented processes by US DoD " Security & reliability programming " Educational " Perl " Programming for multiple " Functional programming " Various other domains # Developed (late 1980s) processors for text manipulation " Logic programming # Popularized in 1990s for " … web-site programming " Focus on use of modules for large scale software development Compiled vs. Interpreted Some Programming Paradigms ! Compiled ! Procedural programming ! Functional programming " Parse code (typically create an abstract syntax tree) " Program can be broken into " Emphasizes application of " Create machine code for entire program procedures (or subroutines functions or functions) ! Interpreted " Avoids state; avoids " Examples: Fortran, Algol, mutable data " Run each statement as the statement is parsed Cobol, C, PL/1, Pascal " Examples: Lisp, Clean, ML, Haskell, Scheme ! Examples ! Object-oriented " Typically compiled: Fortran, Java, C programming ! Logic programming " Interpreted: Matlab, Python, Logo, some versions of Basic " Program is seen as a group " Based on use of declarative ! Advantages/Disadvantages? of cooperating objects statements in the language # Ideas: encapsulation, of mathematical logic inheritance, polymorphism ! The boundary between compiled and interpreted can be fuzzy " Example: Prolog, Oz " Examples: Smalltalk, Java, " Java is compiled to produce JBC (Java Byte Code) C++, C#, Python, recent " The JBC is then interpreted or JIT compiled Fortran, recent Cobol 3 Imperative vs. Declarative Prolog Example ! Imperative sendmore(Digits) :- " Statements tell the computer what to do Digits = [S,E,N,D,M,O,R,Y], % Create variables Digits :: [0..9], % Associate domains to variables " Think “commands” or “recipe” S #\= 0, % Constraint: S must be different from 0 " Examples M #\= 0, # Java, C, Fortran alldifferent(Digits), % All elements must take different values ! Declarative 1000*S + 100*E + 10*N + D % Other problem constraints " Describe what something is like rather than telling how to + 1000*M + 100*O + 10*R + E create it #= 10000*M + 1000*O + 100*N + 10*E + Y, " Examples labeling(Digits). % Start the search # Functional programming (Haskell) # Logic programming (Prolog) (from Wikipedia) Languages for Different Domains Scripting Languages ! General purpose ! Concurrent/distributed ! A script is a sequence of ! Example scripting languages: " Examples: Lisp, Algol, PL/1, processes common commands made into a Unix shell, Python, Perl, Scheme, Java, Python " Control of multiple threads single program Tcl (Tool command language) ! Systems programming " Examples: Ada, Oz, Smalltalk, " Unix uses shell scripts " Emphasis on efficiency and Java " The shell is the interactive ! Some Python code: tight control of data ! Educational interface to Unix structures " " Examples: Basic, Haskell, You can combine commands class Stack (object): " Examples: C, C++, Forth, Pascal, Python, Scheme, from the Unix shell to create def __init__ (self): Modula-2 Smalltalk, programs self.stack = [ ] ! Scripting ! Various other domains def put (self, item): self.stack.append(item) " ! Examples: Unix shell, Perl, " Discrete event simulation: A scripting language is usually def get (self): Python, Ruby, Tcl Simula " Easy to learn return self.stack.pop() " Web scripting: Javascript " Interpreted instead of def isEmpty (self): " Realtime applications: Ada compiled return len(self.stack) == 0 " Text processing: Snobol " Printing: Postscript " … A Programming Language Controversy Just for Fun: An APL Example ! “Go To Statement Considered Harmful” " Edsger Dijkstra, Communications of the ACM (March 1968) ! This is the entire program for a generational update in Conway’s Game of Life ! Led to concept of structured " Live cell & less than 2 live neighbors ⇒ dies of loneliness ! Sparked long-running programming " Live cell & more than 3 neighbors ⇒ dies of overcrowding discussion on whether
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages5 Page
-
File Size-