Is there a good programming language out there - PowerPoint PPT Presentation

Loading...

PPT – Is there a good programming language out there PowerPoint presentation | free to view - id: a5e73-ZWQ4O



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Is there a good programming language out there

Description:

A good programming language is a conceptual universe for thinking about programming. ... Good development environments (IDEs)? 4. Is there a good programming language? ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 44
Provided by: allent
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Is there a good programming language out there


1
Is there a good programming language out there?
  • Allen Tucker September 19, 2008
  • http//www.bowdoin.edu/allen

2
A good programming language is a conceptual
universe for thinking about programming. A.
Perlis
  • This raises four questions
  • 1. Whats in this conceptual universe?
  • 2. How should we think about programming?
  • 3. What should a good programming language look
    like?
  • 4. Is there a good programming language?

3
1. A languages conceptual universe
  • Concepts about computing environment
  • Machine architecture/platform
  • Run-time behavior
  • User interface
  • Networking clients and servers
  • Data persistence
  • Concepts about programmers and programming
  • Application domain
  • Programmer skills
  • Organization individual vs team
  • Program goals

4
2. How should we think about programming?
  • Programming combines modeling and coding.
  • Elements of modeling
  • Literate style
  • Programming in the large (frameworks)?
  • System and network platform
  • Application requirements and use cases
  • Elements of coding
  • Syntax and semantics
  • Abstraction
  • Efficiency
  • Development environment (IDE, version control)?
  • Correctness and documentation

5
3. What should a good programming language look
like?
  • Historical influences
  • Application domains
  • Programming paradigms
  • Quality metrics

6
3a) Historical influences
  • Programming languages evolve over time
  • 1960 - there were 4 (count em) major languages
  • Algol, Fortran, Cobol, and Lisp
  • 1977 - I wrote a book that covered 6 prominent
    languages
  • Algol, Fortran, Cobol, PL/I, RPG, and Snobol
  • 1986 - the 2nd edition covered 11 languages
  • Pascal, Fortran, Cobol, PL/I, Snobol, APL, C,
    Lisp, Prolog, Ada, Modula-2
  • 2001 Bob Noonan and I wrote a book covering 4
    languages and 6 paradigms
  • Java, C, Scheme, Prolog
  • 2007 - the 2nd edition covered 9 languages
  • Java, C, Ada, Perl, Smalltalk, Python, Scheme,
    Haskell, Prolog

7
(No Transcript)
8
3b) Application domains also have language
preferences
  • Artificial Intelligence
  • Scheme, C, Prolog
  • Computer Science Education
  • C, C, Java, Python
  • Science and Engineering
  • Fortran, C
  • Information Systems
  • Cobol, SQL
  • Systems and Networks
  • C, C, Ada
  • World Wide Web
  • Perl, PHP, Python

9
3c) Programming Paradigms
  • A paradigm is a problem-solving pattern that
    utilizes a conceptual universe for thinking about
    programming.
  • So a paradigm utilizes a programming language.
  • Here are six very different paradigms
  • Imperative
  • Object-oriented
  • Functional
  • Logic (declarative)?
  • Event-driven
  • Concurrent
  • But different paradigms utilize different
    languages.

10
Imperative Programming
  • Based on the von Neumann-Eckert computing model
  • Program and data coexist in memory
  • Program a sequence of commands
  • State values of all variables at run time
  • Large programs use procedural abstraction
  • Example imperative languages
  • Cobol, Fortran, C, Ada, Perl

11
The von Neumann-Eckert Computing Environment
12
3d) Quality Metrics
  • A good language should have ten qualities
  • Literacy
  • Semantic clarity
  • Rich primitive types and structures
  • Abstraction
  • Reliability
  • Efficiency
  • Objects and events
  • Concurrency in the large
  • Correctness tools
  • Support

13
Quality 1. Literacy
  • Writable
  • Small vocabulary (instruction set)?
  • E.g., Java vs. Scheme
  • Simple syntax
  • E.g., C/C/Java vs. Python
  • Readable
  • Clear structure and naming conventions
  • Documentation support

