Lecture 1: Preliminaries

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

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

0 Introduction: Computer systems and program development

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Chapter 1 Introduction to Computers and C++ Programming

CSI33 Data Structures

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

Chapter 1 Introduction to Computers and C++ Programming

Introduction to Programming

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

Programming for Problem Solving 105A L T P Credit Major Minor Total Time

CSc Introduction to Computing

C++ Programming Language Lecture 1 Introduction

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

Chapter 1 INTRODUCTION

Software Concepts. It is a translator that converts high level language to machine level language.

Lecture 1: CS2400 Introduction to Computer Science

The births of the generations are as follow. First generation, 1945 machine language Second generation, mid 1950s assembly language.

IS 0020 Program Design and Software Tools

1a Computers, Problem Solving!

Scientific Computing

Programming 1 - Honors

Chapter 3: Operating-System Structures

Fundamentals of Programming. Lecture 1: Introduction to C Programming

Chapter 1: Introduction to Computers and Programming

Week 1 Introduction to Computer and Algorithm (Part1) UniMAP Sem II 11/12 DKT121: Basic Computer Programming 1

CS 113: Introduction to

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

What is programming? What are computer languages and how have they evolved? What is the basic process of programming, including the tools involved?

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

Computer Software: Introduction

CHAPTER 1 Introduction to Computers and Java

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

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

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

Introduction. Arizona State University 1

Introduction to C++ Programming. Adhi Harmoko S, M.Komp

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

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

Chapter 1: Introduction

Operating-System Structures

Chapter 3: Operating-System Structures

Introduction to Computers, the Internet and the Web Pearson Education, Inc. All rights reserved.

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

CSC 453 Operating Systems

Unit 1: Introduction to Programming. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune

EP241 Computer Programming

SME1013 PROGRAMMING FOR ENGINEERS

Introduction to Computer Systems

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

Introduction to Computer Systems

ECS15, Lecture 10. Goals of this course 2/8/13. Mini-Review & Topic 3.2 Software. Today s agenda

Programming Languages and Program Development

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

CHAPTER 1: INTRODUCTION TO COMPUTERS AND PROGRAMMING. 1 Muhalim Mohamed Amin Faculty of

Motivation was to facilitate development of systems software, especially OS development.

Chapter 1: Introduction to Computers and Java

CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

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

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1

Principles of Programming Languages. Lecture Outline

Preview from Notesale.co.uk Page 6 of 52

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

by Pearson Education, Inc. All Rights Reserved.

Computer Architecture

Chris Riesbeck, Fall Introduction to Computer Systems

SCSP Programming Technique C

CS Prof J.P.Morrison

Module 3: Operating-System Structures. Common System Components

Computer Fundamentals: Pradeep K. Sinha & Priti Sinha

CS1500 Algorithms and Data Structures for Engineering, FALL Virgil Pavlu, Jose Annunziato,

Introduction to Java Programming

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

Motivation was to facilitate development of systems software, especially OS development.

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Introduction to Basis and Practice in Programming

Module 3: Operating-System Structures

Announcements. Java Review. More Announcements. Today. Assembly Language. Machine Language

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION

Operating Systems CS3502 Spring 2018

1. Fundamental Concepts

Chapter 2: Overview of C++

6.096 Introduction to C++ January (IAP) 2009

EECS 3221 Operating System Fundamentals

1 The Catholic University of Eastern Africa P.o Box , Nairobi Kenya Edward Kioko 2013

EECS 3221 Operating System Fundamentals

Review for COSC 120 8/31/2017. Review for COSC 120 Computer Systems. Review for COSC 120 Computer Structure

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

CSI32 Object-Oriented Programming

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

CS120 Computer Science I. Instructor: Jia Song

Presented By : Gaurav Juneja

EL2310 Scientific Programming

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

Chapter Twelve. Systems Design and Development

Programming Languages FILS Andrei Vasilateanu

Computer Programming : C++

Transcription:

Lecture 1: Preliminaries Edgardo Molina Department of Computer Science City College of New York August 30, 2011 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 1 / 44

Info and Schedule Course Info and Schedule http: //visionlab.engr.ccny.cuny.edu/ molina/f11-cs102/ Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 2 / 44

Software, Hardware, and Computer Storage Software, Hardware, and Computer Storage Programming Process of writing a program, or software Programming language Set of instructions used to construct a program Comes in a variety of forms and types Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 3 / 44

Software, Hardware, and Computer Storage Machine Language Only programs that can actually be used to operate a computer Also referred to as executable programs (executables) Consists of a sequence of instructions composed of binary numbers Contains two parts: an instruction and an address Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 4 / 44

Software, Hardware, and Computer Storage Assembly Language Substitute word-like symbols, such as ADD, SUB, and MUL, for binary opcodes Use decimal numbers and labels for memory addresses Example: ADD 1, 2 Assemblers: Translate programs into machine language Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 5 / 44

Software, Hardware, and Computer Storage Low- and High-Level Languages Low-level languages: Languages that use instructions tied directly to one type of computer Examples: machine language, assembly language High-level languages: Instructions resemble written languages, such as English Can be run on a variety of computer types Examples: Visual Basic, C, C++, Java Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 6 / 44

