Chapter 6: Programming Languages



Similar documents
Lecture 1: Introduction

OKLAHOMA SUBJECT AREA TESTS (OSAT )

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Fundamentals of Java Programming

Semester Review. CSC 301, Fall 2015

Programming and Software Development CTAG Alignments

Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

Fundamentals of Programming and Software Development Lesson Objectives

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

McGraw-Hill The McGraw-Hill Companies, Inc.,

CSCI 3136 Principles of Programming Languages

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

1/20/2016 INTRODUCTION

Programming Languages

Java (12 Weeks) Introduction to Java Programming Language

Chapter 12 Programming Concepts and Languages

Chapter 7: Software Engineering

CSC Software II: Principles of Programming Languages

Glossary of Object Oriented Terms

3 SOFTWARE AND PROGRAMMING LANGUAGES

Chapter 14. Programming and Languages. McGraw-Hill/Irwin. Copyright 2008 by The McGraw-Hill Companies, Inc. All rights reserved.

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

Java Application Developer Certificate Program Competencies

The C Programming Language course syllabus associate level

Software: Systems and Application Software

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

High level code and machine code

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Curriculum Map. Discipline: Computer Science Course: C++

Moving from CS 61A Scheme to CS 61B Java

Android Application Development Course Program

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages

CSE 307: Principles of Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Object-Oriented Software Specification in Programming Language Design and Implementation

ATSBA: Advanced Technologies Supporting Business Areas. Programming with Java. 1 Overview and Introduction

Evolution of the Major Programming Languages

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Semantic Analysis: Types and Type Checking

50 Computer Science MI-SG-FLD050-02

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

Course MS10975A Introduction to Programming. Length: 5 Days

Computing Concepts with Java Essentials

CS 111 Classes I 1. Software Organization View to this point:

Levels of Programming Languages. Gerald Penn CSC 324

MICHIGAN TEST FOR TEACHER CERTIFICATION (MTTC) TEST OBJECTIVES FIELD 050: COMPUTER SCIENCE

Domains and Competencies

El Dorado Union High School District Educational Services

CS 106 Introduction to Computer Science I

Computer Science/Software Engineering

CSE 130 Programming Language Principles & Paradigms

Formal Engineering for Industrial Software Development

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

Chapter 1 Fundamentals of Java Programming

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang

Computer Programming I & II*

Algorithms, Flowcharts & Program Design. ComPro

An Incomplete C++ Primer. University of Wyoming MA 5310

Computer Programming I

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

2014 HSC Software Design and Development Marking Guidelines

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

Crash Course in Java

CHAPTER 1 ENGINEERING PROBLEM SOLVING. Copyright 2013 Pearson Education, Inc.

Compiler Construction

Programming Languages

Principles of Programming Languages Topic: Introduction Professor Louis Steinberg

Lab Experience 17. Programming Language Translation

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

The programming language C. sws1 1

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

C++ Programming Language

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Title: Software Development

COMPUTER SCIENCE TRIPOS

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Functional Programming

Instructor Özgür ZEYDAN BEU Dept. of Enve. Eng. CIV 112 Computer Programming Lecture Notes (1)

Programming Language Pragmatics

Java the UML Way: Integrating Object-Oriented Design and Programming

1.1 WHAT IS A PROGRAMMING LANGUAGE?

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

The previous chapter provided a definition of the semantics of a programming

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Programming Languages & Tools

03 - Lexical Analysis

Introduction to Java

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Transcription:

Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective 6.2 Traditional Programming Concepts 6.3 Procedural Units 6.4 Language Implementation 6.5 Object Oriented Programming 6.6 Programming Concurrent Activities 6.7 Declarative Programming Copyright 2012 Pearson Education, Inc. 0-2 1

Figure 6.1 Generations of programming languages Copyright 2012 Pearson Education, Inc. 0-3 Second-generation: Assembly language A mnemonic system for representing machine instructions ti Mnemonic names for op-codes Identifiers: Descriptive names for memory locations, chosen by the programmer Copyright 2012 Pearson Education, Inc. 0-4 2

Assembly Language Characteristics One-to-one correspondence between machine instructions ti and assembly instructions Programmer must think like the machine Inherently machine-dependent Converted to machine language by a program called an assembler Copyright 2012 Pearson Education, Inc. 0-5 Program Example Machine language 156C 166D 5056 30CE C000 Assembly language LD R5, Price LD R6, ShipCharge ADDI R0, R5 R6 ST R0, TotalCost HLT Copyright 2012 Pearson Education, Inc. 0-6 3

Third Generation Language Uses high-level primitives Similar to our pseudocode in Chapter 5 Machine independent (mostly) Examples: FORTRAN, COBOL Each primitive corresponds to a sequence of machine language g instructions Converted to machine language by a program called a compiler Copyright 2012 Pearson Education, Inc. 0-7 Figure 6.2 The evolution of programming paradigms Copyright 2012 Pearson Education, Inc. 0-8 4

Figure 6.3 A function for checkbook balancing constructed from simpler functions Copyright 2012 Pearson Education, Inc. 0-9 Figure 6.4 The composition of a typical imperative program or program unit Copyright 2012 Pearson Education, Inc. 0-10 5

