Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that.

Similar presentations


Presentation on theme: "1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that."— Presentation transcript:

1 1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that drive PL development Programming Environments Ref: Chapter 1 of Sebesta

2 2 Ethics The 10 Commandments for Computer Ethics 1. Thou shalt not use a computer to harm other people. 2. Thou shalt not interfere with other people's computer work. 3. Thou shalt not snoop around in other people's files. 4. Thou shalt not use a computer to steal. 5. Thou shalt not use a computer to bear false witness. 6. Thou shalt not use or copy software that you did not pay for. 7. Thou shalt not use other people's resources without authorization. 8. Thou shalt not appropriate other people's intellectual output. 9. Thou shalt think about the social consequences of your programs. 10. Thou shalt use a computer in considerate and respectful ways. Computer Professionals for Social Responsibility: www.cspr.org

3 3 Why Different PLs? To better express ideas To choose the best PLs for a project To learn a new PL faster To understand effects of implementation on the quality of your software To choose the best programming environment To understand and apply advances in computing

4 4 Expressing Ideas Learning new PL paradigms, new language features, new data structures, new algorithms allows you to – create better programs – solve more difficult problems E.g.: after learning object-oriented programming in Java, you could simulate objects as structures and functions in plain C (and you will learn C++ more easily)

5 5 Choosing a PL Programmers tend to stick with the first language they learned E.g.: A programmer who learned C in the school may implement a binary tree with arrays in Java, instead of using linked objects

6 6 Learning New PLs Knowing the basic concepts of one language will enable you to learn a new PL faster – E.g.: If you understand object-oriented concepts from Java, you will learn Ada more easily than if you never used these concepts Will you learn one language and use only that one for the rest of your career? How long will this PL be around?

7 7 The Half-Life of Information In 1400, a person could learn – all what there was to know In 1900, a child could learn – all what she needed for the rest of her life Today, 50% of the facts you know – will be untrue or obsolete in 3-4 years! Country boundaries, presidents OS versions, PLs, IDEs … ?????

8 8 PL Implementation Effects Knowledge of PLs enables you to – Construct more efficient software – Have fewer bugs in your program – Find and correct the bugs faster If you practice recursion in Lisp, you will write compact and concise code that will be as efficient as an iterative version in another PL

9 9 Advances in Computing Knowing the pros and cons of different PLs will help you as a manager choose the best PL for a project New PLs have new and better combinations of features E.g.: In the early 1960s, Fortran was used much more than ALGOL 60, even though ALGOL 60’s control statements were much better

10 10 Language Categories Imperative – Central features: variables, assignments, iteration – c.g. C, Pascal, Fortran Object-oriented Classes and objects (data and operations) Data encapsulation Inheritance Polymorphism, dynamic type binding – Grew out of imperative languages – e.g. Smalltalk, C++, Java, Common Lisp’s CLOS

11 11 Language Categories (cont.) Functional – Computation: applying functions to parameters yields a result – E.g. LISP, Scheme, ML, Haskel Logic – Rule-based – Order of rules not important – Proving a statement by inference (part of the language) – E.g. Prolog Scripting – regular expressions and pattern matching – E.g. Perl, JavaScript, Unix shells, Scheme

12 12 Influences on PL Design Computer Hardware and Architecture – Credited to von Neumann (“von Noyman”), – Data & programs are stored in memory – CPU executes instructions – Instructions & data piped between memory & CPU Imperative languages designed around this – Variables model memory cells – Assignment statements model piping – Iterative form is most efficient

13 13 Von Neumann Bottleneck Fetch-execute cycle 1.Fetch the instruction at program counter 2.Increment program counter 3.Decode the instruction 4.Execute the instruction Speed: CPU > bus > RAM > …. > disk Instructions are executed much faster than they can be moved to the CPU for execution

14 14 Influences on PL Design (cont.) Programming needs drive PL design – Early 1970s: Type checking & flow control Higher-level languages Procedure-oriented/imperative programming – Late 1970s: Abstract data types – Early 1980s: Object-oriented programming – Late 1980s: First standardized OO language: CLOS (Common Lisp Object System) !

15 15 1 st Application: Scientific = Fortran First computers used for scientific applications – 1940s Needed mostly arrays, matrices, counting loops, and selections Most efficient PL: Fortran – (Formula Translation) – 1950s

16 16 Business Applications = COBOL Computers used for business starting in 1950s 1 st PL for this was COBOL – (COmmon Business-Oriented Language) – New features Store character data Create reports, text output Store decimal numbers directly Perform calculations using decimal numbers (without translating to binary) Nowadays, spreadsheets and databases are available as applications on PC

17 17 Artificial Intelligence = Lisp, Prolog Computations on symbolic data rather than numeric computations Lists are a built-in data structure 1959: Functional PL LISP – developed for AI 1970: logic PL Prolog

18 18 Systems PL = Assembly, ALGOL, C Systems software – = Operating System + supporting tools – Must be efficient – Must interface with external drivers 1960s & 1970s: PL/S, BLISS, Extended ALGOL were first used for this Currently, UNIX is written mostly in C

19 19 Scripting PLs = Perl, JavaScript, PHP Early scripting: – a list of commands in a file (a script) to be executed – e.g. csh on unix, batch file on DOS -> Scripting languages: – variables, control flow statements, functions, etc. Perl: popular scripting language – e.g. for Common Gateway Interface (CGI) programming for the World Wide Web JavaScript & PHP – embedded in HTML web pages

20 20 Development Environments IDE Integrated Development Environment – Set of tools used in software development UNIX – An older operating system with tool collection – Nowadays often used through a GUI (e.g., CDE, KDE, or GNOME) that runs on top of UNIX Borland JBuilder – IDE for Java Microsoft Visual Studio.NET – A large, complex visual environment – Supports C#, Visual BASIC.NET, Jscript, J#, and C++ Eclipse – Open Source IDE primarily for Java


Download ppt "1 Programming Language Concepts Ethics Why study concepts of programming languages (PLs)? PL categories Influences on PL design Problem areas & needs that."

Similar presentations


Ads by Google