Software, Hardware, and Computer Storage Low- and High-Level Languages Source code: The programs written in a high- or low-level language Source code must be translated to machine instructions in one of two ways: 1 Interpreter: Each statement is translated individually and executed immediately after translation 2 Compiler: All statements are translated and stored as an executable program, or object program; execution occurs later C++ is a compiled language Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 7 / 44

Software, Hardware, and Computer Storage Low- and High-Level Languages Large C++ programs may be stored in two or more separate program files due to: Use of previously written code Use of code provided by the compiler Modular design of the program (for reusability of components) Linker: Combines all of the compiled code required for the program Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 8 / 44

Software, Hardware, and Computer Storage Procedural and Object Orientations Programs can also be classified by their orientation: Procedural: Available instructions are used to create self-contained units called procedures Object-oriented: Reusable objects, containing code and data, are manipulated Object-oriented languages support reusing existing code more easily C++ contains features of both Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 9 / 44

Software, Hardware, and Computer Storage Procedural and Object Orientations Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 10 / 44

Software, Hardware, and Computer Storage Application and System Software Application software: Programs written to perform particular tasks for users System software: Collection of programs to operate the computer system System software must be loaded first; called booting the system Bootstrap loader: A permanent, automatically executed component to start the boot process Operating system(os): The set of system programs used to operate and control a computer Tasks performed by the OS include: Memory management Allocation of CPU time Control of input and output Management of secondary storage devices Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 11 / 44

Software, Hardware, and Computer Storage Application and System Software Multi-user system A system that allows more than one user to run programs on the computer simultaneously Multitasking (multiprogrammed) system A system that allows each user to run multiple programs simultaneously Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 12 / 44

Software, Hardware, and Computer Storage The Development of C++ The purpose of most application programs is to process data to produce specific results Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 13 / 44

Software, Hardware, and Computer Storage The Development of C++ Early procedural languages included: FORTRAN: Formula Translation ALGOL: Algorithmic Language COBOL: Common Business Oriented Language BASIC: Beginners All-purpose Symbolic Instruction Code Pascal C Early object-oriented language: C++ Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 14 / 44

Software, Hardware, and Computer Storage Computer Hardware Computer hardware: Components that support the capabilities of the computer Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 15 / 44

Software, Hardware, and Computer Storage Computer Hardware Components include: Arithmetic and logic unit (ALU): Performs arithmetic and logic functions Control unit: Directs and monitors overall operations Memory unit: Stores instructions and data Input and output (I/O) unit: Interfaces to peripheral devices Secondary storage: Nonvolatile permanent storage such as hard disks Central processing unit (CPU): Also called microprocessor; combines the ALU and control unit on a single chip Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 16 / 44

Software, Hardware, and Computer Storage Computer Storage Bit Smallest unit of data; value of 0 or 1 Byte Grouping of 8 bits representing a single character Character codes Collection of patterns of 0s and 1s representing characters Examples: ASCII, EBCDIC Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 17 / 44

Origins of the C++ Language Origins of the C++ Language Why C++? Is there a C- or C language? How about A or B? Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 18 / 44

Origins of the C++ Language Origins of the C++ Language Why C++? Is there a C- or C language? How about A or B? There s a B language; it s not derived from A, but from a programming language called BCPL. Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 18 / 44

Origins of the C++ Language Origins of the C++ Language Why C++? Is there a C- or C language? How about A or B? There s a B language; it s not derived from A, but from a programming language called BCPL. The C language was derived from the B language. C++ is derived from C. Why the pluses? Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 18 / 44

Origins of the C++ Language Origins of the C++ Language Why C++? Is there a C- or C language? How about A or B? There s a B language; it s not derived from A, but from a programming language called BCPL. The C language was derived from the B language. C++ is derived from C. Why the pluses? ++ is an operation in the C and C++ languages, so using ++ produces a nice pun (C++ = D?) Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 18 / 44

Origins of the C++ Language C programming language Developed by Dennis Ritchie of AT&T Bell Lab in the 1970s. Originally designed for writing and maintaining UNIX operating system. Before then, UNIX system programs were written in assembly language. C is a high-level language with many of the features of a low-level language. pro Can directly manipulate the computer s memory (low-level); Easy to read and write than assembly language (high-level). con Not easy to understand as other languages; also, it does not have as many automatic checks as some other high-level languages. Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 19 / 44

Origins of the C++ Language C++ programming language To overcome the shortcomings of C, Bjarne Stroustrup of AT&T Bell Lab developed C++ in the early 1980s. It is supposed to be better than C. Most of C is a subset of C++, and so most C programs are also C++ programs (the reverse is not true). Unlike C, C++ has facilities to do object-oriented programming, which is a recently developed and very powerful programming technique. Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 20 / 44

Origins of the C++ Language A Sample C++ Program #include<iostream> using namespace std; Code int main() { cout<<"hello World!\n"; } return 0; Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 21 / 44