Data Types Integer: Whole numbers Real (float): Numbers with fractions Character: Symbols Boolean: True/false Copyright 2012 Pearson Education, Inc. 0-11 Variable Declarations float int char Length, Width; Price, Total, Tax; Symbol; Copyright 2012 Pearson Education, Inc. 0-12 6

Figure 6.5 A two-dimensional array with two rows and nine columns Copyright 2012 Pearson Education, Inc. 0-13 Figure 6.6 The conceptual structure of the aggregate type Employee Copyright 2012 Pearson Education, Inc. 0-14 7

Figure 6.7 The for loop structure and its representation in C++, C#, and Java Copyright 2012 Pearson Education, Inc. 0-15 Procedural Units Local versus Global Variables Formal versus Actual Parameters Passing parameters by value versus reference Procedures versus Functions Copyright 2012 Pearson Education, Inc. 0-16 8

Figure 6.8 The flow of control involving a procedure Copyright 2012 Pearson Education, Inc. 0-17 Figure 6.9 The procedure ProjectPopulation written in the programming language C Copyright 2012 Pearson Education, Inc. 0-18 9

Figure 6.10 Executing the procedure Demo and passing parameters by value Figure 6.11 Executing the procedure Demo and passing parameters by reference 10

Figure 6.12 The function CylinderVolume written in the programming language C Copyright 2012 Pearson Education, Inc. 0-21 Figure 6.13 The translation process Copyright 2012 Pearson Education, Inc. 0-22 11

Figure 6.14 A syntax diagram of our if-then-else pseudocode statement Copyright 2012 Pearson Education, Inc. 0-23 Figure 6.15 Syntax diagrams describing the structure of a simple algebraic expression Copyright 2012 Pearson Education, Inc. 0-24 12

Figure 6.16 The parse tree for the string x + y x z based on the syntax diagrams in Figure 6.17 Copyright 2012 Pearson Education, Inc. 0-25 Figure 6.17 Two distinct parse trees for the statement if B1 then if B2 then S1 else S2 13

Figure 6.18 An object-oriented approach to the translation process Copyright 2012 Pearson Education, Inc. 0-27 Objects and Classes Object: Active program unit containing both data and procedures Class: A template from which objects are constructed An object is called an instance of the class. Copyright 2012 Pearson Education, Inc. 0-28 14

Figure 6.19 The structure of a class describing a laser weapon in a computer game Copyright 2012 Pearson Education, Inc. 0-29 Components of an Object Instance Variable: Variable within an object Holds information within the object Method: Procedure within an object Describes the actions that the object can perform Constructor: Special method used to initialize a new object when it is first constructed Copyright 2012 Pearson Education, Inc. 0-30 15

Figure 6.21 A class with a constructor Copyright 2012 Pearson Education, Inc. 0-31 Object Integrity Encapsulation: A way of restricting access to the internal components of an object Private Public Copyright 2012 Pearson Education, Inc. 0-32 16

Figure 6.22 Our LaserClass definition using encapsulation as it would appear in a Java or C# program Copyright 2012 Pearson Education, Inc. 0-33 Additional Object-oriented Concepts Inheritance: Allows new classes to be defined in terms of previously defined classes Polymorphism: Allows method calls to be interpreted by the object that receives the call Copyright 2012 Pearson Education, Inc. 0-34 17

Programming Concurrent Activities Parallel (or concurrent) processing: simultaneous execution of multiple l processes True concurrent processing requires multiple CPUs Can be simulated using time-sharing with a single CPU Copyright 2012 Pearson Education, Inc. 0-35 Figure 6.23 Spawning threads Copyright 2012 Pearson Education, Inc. 0-36 18

Controlling Access to Data Mutual Exclusion: A method for ensuring that t data can be accessed by only one process at a time Monitor: A data item augmented with the ability to control access to itself Copyright 2012 Pearson Education, Inc. 0-37 Declarative Programming Resolution: Combining two or more statements to produce a new statement (that is a logical consequence of the originals). Example: (P OR Q) AND (R OR Q) resolves to (P OR R) Resolvent: A new statement deduced by resolution Clause form: A statement whose elementary components are connected by the Boolean operation OR Unification: Assigning a value to a variable so that two statements become compatible. Copyright 2012 Pearson Education, Inc. 0-38 19

Figure 6.24 Resolving the statements (P OR Q) and (R OR Q) to produce (P OR R) Copyright 2012 Pearson Education, Inc. 0-39 Figure 6.25 Resolving the statements (P OR Q), (R OR Q), R, and P Copyright 2012 Pearson Education, Inc. 0-40 20

Prolog Fact: A Prolog statement establishing a fact Consists of a single predicate Form: predicatename(arguments). Example: parent(bill, mary). Rule: A Prolog statement establishing a general rule Form: conclusion :- premise. :- means if Example: wise(x) :- old(x). Example: faster(x,z) :- faster(x,y), faster(y,z). Copyright 2012 Pearson Education, Inc. 0-41 21