14
Quality 2. Semantic clarity
  • A binding associates an object with a property.
    Examples a variable and its type, or
  • a variable and its value
  • A language is strongly typed if the type of every
    variable in a program is known whenever it is
    referenced.
  • Strong typing is related to clarity about
    binding, which leads to semantic clarity.
  • A language is orthogonal if its semantics are
    built on a
  • small, mutually independent set of primitive
    operations.
  • Fewer exceptional rules lead to semantic clarity

15
Quality 3. Rich Primitive Types and Structures
  • Numbers
  • Currency
  • Strings
  • Dates and times
  • Lists and list functions
  • Hash maps (associative arrays)?
  • Traversals
  • Relational databases

16
Quality 4. Abstraction
  • Data
  • Programmer-defined types/classes
  • Class libraries
  • Procedural
  • Programmer-defined functions
  • Function libraries

17
Quality 5. Reliability
  • A language is reliable if
  • A program behaves the same when run on different
    platforms
  • E.g., Fortran 95 vs Fortran I
  • Type errors are detected
  • E.g., Haskell vs C
  • Semantic errors are properly trapped
  • E.g., C vs C
  • Memory leaks are prevented
  • E.g., Java vs C

18
Quality 6. Efficiency
  • Embedded systems
  • Real-time responsiveness (e.g., navigation)?
  • Failures of early Ada implementations
  • Web applications
  • Responsiveness to users (e.g., Google search)?
  • Database applications
  • Efficient search and updating
  • AI applications
  • Modeling human behaviors

19
Quality 7. Objects and Events
  • An object oriented (OO) program models a
    collection of objects that interact by passing
    state-transforming messages.
  • OO is a good way to model real-world
    applications.
  • Example OO languages
  • Java, C, C, Python, PHP

20

Events
  • Computation is best modeled as a community of
    persistent entities coupled together by their
    ongoing interactive behavior ... Beginning and
    end, when present, are special cases that can
    often be ignored. Lynn Stein
  • Event-driven programs do not control the sequence
    in which input events occur.
  • Example event-driven languages
  • Perl, Python, Java applets, PHP forms

21
Imperative vs. Event-Driven Programs
22
Event-driven Applications
  • GUI
  • Games
  • Graphical design
  • Web-based
  • E-commerce (e.g., amazon.com)?
  • Volunteer scheduling (e.g., hfoss.bowdoin.edu)?
  • Embedded systems
  • Cell phones
  • Security alarm systems

23
Quality 8. Concurrency in the large
  • Two or more instruction streams (threads) running
    asynchronously and sharing data.
  • Characteristics
  • More efficient than single instruction stream
  • More realistic
  • Have unique, fundamental complexities
  • Traditionally studied in the context of operating
    systems

24
Concurrency example web pages
  • To render a web page (a shared resource), we
    need
  • A thread for loading each image
  • A thread for rendering text
  • A thread for responding to user input
  • e.g., a stop button
  • Threads cannot all write to the page
    simultaneously
  • They need asynchronous control
  • But they must be concurrent
  • They must be responsive to the user

25
  • Asynchronous control is needed
  • Whenever a thread requires exclusive access to
    some resource,
  • Whenever a thread needs to exchange data with
    another thread,
  • To prevent the resulting value of a shared
    variable from being different depending on the
    execution order of two threads (a race
    condition)?
  • To prevent a thread from waiting for an event
    that will never happen (a deadlock).

26
  • Concurrency in the large
  • the client-server model

client
client
client
network
server
Shared resource
27
Quality 9. Correctness tools
  • To treat programming scientifically, it must be
    possible to specify the required properties of
    programs precisely.
  • The importance of formal specifications must
    ultimately rest in their utility - in whether or
    not they are used to improve the quality of
    software or to reduce the cost of software.
  • J. Horning

28
Why correctness?
  • A correct program does exactly what its
    specifications require, no more and no less.
  • A formally correct program is one whose
    correctness can be proved mathematically.
  • Until recently, correctness has been just an
    academic exercise.
  • Now it is becoming a key element of
    safety-critical systems
  • Correctness can ensure higher levels of quality
    than traditional testing
  • e.g., the Paris Metro System

