An Overview of Computers and Programming

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Lecture 1: Overview of Computers & Programming
Chapter 2: Modularization
Programming Logic and Design Fourth Edition, Introductory
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Logic
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
CIS105 Chapter 1 Theory Review. Page 2 Hardware and Software are the two major components o any computer system Hardware is the set of physical devices.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computers: Tools for an Information Age
An Overview of Computers and Logic
An Overview of Programming Logic and Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Programming Logic and Design Fourth Edition, Introductory
The Program Design Phases
Neal Stublen Computer Systems Hardware Display Keyboard Mouse Microphone Memory Chips Microprocessor.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Programming Logic and Design Fifth Edition, Comprehensive
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Introduction 01_intro.ppt
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A First Program Using C#
An Overview of Computers and Logic
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
Structured COBOL Programming, Stern & Stern, 9th edition
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
CIS Computer Programming Logic
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 1 An Overview of Computers and Programming.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Programming Logic and Design Seventh Edition
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 1: Introduction to Computers and Programming.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 1 An Introduction to Visual Basic.NET and Program Design.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
CSCI-235 Micro-Computer Applications
DDC 1023 – Programming Technique
Chapter 1 Introduction(1.1)
Chapter 2- Visual Basic Schneider
Programming Logic and Design Eighth Edition
Presentation transcript:

An Overview of Computers and Programming

Objectives In this chapter, you will learn about: Computer systems Simple program logic The steps involved in the program development cycle Pseudocode statements and flowchart symbols Programming and user environments The evolution of programming models

Understanding Computer Systems Combination of all the components required to process and store data using a computer Hardware Equipment associated with a computer Software System & Application Computer instructions that tell the hardware what to do Program Software written in a language to perform a particular function

Understanding Computer Systems (continued) Programming writing complete programs writing portions of a program ( modules ) Computer hardware and software accomplish three major operations: [ Information Processing Cycle ] Input accept input from a user or a file Process perform operations on the data in the program Output display output on a screen or write it to a file Store Program executes or runs Input will be accepted, some processing will occur, and results will be output

Understanding Computer Systems (continued) Programming language Used to write computer instructions Examples: Visual Basic, C#, C++, Java, Ada, Python, Ruby, Swift Syntax Rules governing the construction of valid statements in a language [ keywords, operators, identifiers, punctuation ] Conventions

Understanding Computer Systems (continued) Translator Compiler and/or an interpreter Translates program code into machine language (binary language) Checks for syntax errors Many modern languages use both a compiler and an interpreter

Understanding Simple Program Logic Program with syntax errors cannot execute Program with logic errors can execute, but… Errors in program logic produce incorrect output as a result Logic of the computer program Sequence of specific instructions in specific order Variable [ fundamental concept in program design ] Named memory location whose value can vary Syntax & Semantics

Understanding the Program Development Cycle Understand the problem Plan the logic Code the program Translate the program into machine language using software (a compiler and/or interpreter) Test the program Deploy the program (make available for use) Maintain the program Detailed information follows…

Understanding the Program Development Cycle (continued) Figure 1-1 The program development cycle Programming Logic & Design, Seventh Edition

Understand the Problem One of the most difficult aspects of programming Users (end users) People for whom program is written Documentation Supporting paperwork for a program flowchart / pseudocode hierarchy chart (aka structure chart) screen / printer spacing chart end user instructions

Plan the Logic Heart of the programming process Most common logic planning tools Flowcharts Pseudocode hierarchy chart Desk-checking Checking the logic of a program This is often a peer process

Code the Program Hundreds of programming languages are available Choose based on: features organizational requirements cost efficiency Most languages are similar in their basic capabilities Easier than planning step (not necessarily so for new programming students…)

Using Software to Translate the Program into Machine Language Translator program Compiler and/or interpreter Changes the programmer’s English-like high-level programming language into the low-level machine language Syntax error Misuse of a language’s grammar rules Programmer corrects listed syntax errors Might need to recompile the code several times misspelled variable names unmatched curly braces

Languages / File Types Source language Java, C++, Visual Basic, Python, etc. file types (extensions): java cpp vb py Compiled language (destination language) other high-level language ( cross compiler ) machine language virtual machine language (intermediate language) Java class file (.class) MSIL (Microsoft Intermediate Language) files types (extensions): class obj exe

Using Software to Translate the Program into Machine Language (continued) Figure 1-2 Creating an executable program Programming Logic & Design, Seventh Edition

