11/1/06 1 Hofstra University, CSC005 Chapter 8 (Part 3) High Level Programming Languages.

Slides:



Advertisements
Similar presentations
Subprograms Functions Procedures. Subprograms A subprogram separates the performance of some task from the rest of the program. Benefits: “Divide and.
Advertisements

C Language.
Programming Languages and Paradigms
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
The Web Warrior Guide to Web Design Technologies
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
High-Level Programming Languages
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
C# Programming: From Problem Analysis to Program Design1 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Chapter 8: Introduction to High-Level Language Programming Invitation to Computer Science, C++ Version, Fourth Edition.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
C++ fundamentals.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
Lesson15. JavaScript Objects Objects encapsulate data (properties) and behavior(methods); the properties and the methods of an object are tied together.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
Chapter 9 High-Level Programming Languages: C++. Chapter Goals Describe the expectations of high level languages Distinguish between functional design.
A First Program Using C#
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
REPETITION STRUCTURES. Topics Introduction to Repetition Structures The while Loop: a Condition- Controlled Loop The for Loop: a Count-Controlled Loop.
High-Level Programming Languages: C++
Chapter 8 High-Level Programming Languages. 2 Compilers High-level language A language that provides a richer (more English like) set of instructions.
Chapter 9 Object-Oriented Design and High-Level Programming Languages.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
Arrays – What is it? – Creation – Changing the contents Functions – What is it? – Syntax – How they work – Anonymous functions A quick lesson in Objects.
Problem Solving and Algorithms
Flow of Control. 2 Control Structures Control structure: An instruction that determines the order in which other instructions in a program are executed.
Chapters 7, 8, & 9 Quiz 3 Review 1. 2 Algorithms Algorithm A set of unambiguous instructions for solving a problem or subproblem in a finite amount of.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CPS120 Introduction to Computer Science Iteration (Looping)
Computer Concepts 2014 Chapter 12 Computer Programming.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
CPS120: Introduction to Computer Science Decision Making in Programs.
CPS120: Introduction to Computer Science Functions.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
CPS120: Introduction to Computer Science Lecture 14 Functions.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
JavaScript, Fourth Edition
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Functions, Part 1 of 2 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function Header Comments.
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
Introduction to Computers Lesson 13A. home Computer Program A set of instructions or statements, also called code, to be carried out by the computer’s.
1 UMBC CMSC 104, Section Fall 2002 Functions, Part 1 of 3 Topics Top-down Design The Function Concept Using Predefined Functions Programmer-Defined.
Functions, Part 1 of 3 Topics  Using Predefined Functions  Programmer-Defined Functions  Using Input Parameters  Function Header Comments Reading 
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Subprograms Functions Procedures.
Programming Logic and Design Seventh Edition
Types of Programming Languages
Computer Programming.
Event Driven Programming & User Defined Functions
High Level Programming Languages
Low Level Programming Languages
Mid-Term Review Good Results Always Answer Questions
Flow of Control.
The structure of programming
CPS120: Introduction to Computer Science
Thinking procedurally
Functions, Part 1 of 2 Topics Using Predefined Functions
Presentation transcript:

11/1/06 1 Hofstra University, CSC005 Chapter 8 (Part 3) High Level Programming Languages

11/1/06 2 Hofstra University, CSC005 Chapter Goals Define the concepts of a data type and strong typing Explain the concept of a parameter and distinguish between value and reference parameters Describe two composite data-structuring mechanisms Name, describe, and give examples of the three essential ingredients of an object-oriented language... Some Hands-On

11/1/06 3 Hofstra University, CSC005 A Little Hands On

11/1/06 4 Hofstra University, CSC005 Hello World document.write("Hello World!")

11/1/06 5 Hofstra University, CSC005 Looping Statements The while statement is used to repeat a course of action Let’s look at two distinct types of repetitions

11/1/06 6 Hofstra University, CSC005 Looping Statements Count-controlled loops Repeat a specified number of times Use of a special variable called a loop control variable Figure 8.4 Flow of control of while statement

11/1/06 7 Hofstra University, CSC005 Looping Statements Count-controlled loops

11/1/06 8 Hofstra University, CSC005 Looping Statements Event-controlled loops The number of repetitions is controlled by an event that occurs within the body of the loop itself

11/1/06 9 Hofstra University, CSC005 Looping Statements Event-controlled loops Page 249