29
Practical problems with correctness
  • Scaling up
  • Teaching the methodology
  • Practicing the methodology
  • Lack of good tools
  • Duplication of effort
  • E.g., The Java elements JML and ESC/Java2
    support
  • Correctness proof (ESC/Java2)
  • Complements traditional Unit testing (Junit)?
  • Modeling (JML)
  • Complements traditional Coding (Java)?
  • Documentation (JML)
  • Complements traditional Documentation (Javadoc)?

30
Quality 10. Support
  • A well-supported language has
  • Free access (open source)?
  • Good texts and tutorials
  • Significant application domain (and programming
    community)?
  • Good development environments (IDEs)?

31
4. Is there a good programming language?

32
4. Is there a good programming language?
  • Yes…

33
4. Is there a good programming language?
  • Yes…
  • My vote goes to PHP/Apache/MySQL

34
But wait, you say…
  • This isnt a language
  • PHP and MySQL are two different languages, and
  • Apache is a web server.

35
But wait, I say…
  • This is a language
  • PHP and MySQL are well-integrated, and
  • We cant program client-server applications
    (concurrency in the large) without a web server.
  • Anyway, let's assume (for arguments sake) that
    PHP/Apache/MySQL is a language,
  • So now we can look at PHP/Apache/MySQL through
    the lens of our 10 quality criteria.

36
PHP/Apache/MySQLs qualities
  • Literacy yes
  • Semantic clarity yes -- even w/dynamic types
  • Rich primitive types and structures yes --
    see next slide
  • Abstraction yes
  • Reliability yes
  • Efficiency yes
  • Objects and events yes
  • Concurrency in the large yes
  • Correctness tools no -- see 2nd/3rd next slides
  • Support yes

37
Examples of PHP/Apache/MySQLs Rich Primitive
Types and Structures
  • Dates and times
  • today date()
  • september9 mktime(0,0,0,9,19,2008)
  • Associative Arrays
  • population array(CTgt3502309, MAgt
    6449755,
  • RI gt 1057832, ME gt 1317207,
  • NH gt 1315828, VT gt 621254)
  • So populationMA gives 6449755
  • MySQL integration
  • my_query SELECT state, pop FROM censusData
  • result connection-gtquery(my_query)
  • population mysql_fetch_array(result,
    MYSQL_ASSOC)

38
The challenge for integrating correctness tools
  • Documentation is essential for software
    development
  • Javadoc (and PHPdoc) have keywords for
    specifying features of classes and methods.
    E.g.,
  • _at_return specifies value returned by a function
  • _at_param specifies parameters required by a method
  • Formal specifications are essential for
    correctness proofs
  • JML has features for specifying the same. E.g.,
  • \ensures and \return clauses
  • \requires clauses
  • But these two are not integrated.
  • So the programmer has to write all these
    specifications twice!

39
PHP/Apache/Mysqls Main Weakness
  • Lack of correctness tools
  • Suggestions for fixing this weakness
  • Integrate formal specifications within PHPdoc
  • motivator for writing better documentation
  • supplement for unit testing
  • preparation for more formal proof
  • Use JML and ESC/Java2 experiences for guidance

40
A PHP/Apache/MySQL Application
  • RMH Homebase A volunteer scheduling for the
    Ronald McDonald House in Portland, ME
  • Web-based, client-server
  • Database
  • Designed and Programmed by four Bowdoin students
    (and me)?
  • Open source (see http//sourceforge.net/projects/r
    mhhomebase)?
  • Fully developed during spring semester 2008
  • See http//hfoss.bowdoin.edu and login as guest
    (no password) to experiment with the system.

41
Conclusions
  • If you become a computing professional
  • prepare to spend a lot of time learning
    languages.
  • Expect programming languages to be the last to
    keep pace with the evolution of computing.
  • Expand your notion of programming language
    beyond the conventional.
  • Have fun with programming languages.
  • They will have fun with you!

42
References
  • Tucker and Noonan, Programming Languages 2/e,
    McGraw-Hill 2007
  • http//highered.mcgraw-hill.com/sites/0072866098/
  • 2. PHP/Apache/MySQL Web sites
  • http//www.php.net/
  • http//www.apache.org/
  • http//www.mysql.com/
  • PHP/Apache/MySQL Software Projects
  • http//hfoss.bowdoin.edu/
  • http//www.hfoss.org/

43
Questions?
About PowerShow.com