Test the Program Logic error Run-time error Test Data Use a syntactically correct statement but use the wrong one for the current context Run-time error program ends abnormally when the user runs the program (sometimes or every time) Test Data Execute the program with some sample test data to see whether the results are logically correct

Deploy the Program Make the Program Available for Use Process depends on program’s purpose May take several months

Maintain the Program Maintenance Common first programming job Making changes after program is put into production Common first programming job Maintaining previously written programs Make changes to existing programs Repeat the development cycle

Using Pseudocode Statements and Flowchart Symbols Pictorial representation of the logical steps it takes to solve a problem Pseudocode Language-like representation of the logical steps it takes to solve a problem Statements in pseudocode look similar to statements in a high-level language Programming Logic & Design, Seventh Edition

Number Doubling Flowchart RAPTOR program

Writing Pseudocode Pseudocode representation of a number doubling problem [ with start / end ] ** RAPTOR convention for a subchart ** start int number, number_doubled //variable declarations put “Enter a number” get number number_doubled = number * 2 put number + “ doubled is “ + number_doubled end Programming Logic & Design, Seventh Edition

Writing Pseudocode Pseudocode representation of a number doubling problem [ with module name (number_doubler) and return ] number_doubler int number, number_doubled //variable declarations put “Enter a number” get number number_doubled = number * 2 put number + “ doubled is “ + number_doubled return Programming Logic & Design, Seventh Edition

Writing Pseudocode (continued) A module is usually prefaced with a beginning statement like start (or a module name) and end (or return) Flexible because it is a planning tool English-like Doesn’t require any software/hardware Programming Logic & Design, Seventh Edition

Drawing a Flowchart Create a flowchart Input symbol Processing symbols Draw geometric shapes that contain an individual action Connect shapes with arrows call flowlines Input symbol Indicates input operation Parallelogram Processing symbols Process (single statement) Predefined Process (module) Rectangle, rectangle with bars Connector symbol Used to connect flowlines small circle Programming Logic & Design, Seventh Edition

Drawing Flowcharts (continued) Output symbol Represents output statements Parallelogram Flowlines Lines and Arrows that connect steps Terminal symbols Start/End symbols Shaped like a racetrack Also described as a lozenge or capsule Programming Logic & Design, Seventh Edition

Using a Sentinel Value to End a Loop Making a decision Testing a value Decision symbol Diamond shape Dummy value Data-entry value that the user will never need Sentinel value eof (“end of file”) Marker at the end of a file that automatically acts as a sentinel Programming Logic & Design, Seventh Edition

Using a Sentinel Value to End a Loop (continued)

Understanding Programming and User Environments Many options for programming and user environments: simple text editor such as Notepad “Smart Editor” such as Brief or ConTEXT IDE (Integrated Development Environment) such as jGRASP or Visual Studio or Eclipse Programming Logic & Design, Seventh Edition

Understanding Programming Environments Use a keyboard to type program statements into an editor Plain text editor Similar to a word processor but without as many features Text editor that is part of an integrated development environment (IDE) Software package that provides an editor, compiler, and other programming tools Programming Logic & Design, Seventh Edition

Understanding Programming Environments (continued) A C# number-doubling program in Visual Studio Programming Logic & Design, Seventh Edition

Understanding User Environments Command line Location on your computer screen at which you type text entries to communicate with the computer’s operating system Graphical user interface (GUI) Allows users to interact with a program in a graphical environment Programming Logic & Design, Seventh Edition

Understanding User Environments (continued) Figure 1-13 Executing a number-doubling program in a command-line environment Programming Logic & Design, Seventh Edition

Programming Models People have been writing computer programs since the 1940s Newer programming languages Look much more like natural language Easier to use Create self-contained modules or program segments that can be pieced together in a variety of ways Programming Logic & Design, Seventh Edition

Programming Models Major models or paradigms used by programmers Procedural programming Focuses on the procedures that programmers create Object-oriented programming Focuses on objects, or “things,” and describes their features (or attributes) and their behaviors Major difference Focus the programmer takes during the earliest planning stages of a project Programming Logic & Design, Seventh Edition

Summary Computer programming Programmer’s job Requires specific syntax Must develop correct logic Programmer’s job Understanding the problem, planning the logic, coding the program, translating the program into machine language, testing the program, putting the program into production, and maintaining it Procedural and object-oriented programmers approach problems differently Programming Logic & Design, Seventh Edition