CSI32 Object-Oriented Programming

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

Information Science 1

Introduction to Programming: Variables and Objects. HORT Lecture 7 Instructor: Kranthi Varala

Scientific Computing

Fundamentals of Programming Session 2

CSI33 Data Structures

An Introduction to Python (TEJ3M & TEJ4M)

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

INFS 214: Introduction to Computing

Lecture 15: Iteration and Recursion

Problem Solving With C++ Ninth Edition

CSI33 Data Structures

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Computing Seminar Introduction Oct

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

Software Development. Integrated Software Environment

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

COMP455: COMPILER AND LANGUAGE DESIGN. Dr. Alaa Aljanaby University of Nizwa Spring 2013

CSCE 110: Programming I

Programming Languages

Computer Software: Introduction

Programming Languages

Outline. Review of Last Week II. Review of Last Week. Computer Memory. Review Variables and Memory. February 7, Data Types

Topic 2: Introduction to Programming

Algorithms, Part 1 of 3. Problem Solving. Algorithms

Algorithms, Part 1 of 3

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

Command-line interface DOS Graphical User interface (GUI) -- Windows

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Information Science 1

A Set Of Machine Language Instructions For A Program Is Called Source Code >>>CLICK HERE<<<

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

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context

Chapter 1: Introduction to Computers and Programming

Syntax and Grammars 1 / 21

1/11/2010 Topic 2: Introduction to Programming 1 1

Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952. Computing for Biomedical Scientists

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

Basic Concepts. Computer Science. Programming history Algorithms Pseudo code. Computer - Science Andrew Case 2

MEIN 50010: Python Introduction

CHAPTER 1 Introduction to Computers and Java

CSI33 Data Structures

Problem Solving and Program Design - Chapter 1. Cory L. Strope

Beyond Base 10: Non-decimal Based Number Systems

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

Algorithm: 1. Introduction

1 Little Man Computer

An Overview of Compilation

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

CSCI 3136 Principles of Programming Languages

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

Chapter 1 Introduction to Computers

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

Introduction to Compiler Design

CSI33 Data Structures

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

6.096 Introduction to C++ January (IAP) 2009

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

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

Administration Computers Software Algorithms Programming Languages

Copyright 2005 Department of Computer & Information Science

Computers Programming Course 6. Iulian Năstac

The Programming Process Summer 2010 Margaret Reid-Miller

Beyond Base 10: Non-decimal Based Number Systems

Gaddis: Starting Out with Alice Test Bank Chapter One 1 Chapter One

Getting Started with Python

Java Primer 1: Types, Classes and Operators

Compiling Regular Expressions COMP360

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

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

Chapter 1: Why Program? Computers and Programming. Why Program?

SCoLang - Language Reference Manual

Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )

Lecture 1: Preliminaries

Low-Level Languages. Computer Programs and Programming Languages

C H A P T E R 1. Introduction to Computers and Programming

Modesto Junior College Course Outline of Record CMPSC 241

Contemporary Multilevel Machines

GE PROBLEM SOVING AND PYTHON PROGRAMMING. Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING

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

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

Programming Language. Machine Code. CS200: Computer Science I. Module 3 Programming Languages

PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops

Chapter 1: An Overview of Computers and Logic

Outline. policies. with some potential answers... MCS 260 Lecture 19 Introduction to Computer Science Jan Verschelde, 24 February 2016

SOFTWARE ARCHITECTURE 5. COMPILER

Winter 2019 CISC101 1/17/2019

Programming in C# with Microsoft Visual Studio 2010

CS187 - Science Gateway Seminar for CS and Math

Lecture 01 & 02 Computer Programming

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

Fundamentals of Programming (Python) Getting Started with Programming

Class List. Java Must Have. Class Goals. Class Goals. Schedule

Programming 1 - Honors

1DL321: Kompilatorteknik I (Compiler Design 1)

Arithmetic Operators. Binary Arithmetic Operators. Arithmetic Operators. A Closer Look at the / Operator. A Closer Look at the % Operator

The Compilation Process

Transcription:

Outline Department of Mathematics and Computer Science Bronx Community College February 2, 2015

Outline Outline 1 Chapter 1 Cornerstones of Computing

Textbook Object-Oriented Programming in Python Goldwasser and Letscher

Outline 1 Chapter 1 Cornerstones of Computing

Functions Abstract vs. Concrete Operations Processing concrete (low-level) data is closer to the machine, using machine operations: moving bits into memory or registers, adding binary digits. Processing abstract (high-level) data hides the low-level details by combining many low-level steps into a single operation.

Functions Built-in Operations for Built-in Data Types Each built-in type has operations that go with it. Examples from Python: int or float types allow addition (+), subtraction (-), multiplication (), and division (/ or //). bool allows and, or, and not.

Functions Built-in Control Structures All programming languages have these commands to control flow of programs: A loop causes a sequence of statements to be repeated for as long as a particular condition is met. A conditional statement is executed only when a particular condition is met.

Functions User-Defined Functions Functions can be written to help solve specific problems in programs. Procedural Abstraction: Separation of Concerns There are two aspects to any function: What it does and how it gets it done. Using a function should not require knowing how it works. Procedural abstraction is the discipline to keep these two issues completely separate. Writing a function this way provides a new, high-level abstract operation.

An algorithm is a step-by-step procedure. It can use variables, conditional expressions, looping, and sequences of steps. It can be expressed in English, pseudocode, flowcharts, or languages such as Python or C++.

Example: calculating the greatest common divisor of two integers gcd(u, v) Set u and v u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) Set u and v u v r 54 42 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) Set u and v u v r 54 42 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) Set u and v u v r 54 42 12 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 0 r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 0 6 0 r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 0 6 0 r = u % v No is v = 0? Yes The gcd is u

gcd(u, v) u v r Set u and v 54 42 12 42 12 6 u = v v = r 12 6 0 6 0 r = u % v No is v = 0? Yes The gcd is u

Low-level Languages Machine Language The central processing unit, or CPU of any computer electronically recognizes a small list of binary coded instructions (opcodes) for that CPU. This is called machine language. Assembly Language Early programming was done by using a mnemonic code (of text characters) for each opcode in a computer s machine language. A program, written using mnemonic codes, was assembled (translated) into machine language which could then run on the computer.

High-Level Languages Compiled vs. Interpreted Languages If the programs in a language are completely translated into machine language before they is executed, we say it is compiled language. If the programs in a language are translated and executed one statement at a time, the language is interpreted.

High-Level Languages Syntax vs. Semantics The syntax of a language is the set of rules that combines its parts (function and variable names, punctuation, and ẅhite space ) into meaningful statements. The semantics of a language is the meaning of any statement, which is derived from the meaning of its parts.

High-Level Languages Existing Languages C++ is a compiled object-oriented language. Python is an interpreted object-oriented language. Ruby is an interpreted object-oriented language. Perl is an interpreted object-oriented language. Java is a compiled object-oriented language.

High-Level Languages Level of Language is Relative From the viewpoint of machine language, assembly language is high-level, since it uses alphabetic codes ( add, jump, etc.) which are more meaningful than the binary opcodes of m achine language. From the viewpoint of Python, assembly language is low-level, since its commands are no more powerful than machine language.

High-Level Languages User-defined Data Types and Functions Produce Higher-Level Languages Once a new function has been defined, it can be used any time after that in the same way as a function that was built into the language. So the language has been changed into one that can use a new higher-level command. Once an abstract data type has been defined, it can be used any time after that in the same way as a datatype that was built into the language. So the language has been changed into one that can process a new kind of abstract data.