11/1/06 10 Hofstra University, CSC005 var i=0 while (i<=10) { document.write("The number is " + i) document.write(" ") i=i+1 } Looping Statement

11/1/06 11 Hofstra University, CSC005 Looping Statement The number is 0 The number is 1 The number is 2 The number is 3 The number is 4 The number is 5 The number is 6 The number is 7 The number is 8 The number is 9 The number is 10

11/1/06 12 Hofstra University, CSC005 Subprogram Statements We can give a section of code a name and use that name as a statement in another part of the program When the name is encountered, the processing in the other part of the program halts while the named code is executed

11/1/06 13 Hofstra University, CSC005 Subprogram Statements There are times when the calling unit needs to give information to the subprogram to use in its processing A parameter list is a list of the identifiers with which the subprogram is to work, along with the types of each identifier placed in parentheses beside the subprogram name

11/1/06 14 Hofstra University, CSC005 Subprogram Statements Figure 8.5 Subprogram flow of control

11/1/06 15 Hofstra University, CSC005 Subprogram Statements Figure 8.5 Subprogram flow of control

11/1/06 16 Hofstra University, CSC005 Subprogram Statements Parameters Identifiers listed in parentheses beside the subprogram declaration; sometimes they are called formal parameters Arguments Identifiers listed in parentheses on the subprogram call; sometimes they are called actual parameters

11/1/06 17 Hofstra University, CSC005 Subprogram Statements Value parameter A parameter that expects a copy of its argument to be passed by the calling unit (put on the message board) Reference parameter A parameter that expects the address of its argument to be passed by the calling unit (put on the message board)

11/1/06 18 Hofstra University, CSC005 Subprogram Statements Page 253

11/1/06 19 Hofstra University, CSC005 Functions function displaymessage() { alert("Hello World!") } <input type="button" value="Click me!" onclick="displaymessage()" >

11/1/06 20 Hofstra University, CSC005 Recursion Recursion The ability of a subprogram to call itself Each recursive solution has at least two cases Base case The case to which we have an answer General case The case that expresses the solution in terms of a call to itself with a smaller version of the problem For example, the factorial of a number is defined as the number times the product of all the numbers between itself and 0: N! = N * (N  1)!

11/1/06 21 Hofstra University, CSC005 Asynchronous Processing Asynchronous processing The concept that input and output can be accomplished through windows on the screen Clicking has become a major form of input to the computer Mouse clicking is not within the sequence of the program A user can click a mouse at any time during the execution of a program This type of processing is called asynchronous

11/1/06 22 Hofstra University, CSC005 Composite Data Types Records A record is a named heterogeneous collection of items in which individual items are accessed by name The elements in the collection can be of various types

11/1/06 23 Hofstra University, CSC005 Composite Data Types

11/1/06 24 Hofstra University, CSC005 Composite Data Types Page 259

11/1/06 25 Hofstra University, CSC005 Arrays An array is a named collection of homogeneous items in which individual items are accessed by their place within the collection The place within the collection is called an index

11/1/06 26 Hofstra University, CSC005 Arrays Figure 8.8 Array variable tenThings accessed from 0..9

11/1/06 27 Hofstra University, CSC005 Functionality of Object-Oriented Languages Encapsulation Inheritance Polymorphism

11/1/06 28 Hofstra University, CSC005 Encapsulation Encapsulation A language feature that enforces information hiding Class A language construct that is a pattern for an object and provides a mechanism for encapsulating the properties and actions of the object class Instantiate Create an object from a class

11/1/06 29 Hofstra University, CSC005 Inheritance Inheritance A construct that fosters reuse by allowing an application to take an already-tested class and derive a class from it that inherits the properties the application needs Polymorphism The ability of a language to have duplicate method names in an inheritance hierarchy and to apply the method that is appropriate for the object to which the method is applied

11/1/06 30 Hofstra University, CSC005 Inheritance Inheritance and polymorphism combined allow the programmer to build useful hierarchies of classes that can be reused in different applications Figure 8.9 Mapping of problem into solution

11/1/06 31 Hofstra University, CSC005 Homework Read Chapter Eight, Sections 8.3 – 8.4 “PLAY” with JavaScript Do some of the hands-on examples in class Program Assignment (#2) Next Class

11/1/06 32 Hofstra University, CSC005 Mid-Term Good Results Some incompletes Will review next class

11/1/06 33 Hofstra University, CSC005 Have A Great Weekend