Chapter 9. Introduction to High-Level Language Programming. INVITATION TO Computer Science

Similar documents
An Introduction to Python (TEJ3M & TEJ4M)

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

What is a programming language?

Software Development. Integrated Software Environment

Programming Languages and Program Development Life Cycle Fall Introduction to Information and Communication Technologies CSD 102

Computing and compilers

Introduction to Java Programming

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

Software Design. Levels in Design Process. Design Methodologies. Levels..

1) What is the first step of the system development life cycle (SDLC)? A) Design B) Analysis C) Problem and Opportunity Identification D) Development

Compilers and Interpreters

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

III. Check if the divisors add up to the number. Now we may consider each of these tasks separately, assuming the others will be taken care of

Chapter Twelve. Systems Design and Development

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

Computer Components. Software{ User Programs. Operating System. Hardware

Software Engineering Lifecycles. Controlling Complexity

Chapter 1. Introduction

Introduction to R programming a SciLife Lab course

PROGRAMMAZIONE I A.A. 2017/2018

PROBLEM SOLVING AND PYTHON PROGRAMMING

This tutorial also elaborates on other related methodologies like Agile, RAD and Prototyping.

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

10/11/2013. Chapter 3. Objectives. Objectives (continued) Introduction. Attributes of Algorithms. Introduction. The Efficiency of Algorithms

Simply Java Programming: An Application Driven, Tutorial

Semantic Analysis. Lecture 9. February 7, 2018

Introduction to R programming a SciLife Lab course

LESSON 13: LANGUAGE TRANSLATION

Computer Organization & Assembly Language Programming

Contemporary Multilevel Machines

CS 231 Data Structures and Algorithms, Fall 2016

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

CodeHS: Arkansas Standards Alignment

Introduction. CS 2210 Compiler Design Wonsun Ahn

Technology in Action. Alan Evans Kendall Martin Mary Anne Poatsy. Eleventh Edition. Copyright 2015 Pearson Education, Inc.

Chapter 2 Operating-System Structures

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

LECTURE 3 ADMINISTRATION SECTION -A

CS 6371: Advanced Programming Languages

CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards

Introduction to Problem Solving and Programming in Python.

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Crafting a Compiler with C (II) Compiler V. S. Interpreter

Programming 1 - Honors

Java Programming. Zheng-Liang Lu. Java 308 Spring Department of Computer Science & Information Engineering National Taiwan University

Introduction to R programming a SciLife Lab course

Unit E Step-by-Step: Programming with Python

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

G Programming Languages - Fall 2012

Topic 1: Programming concepts

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming with Mathematica

Introduction to Python Part 2

Introduction to Programming

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility


Appendix A: Objectives and Courseware Locations

Programmiersprachen (Programming Languages)

CMSC 132: OBJECT-ORIENTED PROGRAMMING II

Sub- PPL Unit-I Class-SE Comp

Computer Programming-1 CSC 111. Chapter 1 : Introduction

Java Bytecode (binary file)

Pioneering Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

MDSE USE CASES. Chapter #3

CSE 12 Abstract Syntax Trees

CSC Advanced Object Oriented Programming, Spring Overview

UNIT IV -MACROPROCESSOR

Identifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:

Verification and Validation

Verification and Validation

Tutorial 1 Answers. Question 1

Software Development Fundamentals (SDF)

Principles of Programming Languages. Lecture Outline

Chapter 13. The ISA of a simplified DLX Why use abstractions?

Programming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3

C++ Programming Language Lecture 2 Problem Analysis and Solution Representation

Lecture 01 & 02 Computer Programming

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Numerical Methods in Scientific Computation

Compilation I. Hwansoo Han

Compiling Techniques

Jython. secondary. memory

Where We Are. Lexical Analysis. Syntax Analysis. IR Generation. IR Optimization. Code Generation. Machine Code. Optimization.

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

CS101 Introduction to Programming Languages and Compilers

Outline. Program development cycle. Algorithms development and representation. Examples.

Rationale for TR Extension to the programming language C. Decimal Floating-Point Arithmetic

SCAN: Computer Science - second year. Christian Wolf

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

INSTITUTE OF AERONAUTICAL ENGINEERING

Algorithm: 1. Introduction

Programming 1. Lecture 1 COP 3014 Fall August 28, 2018

Curriculum Map Grade(s): Subject: AP Computer Science

Introduction. A. Bellaachia Page: 1

Why are there so many programming languages?

Transcription:

Chapter 9 Introduction to High-Level Language Programming INVITATION TO Computer Science 1

Objectives After studying this chapter, students will be able to: Explain the advantages of high-level programming languages over assembly language Describe the general process of translation from highlevel source code to object code Compare and contrast the ways languages express basic operations (Ada, C++, C#, Java, and Python) Explain the Favorite Number and Data Cleanup examples for each programming language Invitation to Computer Science, 6th Edition 2

Objectives (continued) After studying this chapter, students will be able to: Explain why the software development life cycle is necessary for creating large software programs List the steps in the software development life cycle, explain the purpose of each, and describe the products of each Explain how agile software development differs from the traditional waterfall model Invitation to Computer Science, 6th Edition 3

The Language Progression Assembly language improves on machine language Assembly language g disadvantages: Programmer must manage movement of data among memory locations and registers Microscopic view of task Machine specific languages Far from natural language Invitation to Computer Science, 6th Edition 4

The Language Progression (continued) High-level programming languages improve on assembly language Expectations: Programmer need not manage data in memory Macroscopic view of tasks (e.g., add B and C ) Programs portable from one machine to another Program statements closer to natural language and math notation Third-generation languages Invitation to Computer Science, 6th Edition 5

The Language Progression (continued) Need translator from high level languages Compiler converts source code to assembly code or similar Assembler or other converter makes object code Code libraries contain object code for useful tools Linker integrates multiple files of object code to create an executable module Invitation to Computer Science, 6th Edition 6

Invitation to Computer Science, 6th Edition 7

A Family of Languages Procedural (imperative) languages Popular kind of programming language Programs are sequences of statements Examples: Ada, C++, C#, Java, and Python Same underlying philosophy/modelp Variations in: Syntax: how statements are written Semantics: meaning of statements Invitation to Computer Science, 6th Edition 8

Two Examples in Five-Part Harmony Examine similarities and differences of the languages (Ada, C++, C#, Java, Python) through examples Favorite Number Ask user for her favorite number, tell her that your favorite number is one greater than hers Data Cleanup Converging Pointers algorithm from Chapter 3 Invitation to Computer Science, 6th Edition 9

Two Examples in Five-Part Harmony (continued) Focus on big picture, not grasping every detail Look for commonalities across languages Look for these identifiable patterns: Creation/declaration of variables Assignment of variables to values Arithmetic operations Reading input and writing output Markers for beginning and end of sections Conditionals (if statements) Loops (for or while loops) Invitation to Computer Science, 6th Edition 10

Two Examples in Five-Part Harmony (continued) First example: Favorite Number Simple program, no loops or conditionals Focus on input/output, variable creation and assignment Invitation to Computer Science, 6th Edition 11

Invitation to Computer Science, 6th Edition 16

Two Examples in Five-Part Harmony (continued) Second example: Data Cleanup, Converging Pointers Focus on loops and conditionals Invitation to Computer Science, 6th Edition 17

Figure 9.9 Ada converging-pointers algorithm (part 1) Invitation to Computer Science, 6th Edition 18

Figure 9.9 (continued) Ada converging-pointers algorithm (part 2) Invitation to Computer Science, 6th Edition 19

Figure 9.9 (continued) Ada converging-pointers algorithm (part 3) Invitation to Computer Science, 6th Edition 20

Figure 9.9 (continued) Ada converging-pointers algorithm (part 4) Invitation to Computer Science, 6th Edition 21

Figure 9.10 C++ converging-pointers algorithm (part 1) Invitation to Computer Science, 6th Edition 22

Figure 9.10 (continued) C++ converging-pointers algorithm (part 2) Invitation to Computer Science, 6th Edition 23

Figure 9.10 (continued) C++ converging-pointers algorithm (part 3) Invitation to Computer Science, 6th Edition 24

Figure 9.11 C# converging-pointers algorithm (part 1) Invitation to Computer Science, 6th Edition 25

Figure 9.11 (continued) C# converging-pointers algorithm (part 2) Invitation to Computer Science, 6th Edition 26

Figure 9.11 (continued) C# converging-pointers algorithm (part 3) Invitation to Computer Science, 6th Edition 27

Figure 9.11 (continued) C# converging-pointers algorithm (part 4) Invitation to Computer Science, 6th Edition 28

Figure 9.12 Java converging-pointers algorithm (part 1) Invitation to Computer Science, 6th Edition 29

Figure 9.12 (continued) Java converging-pointers algorithm (part 2) Invitation to Computer Science, 6th Edition 30

Figure 9.12 (continued) Java converging-pointers algorithm (part 3) Invitation to Computer Science, 6th Edition 31

Figure 9.12 (continued) Java converging-pointers algorithm (part 4) Invitation to Computer Science, 6th Edition 32

Figure 9.13 Python converging-pointers algorithm (part 1) Invitation to Computer Science, 6th Edition 33

Figure 9.13 (continued) Python converging-pointers algorithm (part 2) Invitation to Computer Science, 6th Edition 34

Invitation to Computer Science, 6th Edition 35

Feature Analysis Compare language features, and compare to pseudocode Syntax Describing data or variables Grouping things, making loops or conditionals Semantics Meaning of function call Meaning of operations Deeper structure Modules, classes, scope Invitation to Computer Science, 6th Edition 36

Meeting Expectations Programmer need not manage data in memory In each language, programmers must declare names (and sometimes types) for variables Program manages movement of data associated with a given variable name Macroscopic view of tasks (e.g., add B and C ) Languages provide statements for high-level math Details of conditionals and loops hidden Invitation to Computer Science, 6th Edition 37

Meeting Expectations (continued) Programs portable from one machine to another Programming languages are standardized Compiled languages g (Ada, C++, Java, C#) Compilers written for particular platform support standard, and translate to machine-specific forms Programmers distribute ib t executable or low level l bytecode, not source Interpreted languages g (like Python) require an interpreter on each machine, and distribute source code Invitation to Computer Science, 6th Edition 38

Meeting Expectations (continued) Program statements closer to natural language and math notation Math notation fairly standard across languages g Conditionals and loops are closer to natural language than assembly Invitation to Computer Science, 6th Edition 39

The Big Picture: Software Engineering Software development life cycle Process required to create large-scale software projects 25% to 40% of time spent on problem specification and program design 10% to 20% of time spent on initial iti implementation ti 40% to 65% of time spent reviewing, modifying, fixing, and improving software Invitation to Computer Science, 6th Edition 40

Invitation to Computer Science, 6th Edition 41

The Big Picture: Software Engineering (continued) Large software scale issues Orders of magnitude larger than beginner programs Compare one sentence to 300-page novel Software engineering Development of large software projects Requires collaboration, management, organization Formal processes for development Invitation to Computer Science, 6th Edition 42

The Big Picture: Software Engineering Life cycle: Feasibility study (continued) Assess costs and benefits Consider alternatives Problem specification Clear statement of problem to be solved Problem specification document Invitation to Computer Science, 6th Edition 44

The Big Picture: Software Engineering Life cycle: Program design phase (continued) Divide-and-conquer conquer, top-down decomposition Break problem into tasks and subtasks Program design document Algorithm selection/development and analysis Choose or design an algorithm for each subtask Analyze efficiency Document: describe algorithm in pseudocode, provide efficiency analysis, and rationale Invitation to Computer Science, 6th Edition 45

The Big Picture: Software Engineering Life cycle: Coding (continued) Translate pseudocode and design into working code Better design = easier coding Debugging g Correcting program errors: Syntax errors: ungrammatical code statements Runtime errors: illegal operations like divide-byzero Logic errors: errors in the algorithm itself Invitation to Computer Science, 6th Edition 46

The Big Picture: Software Engineering Life cycle: (continued) Testing, verification, and benchmarking Empirical testing: develop suite of tests to check correctness Unit testing: tests on each module/subtask Integration testing: test how modules work together Regression testing: when changes occur, test to be sure the change did not introduce errors Program verification: prove code correct Benchmarking: check performance on inputs Invitation to Computer Science, 6th Edition 47

The Big Picture: Software Engineering Life cycle: Documentation (continued) Internal documentation: comments in code External documentation: all earlier documents (problem spec, program design, etc.) Technical documentation: information for programmers to understand the code User documentation: help users run programs Program maintenance Add features, fix bugs, improve performance Invitation to Computer Science, 6th Edition 48

The Big Picture: Software Engineering (continued) Integrated development environment (IDE) Program editor File manager Compiler/interpreter Debugger Prototype tools Version and document management Invitation to Computer Science, 6th Edition 49

The Big Picture: Software Engineering (continued) Agile software development Alternative to the waterfall model shown before Philosophy: Problem specification is never done Change is expected, respond in agile way Customer/user involved throughout process Pair programming: Two programmers, one computer Code writer and observer roles, switched frequently Invitation to Computer Science, 6th Edition 50

Summary High-level languages: Hide details of memory and hardware operations Enable code portability Shift code statements toward natural language and math notation Programming languages may share an underlying philosophy, but vary in syntax and semantics details Ada, C++, C#, Java, and Python are all procedural languages g Invitation to Computer Science, 6th Edition 51

Summary (continued) Development of large software is a different kind of problem than writing a single algorithm Software development life cycles are designed to manage large software development Waterfall model starts with feasibility and problem specification and flows through debugging and testing Agile development moves quickly through the design-implement-test cycle, repeating it many times for a single project Invitation to Computer Science, 6th Edition 52