Chapter 3 - Language Design Principles

Slides:



Advertisements
Similar presentations
1 Chapter 3 - Language Design Principles. Thought question What characteristics should be present in your “perfect language”? What have you liked/disliked.
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Names and Bindings.
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Chapter 9 Subprograms Sections 1-5 and 9. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Introduction Two fundamental abstraction facilities.
Why is Java so popular? Floundered until adapted for internet. 90% of personal computers have Java Run on client – so load to server is drastically reduced.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Louden, Chapter 3 - Language Design Principles Programming Languages: Principles and Practice, 2nd Ed.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Type Checking Strong Typing Type Compatibility.
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
ISBN Chapter 9 Subprograms. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Introduction Two fundamental abstraction facilities.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Chapter 3 Louden1 Chapter 3 - Language Design Principles Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
CS884 (Prasad)Java Goals1 “Perfect Quote” You know you've achieved perfection in design, Not when you have nothing more to add, But when you have nothing.
CSE305 Programming Languages Notes are based primarily on Sebesta text. Quotes are from Sebesta text, unless otherwise noted. Sources other than Sebesta.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
CSE305 Programming Languages Notes are based primarily on Sebesta text. Quotes are from Sebesta text (7 th edition), unless otherwise noted. Sources other.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
Python Introduction.
1 Programming Languages Marjan Sirjani 2 1- The Study of Programming Languages The purpose of language is simply that it must convey meaning. (Confucius)
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
C++ for Java Programmers Chapter 1 Basic Philosophical Differences.
Language Evaluation Criteria
PROGRAMMING LANGUAGES The Study of Programming Languages.
Overview. Copyright © 2006 The McGraw-Hill Companies, Inc. Chapter 1 Overview A good programming language is a conceptual universe for thinking about.
CSE 425: Intro to Programming Languages and their Design A Few Key Ideas No particular language is a prerequisite for this course –However you should be.
Programming Languages Third Edition Chapter 2 Language Design Criteria.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CS 363 Comparative Programming Languages
Static and Dynamic Behavior CMPS Power of OOP Derives from the ability of objects to change their behavior dynamically at run time. Static – refers.
Gary MarsdenSlide 1University of Cape Town Principles of programming language design Gary Marsden Semester 2 – 2001.
Names Variables Type Checking Strong Typing Type Compatibility 1.
5-1 Chapter 5: Names, Bindings, Type Checking, and Scopes Variables The Concept of Binding Type Checking Strong Typing Type Compatibility Scope and Lifetime.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Chapter 1 - Introduction
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
1 Programming Languages Marjan Sirjani Course web site:
1 Programming Language History and Evolution In Text: Chapter 2.
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
ProgrammingLanguages Programming Languages The Extended Design Principles This lecture introduces a list of more specific principles that can be an aid.
Ch. 5 Ch. 51 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (more notes) Dr. Carter Tiernan.
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Programming Language Design Issues Programming Languages – Principles and Practice by Kenneth C Louden.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
CSCE 343 – Programming Language Concepts Welcome!.
History. Development Driven by Function Functions of a Programming Language –To describe computation for use by computers –To describe computation and.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Programming Language History and Evolution
Programming Languages 2nd edition Tucker and Noonan
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Programming Language History and Evolution
CS 3304 Comparative Languages Fall 2011
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Programming Languages 2nd edition Tucker and Noonan
Principles of Programming Languages
Names and Binding In Text: Chapter 5.
Chapter 1 Preliminaries.
Programming Languages and Paradigms
Presentation transcript:

Chapter 3 - Language Design Principles 4/25/2017 Chapter 3 - Language Design Principles Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden © Kenneth C. Louden, 2003

The language design problem Language design is difficult, and success is hard to predict: Pascal a success, Modula-2 a failure Algol60 a success, Algol68 a failure FORTRAN a success, PL/I a failure Nevertheless, there have been some basic goals or principles that have been important over the years, and that can contribute to success. Chapter 3 K. Louden, Programming Languages