Origins of the C++ Language Layout of a Simple C++ Program #include<iostream> using namespace std; Code int main() { // variable declarations // statement 1 // statement 2 //... // statement last } return 0; Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 22 / 44

Origins of the C++ Language More Sample C++ Program #include<iostream> using namespace std; Code int main() { char letter; cout<<"hello CS102!\n"; cout<<"enter a letter to end the program: "; cin>>letter; } return 0; Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 23 / 44

Software Development Software Development Computer program: Self-contained set of instructions used to operate a computer to produce a specific result Also called software Solution developed to solve a particular problem, written in a form that can be executed on a computer Writing a program is almost the last step in a process that determines: The problem to be solved The method to be used in the solution Software development procedure: Helps developers understand the problem to be solved and create an effective, appropriate software solution Software engineering: Concerned with creating readable, efficient, reliable, and maintainable programs and systems Uses software development procedure to achieve this goal Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 24 / 44

Software Development Software Development The three phases of program development Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 25 / 44

Software Development Phase I: Development and Design Program requirement: request for a program or a statement of a problem After a program requirement is received, Phase I begins Phase I consists of four steps: 1 Analysis 2 Design 3 Coding 4 Testing Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 26 / 44

Software Development Phase I: Development and Design The development and design steps Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 27 / 44

Software Development Phase I: Development and Design Step 1: Analyze the Problem Determine and understand the output items the program must produce Determine the input items Both items referred to as the problem s input/output (I/O)? Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 28 / 44

Software Development Phase I: Development and Design A first-level structure diagram Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 29 / 44

Software Development Phase I: Development and Design Step 2: Develop a Solution Select the exact set of steps, called an algorithm, to be used to solve the problem Find the solution by a series of refinements Start with initial solution in the analysis step until you have an acceptable and complete solution Check solution Refine initial structure until the tasks in the boxes are completely defined Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 30 / 44

Software Development Phase I: Development and Design Example: a second-level structure diagram for an inventory tracking system with further refinements A second-level structure diagram Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 31 / 44

Software Development Phase I: Development and Design Step 3: Code the Solution Consists of actually writing a C++ program that corresponds to the solution developed in Step 2 Program statements should conform to certain well-designed patterns or structures that have been defined in solution step Program should contain well-defined patterns or structures of the following types: Sequence Defines the order in which instructions are executed Selection Allows a choice between different operations, based on some condition Iteration Allows the same operation to be repeated based on some condition. Also called looping or repetition Invocation Involves invoking a set of statements when needed Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 32 / 44

Software Development Phase I: Development and Design Step 4: Test and Correct the Program Testing Method to verify correctness and that requirements are met Bug A program error Debugging The process of locating an error, and correcting and verifying the correction Testing may reveal errors, but does not guarantee the absence of errors Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 33 / 44

Software Development Phase I: Development and Design The table below lists the comparative amount of effort typically expended on each development and design step in large commercial programming projects Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 34 / 44

Software Development Phase II: Documentation Five main documents for every problem solution: 1 Program description 2 Algorithm development and changes 3 Well-commented program listing 4 Sample test runs 5 Users manual Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 35 / 44

Software Development Phase III: Maintenance Maintenance includes: Ongoing correction of newly discovered bugs Revisions to meet changing user needs Addition of new features Usually the longest phase May be the primary source of revenue Good documentation vital for effective maintenance Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 36 / 44

Backup Software Development Process of making copies of program code and documentation on a regular basis Backup copies = insurance against loss or damage Consider using off-site storage for additional protection Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 37 / 44

Algorithms Algorithms Step-by-step sequence of instructions that: Must terminate Describe how the data is to be processed to produce the desired output Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 38 / 44

Algorithms Algorithms Pseudocode English-like phrases used to describe the steps in an algorithm Formula Mathematical equations Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 39 / 44

Algorithms Algorithms Problem: Calculate the sum of all whole numbers from 1 through 100 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 40 / 44

Algorithms Algorithms Problem: Calculate the sum of all whole numbers from 1 through 100 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 40 / 44

Algorithms Algorithms Problem: Calculate the sum of all whole numbers from 1 through 100 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 40 / 44

Summary Summary Software: Programs used to operate a computer Programming language types: Low-level languages Machine language (executable) programs Assembly languages High-level languages Compiler and interpreter languages Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 41 / 44

Summary Summary Software engineering: discipline concerned with creating readable, efficient, reliable, and maintainable programs Three phases in software development: 1 Program development and design 2 Documentation 3 Maintenance Four steps in program development and design: 1 Analyze the problem 2 Develop a solution 3 Code the solution 4 Test and correct the solution Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 42 / 44

Summary Summary Algorithm: Step-by-step procedure that describes how a task is performed Computer program: Self-contained unit of instructions and data used to operate a computer to produce a desired result Four fundamental control structures used in coding: 1 Sequence 2 Selection 3 Iteration 4 Invocation Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 43 / 44

After class... Summary Course s webpage: http: //visionlab.engr.ccny.cuny.edu/ molina/f11-cs102/ Install MinGW (C++ compiler); installation tutorial is on course s webpage. Read Chapter 1 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 44 / 44