410 likes | 637 Views
…and an analysis of basic programming (v 0.102.232). The History & Evolution of Computer Programming. Programs are Everywhere!. Your computer Your cellphone Your microwave Your toaster
E N D
…and an analysis of basic programming (v 0.102.232) The History & Evolution of Computer Programming
Programs are Everywhere! • Your computer • Your cellphone • Your microwave • Your toaster • At some level, almost all electronic devices have some type of programming that tell the different components how to interact with one another.
A History of Programming:Before 1940 • The “first” program actually predates the first modern computer • The Jacquard Loom, in 1801, used holes punched in cards to represent the movement of the sewing loom arms. • Ada Lovelace, in 1843, while translating Luigi Menabrea’s memoirs on Charles Babbage’s Analytical Engine, added a series of notes which detailed a method of calculating Bernoulli numbers with the Analytical Engine. • The first real program written for a real computer is credited to Grace Hopper, written for the Harvard Mark I computer in 1944.
A History of Programming:Before 1940 • Charles Babbage (1791 – 1871) • English mathematician, philosopher, inventor, and mechanical engineer • First to originate the concept of a programmable computer. • Sought a method to calculate mathematical tables mechanically to remove the high rate of human error. • Conceived of and designed the DifferenceEngine, then the Analytical Engine. Neither were actually created in his lifetime. • A Difference Engine was built based upon his work, in 1991. On display in the London Science Museum.
A History of Programming:Before 1940 • Ada Lovelace (1815 – 1852) • The “first” programmer • The only legitimate child of poet Lord Byron. • Primary claim to fame is havingwritten a description of CharlesBabbage’s Analytical Engine. • The programming language, Ada,created for the United States Department of Defense, was named in her honor.
A History of Programming:Before 1940 • Alan Turing (1912 – 1954) • English mathematician, logician, cryptanalyst, and computer scientist. • One of the fathers of computer science. • Provided a formalization of the conceptof the algorithm and computation with the Turing machine. • Came up with the “Turing Test”, a proposal for a test of artificial intelligence in machines.
A History of Programming:Before 1940 • Herman Hollerith (1860 – 1929) • German-American statistician • Developed a mechanical tabulator to rapidly tabulate data from millions of punch cards. • His electric tabulating system was usedto tabulate the 1890 census in only oneyear. • His firm, along with four other companies, merged to form the Computing Tabulating Recording Corporation, which was later renamed to International Business Machines (IBM)
A History of Programming:The 1940s • The 1940s saw the rise of the first recognizably modern, electrically powered computers. • These early computers required hand tuned assembly language programs to run. • The ENIAC (Electronic Numerical Integrator And Computer) was the first general-purpose electronic computer, in 1946. • Important languages developed at this time: • Plankalkül (1943) • ENIAC coding system (1943) • C-10 (1949)
Types of Programming Languages • Programming languages can be broken down into three general types: • Machine language is a set of instructions and data directly read by a CPU. High and low level languages are interpreted into machine language for computers to read. • Low-level languages offer little or no abstraction from a computer’s instruction set architecture. • High-level languages offer strong abstraction from the details of the computer, some even including natural language elements. Meant to be more user-friendly and easier to use.
A History of Programming:The 1950s & 60s • The 1950s saw the rise of the first modern programming languages, many of whose descendants are still used today. • The mid-50s saw the publication of the ALGOL 60 Report, which consolidated all the programming ideas circulating at the time, and introduced two key language concepts: • nested block structure • lexical scoping
A History of Programming:The 1950s & 60s • Backus-Naur Form (BNF) • A mathematically exact notation for language syntax that was introduced in the late 50s. <postal-address>::=<name-part><street-address><zip-part> <name-part>::=<personal-part><last-name><opt-jr-part><EOL>|<personal-part><name-part> <personal-part>::=<first-name>|<initial> "." <street-address>::=<house-num><street-name><opt-apt-num><EOL> <zip-part>::=<town-name> "," <state-code><ZIP-code><EOL> <opt-jr-part>::= "Sr." | "Jr." |<roman-numeral>| ""
A History of ProgrammingThe 1950s & 60s • ALGOL 68 was a further attempt to redefine programming languages, but was deemed too difficult. • Attempts to simplify it resulted in the Pascal language. • Other important languages developed in this time: • FORTRAN (FORmulaTRANslator) (1954) • LISP (the LIStProcessor) (1958) • COBOL (COmmonBusiness Oriented Language) (1959) • Simula (1962) • BASIC (Beginner’s All-purpose Symbolic Instruction Code) (1964)
Programming Paradigms • Programming paradigms are the fundamental styles used in programming. • Paradigms differ in the concepts and abstractions used to represent elements of a program and steps that compose a computation. • COBOL and FORTRAN among others, are procedural languages, meaning the programs are built from various functions or subroutines. These type of languages use vocabulary relative to the problem being solved. • The opposite of procedural programming is declarative programming, where the computer is told what the problem is, not how to solve a problem. Logic-based programming languages like Prolog are declarative in nature.
Programming Paradigms • More programming paradigms • Imperative programming deal with statements that alter a program state. • In object-oriented programming, data and methods of manipulating the data, are kept as a single unit called an object. This prevents the data from being manipulated by anything other than the object’s methods.
A History of ProgrammingThe 1950s & 60s • Grace Hopper (1906 – 1992) • American computer scientist and US Naval Officer • One of the first programmers for the Harvard Mark I computer • Developed the first compiler for a programming language • Conceptualized and developed COBOL, one of the first modern programming languages. • Popularized the term “debugging”, after removing an actual moth from a computer. • Referred to as “Amazing Grace” in the Navy. • The U.S. Naval Destroyer USS Hopper is named for her.
A History of Programming:The Late 60s & 70s • New programming languages began to bloom in the late 60s, introducing even more new languages: • Pascal (1970) • C (1972) • Smalltalk (1972) • Prolog (1972) • ML (1973) • SQL (1978) • This time saw the introduction and debate of “structured programming”, which basically meant programming without the use of the GOTO statement.
A History of Programming:The 1980s • Increased focus on programming for large-scale system through use of modules • The languages Modula, Ada, and ML all developed notable module systems in the 80s. • The 80s saw the movement towards RISC design in CPUs • This basically meant that hardware should be designed for compilers rather than for assembly programmers.
A History of Programming:The 1980s • Important languages developed in the 1980s included: • Ada (1983) • C++ (1983) • Eiffel (1985) • Erlang (1986) • Perl (1987)
A History of Programming:The 1990s and Beyond • The 90s saw the rise of RAD (Rapid Application Development) languages • RAD languages usually included an IDE, garbage collection, and were usually descended from older languages. • Examples of RAD languages • Object Pascal • Visual Basic (1991) • C# (2000)
A History of Programming:The 1990s and Beyond • Important languages developed in this time: • Haskell (1990) • Python (1991) • Java (1991) • Ruby (1993) • Lua (1993) • JavaScript (1995) • PHP (1995) • C# (2000)
A History of Programming:The 1990s and Beyond • The 90s also saw the rising popularity of scripting languages. • Scripting languages allow control of one or more software applications. • “Scripts” are distinct from the core code of the main application, and can often be created or modified by the end-user. • Scripting languages, unlike other high-level programming languages, do not need to be compiled. • Also referred to as “batch languages” or “job control languages”. • Modern web browsers are a good example. • For example, Firefox is written in C/C++, and can be controlled via JavaScript and/or PHP.
2000 and Beyond • The evolution continues! Several new trends in this decade include: • Metaprogramming • This is writing of programs that write or manipulate other programs (or themselves) as their data • Integration with relational databases and/or XML • XML (Extensible Markup Language) • More mainstream support for Unicode vs. the ASCII character set
Analysis of a Program • Functions • At their most basic, programs are simply functions, or a collection of various variable assignments and executions of simple math-type statements. • Example: • void main(){ print “Hello, world”;} • This is a simple “Hello world” program, that simply prints the message “Hello, world” to the screen.
Analysis of a Program • Relational Operators • AND is expressed in most languages as &&, also called “logical conjunction” • OR is expressed in most languages as ||, also called “logical disjunction” • “=“ refers to assigning a value, while “==“ tests for equality. • In some languages, “===“ signifies a test for equality in both value and data type. • “!=“ or “<>” means not equal, and most other numerical relational operators apply • For example, “<“, “>”, “>=“, “<=“ all mean the same thing in programming as they do in mathematics.
Analysis of a Program • Control Flow • There are various statements used in programs to control how the flow through a program is executed, known as control flow statements • Most programs need keywords to indicate the type of control structure in use, to group various statements together • begin … end • { } • indentation levels
Analysis of a Program • Control Flow continued • Loops • Loops are sequences of statements specified once, but carried out several times in succession. • A loop that calls itself in the course of its execution is said to be recursive. Poorly written recursive loops can lead to infinite loops, which are bad (usually). • A simple recursive function: factorialsfunction factorial is:input: integer n such that n >= 0output: [n × (n-1) × (n-2) × … × 1] 1. if n is 0, return 1 2. otherwise, return [ n × factorial(n-1) ] end factorial
Analysis of a Program • Types of loops: • Count controlled loops • Execute x amount of times before proceeding • Most of these use a loop counter to keep track of the number of times the loop has been executed • for loops most common type • Condition controlled loops • These types of loops repeat until a certain predefined condition has changed • Examples: while loops, do-while loops
Analysis of a Program • Types of loops • Collection-controlled loops • Some languages have constructs which allow looping through all elements of an array, or all members of a set or collection • Examples: foreach loops • Some languages allow for non-local control flow in the form of conditions and exceptions.
Analysis of a Program • Conditional statements • Conditional statements perform specific actions and computations depending on whether or not a specified Boolean condition evaluates to TRUE or FALSE. • If-Then-Else • One of the most common conditional statements. While the syntax can vary from one language to the next, the basic structure remains the same • if (condition) then (statements)else (statements)end if
Analysis of a Program • Conditional statements • Else If is an addition to If-Then-Else statements, allowing multiple conditions to be tested at once • Ternary operators work similar to If-Then-Else statements, but in a shorthand kind of form • (condition) ? (TRUE statement) : (FALSE statement)
Analysis of a Program • Conditional statements • Case/Switch statements compare a given value with specified constants and take action according to the first match • switch (someCharacter){ case ‘a’: performActionA; break; case ‘b’: performActionB; break; case ‘c’: break; default : performActionC; break;}
Analysis of a Program • Data Types • Many different types of data can be manipulated in programming • The data types provided are referred to as “primitive data types”, meaning they’re defined and provided by the programming language itself, as opposed to user defined data types. • Integers • Floating point (decimal values) • Floating point calculations in programming can be rather resource-intensive in some cases. • Char (single characters)
Analysis of a Program • Data Types continued • Even more data types • In some languages, a Boolean data type exists. Usually, it just an integer with a value of either 0 or 1. • Strings • In some languages, strings can be treated as character arrays, and manipulated like arrays. • In others, strings have special library-defined functions for handling them.
Analysis of a Program • Data types continued • Even MORE data types… • Arrays are sets of values in a program that can be selected by indices • Example: foo = (0, 2, 3, 4, 5, 2, 10); print foo[1];Would yield the result of “2”. • When working with arrays, it’s important to remember that counting begins with “0” in most languages.
Putting It All Together • A simple program that prints out the numbers from 1 to 10 • void main(){ int x; for(x = 1; x < 11; x++) print x + “\n”; return;}
References • Sammet, Jean E. (1969). Programming Languages: History and Fundamentals. Englewood Cliffs, NJ: Prentice-Hall. • History of Programming Languages.(n.d.). In Wikipedia. Retrieved November 27th, 2009, from http://en.wikipedia.org/wiki/History_of_programming_languages • Klerer, Melvin. (1991). Design of Very High-Level Computer Languages. USA: McGraw-Hill. • Bergin, Thomas J. & Gibson, Richard G. (1996). History of Programming Languages. New York, NY: ACM Press. • Koffman, Elliot B. & Friedman, Frank L. (1993). Fortran With Engineering Applications: 5th Edition. Reading, MA: Addison-Wesley Publishing Company. • Saari, Peggy. "Science And Invention - Who Wrote The First Computer Program?." History Fact Finder. Ed. Julie L. Carnagie. UXL-GALE, 2001.eNotes.com. 2006. 6 Dec, 2009 <http://www.enotes.com/history-fact-finder/science-invention/who-wrote-first-computer-program>