K. Louden, Programming Languages Efficiency The “first” goal (FORTRAN): execution efficiency. Still an important goal in some settings (C++, C). Many other criteria can be interpreted from the point of view of efficiency: programming efficiency: writability, reliability (security). maintenance efficiency: readability. Chapter 3 K. Louden, Programming Languages

Features that aid efficiency of execution Static data types allow efficient allocation and access. Manual memory management avoids overhead of “garbage collection”. Simple semantics allow for simple structure of running programs (simple environments - Chapter 8). Chapter 3 K. Louden, Programming Languages

Features that aid other design goals (note efficiency conflicts): Writability, expressiveness: no static data types (variables can hold anything, no need for type declarations). Reliability, writability, readability: automatic memory management (no need for pointers). Expressiveness, writability, readability: more complex semantics, allowing greater abstraction. Chapter 3 K. Louden, Programming Languages

Internal consistency of a language design: Regularity Regularity is a measure of how well a language integrates its features, so that there are no unusual restrictions, interactions, or behavior. Regularity issues can often be placed in subcategories: Generality: are constructs general enough? (Or too general?) Orthogonality: are there strange interactions? Uniformity: Do similar things look the same, and do different things look different? Chapter 3 K. Louden, Programming Languages

Regularity examples from C Functions are not general: there are no local functions (simplicity of environment). Declarations are not uniform: data declarations must be followed by a semicolon, function declarations must not. Parameters are not orthogonal with data type: arrays are references, other parameters are copies. Chapter 3 K. Louden, Programming Languages

K. Louden, Programming Languages What about Java? Are function declarations non-general? There are no functions, so a non-issue. (Well, what about static methods?) Are class declarations non-general? No multiple inheritance (but there is a reason: complexity of environment). Java has a good replacement: interface inheritance. Do declarations require semicolons? Local variables do, but is that an issue? (Not really - they look like statements.) Chapter 3 K. Louden, Programming Languages

Java regularity, continued Are some parameters references, others not? Yes: objects are references, simple data are copies. This is a result of the non-uniformity of data in Java, in which not every piece of data is an object. The reason is efficiency: simple data have fast access. What is the worst non-regularity in Java? My vote: arrays. But there are excuses. Chapter 3 K. Louden, Programming Languages

Other design principles Simplicity: make things as simple as possible, but not simpler. (Pascal, C) Expressiveness: make it possible to express conceptual abstractions directly and simply. (Scheme) Extensibility: allow the programmer to extend the language in various ways. (Scheme, C++) Security: programs cannot do unexpected damage. (Java) Chapter 3 K. Louden, Programming Languages

Other design principles (cont.) Preciseness: having a definition that can answer programmers and implementors questions. (Most languages today, but only one has a mathematical definition: ML) Machine-independence: should run the same on any machine. (Java) Consistent with accepted notations. (Most languages today, but not Smalltalk & Perl) Restrictability: a programmer can program effectively in a subset of the full language. (C++: avoids runtime penalties) Chapter 3 K. Louden, Programming Languages

K. Louden, Programming Languages C++ case study Thanks to Bjarne Stroustrup, C++ is not only a great success story, but also the best-documented language development effort in history: 1997: The C++ Programming Language, 3rd Edition (Addison-Wesley). 1994: The Design and Evolution of C++ (Addison-Wesley). 1993: A History of C++ 1979-1991, SIGPLAN Notices 28(3). Chapter 3 K. Louden, Programming Languages

K. Louden, Programming Languages Major C++ design goals OO features: class, inheritance Strong type checking for better compile-time debugging Efficient execution Portable Easy to implement Good interfaces with other tools Chapter 3 K. Louden, Programming Languages

Supplemental C++ design goals C compatibility (but not an absolute goal: no gratuitous incompatibilities) Incremental development based on experience. No runtime penalty for unused features. Multiparadigm Stronger type checking than C Learnable in stages Compatibility with other languages and systems Chapter 3 K. Louden, Programming Languages

K. Louden, Programming Languages C++ design errors Too big? C++ programs can be hard to understand and debug Not easy to implement Defended by Stroustrup: multiparadigm features are worthwhile No standard library until late (and even then lacking major features) Stroustrup agrees this has been a major problem Chapter 3 K. Louden, Programming Languages