200 likes | 639 Views
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. Ethics. The 10 Commandments for Computer Ethics
E N D
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
Ethics The 10 Commandments for Computer Ethics • Thou shalt not use a computer to harm other people. • Thou shalt not interfere with other people's computer work. • Thou shalt not snoop around in other people's files. • Thou shalt not use a computer to steal. • Thou shalt not use a computer to bear false witness. • Thou shalt not use or copy software that you did not pay for. • Thou shalt not use other people's resources without authorization. • Thou shalt not appropriate other people's intellectual output. • Thou shalt think about the social consequences of your programs. • Thou shalt use a computer in considerate and respectful ways. Computer Professionals for Social Responsibility: www.cspr.org
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
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)
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
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?
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 … • • ?????
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
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
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
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
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
Von Neumann Bottleneck • Fetch-execute cycle • Fetch the instruction at program counter • Increment program counter • Decode the instruction • Execute the instruction • Speed: CPU > bus > RAM > …. > disk • Instructions are executed much faster than they can be moved to the CPU for execution
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) • !
1st 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
Business Applications = COBOL • Computers used for business starting in 1950s • 1st 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
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
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
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
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