Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.

Slides:



Advertisements
Similar presentations
Chapter 12 Computer Programming
Advertisements

Chapter 12 Computer Programming.
Chapter 3: Modularization
Computers Are Your Future
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Programming Creating programs that run on your PC
Chapter 2- Visual Basic Schneider
Computers: Tools for an Information Age
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and 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.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Computer Programming.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
11 Computer Programming Section A Programming Basics CHAPTER
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Computer Programming and Database Handout
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
1 Technology in Action Chapter 7 Behind the Scenes: Software Programming.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
Introducing Java.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
Programming Languages: Telling the Computers What to Do Chapter 16.
A First Program Using C#
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Microsoft Visual Basic 2005: Reloaded Second Edition
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
信息处理技术.
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
CMPE13Cyrus Bazeghi 1 Programming Languages Telling computers what to do.
Computer Concepts 2014 Chapter 12 Computer Programming.
1 Chapter 13 Understanding Computers, 11 th Edition 13 Program Development and Programming Languages TODAY AND TOMORROW 11 th Edition CHAPTER.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Copyright © Prentice Hall Programming and Languages Chapter 14 Telling the Computer What to Do.
Chapter 12 Computer Programming. 12 Chapter 12: Computer Programming 2 Chapter Contents  Section A: Programming Basics  Section B: Procedural Programming.
Computer Concepts 2013 Chapter 12 Computer Programming.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Computer Concepts 2014 Chapter 12 Computer Programming.
Unit 11 Programming.
Computer Concepts 2013 Chapter 12 Computer Programming.
Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming.
Chapter 12: Computer Programming 1 Computer Programming Chapter 12.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Your Interactive Guide to the Digital World Discovering Computers 2012 Chapter 13 Computer Programs and Programming Languages.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
Unit 11 Programming.
Chapter 12 Computer Programming.
CSCI-235 Micro-Computer Applications
DDC 1023 – Programming Technique
Chapter 2- Visual Basic Schneider
Computer Programming.
Chapter 12: Computer Programming
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
Programming Logic and Design Eighth Edition
Presentation transcript:

Chapter 12 Computer Programming

Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming  Section C: Object-Oriented Programming  Section D: Declarative Programming  Section E: Secure Programming

Programming Basics Chapter 12: Computer Programming 3  Computer Programming and Software Engineering  Programming Languages and Paradigms  Program Planning  Program Coding  Program Testing and Documentation  Programming Tools

Computer Programming and Software Engineering Chapter 12: Computer Programming 4  The instructions that make up a computer program are sometimes referred to as code  Programs can have millions of lines of code  Developed by computer programmers  Computer programming

Computer Programming and Software Engineering Chapter 12: Computer Programming 5

Programming Languages and Paradigms Chapter 12: Computer Programming 6  Programming languages are made up of keywords and grammar rules designed for creating computer instructions  Keywords can be combined with specific parameters  Low-level languages typically include commands specific to a particular CPU or microprocessor family  High-level languages use command words and grammar based on human languages

Programming Languages and Paradigms Chapter 12: Computer Programming 7  First-generation languages  Machine language  Second-generation languages  Assembly language  Third-generation languages  Easy-to-remember command words  Fourth-generation languages  More closely resembles human language  Fifth-generation languages  Based on a declarative programming paradigm The programming paradigm refers to a way of conceptualizing and structuring the tasks a computer performs

The evolution of programming paradigms 0-8 * different ways of thinking about communicating with the machine

Programming Languages and Paradigms Chapter 12: Computer Programming 9

Program Planning Chapter 12: Computer Programming 10  The problem statement defines certain elements that must be manipulated to achieve a result or goal  You accept assumptions as true to proceed with program planning  Known information helps the computer to solve a problem  Variables vs. constants

Program Planning Chapter 12: Computer Programming 11  Exercise in Logic: 1. Write the steps to walk into class and sit down in the first chair at the first table. 2. Write the program prints the phrase "Hello World" infinitely. Things to explain: a. Line numbers b. INPUT c. PRINT d. RUN Source Code 10 PRINT "Hello World!" 20 GOTO 10 Sample Run Hello World! Hello World! etc., etc....

Program Coding Chapter 12: Computer Programming 12  A VDE (visual development environment) provides programmers with tools to build substantial sections of a program in a graphical user interface (GUI) format  Form design grid  Control  Properties  Event  Event- handling code

Program Testing and Documentation Chapter 12: Computer Programming 13  A computer program must be tested to ensure that it works correctly  Program errors include:  Syntax errors  Runtime errors  Logic errors  A debugger can help a programmer read through lines of code and solve problems

Program Testing and Documentation Chapter 12: Computer Programming 14  Remarks or “comments” are a form of documentation that programmers insert into the program code

Programming Tools Chapter 12: Computer Programming 15  An SDK (software development kit) is a collection of language-specific programming tools that enables a programmer to develop applications for a specific computer platform  An IDE (integrated development environment) packages a set of development tools into a sleek programming application. The IDE provides tools for a programmer to make use of multiple SDKs.

Programming Tools Chapter 12: Computer Programming 16  A component is a prewritten module, typically designed to accomplish a specific task  An API is a set of application program or operating system functions that programmers can access from within the programs they create  C, Java, and C++ are the most popular programming languages  Particle renderers  Pathfinder algorithms

Procedural Programming Chapter 12: Computer Programming 17  Algorithms  Expressing an Algorithm  Sequence, Selection, and Repetition Controls  Procedural Languages and Applications

Algorithms Chapter 12: Computer Programming 18  Set of steps for carrying out a task that can be written down and implemented  Start by recording the steps you take to solve the problem manually  Specify how to manipulate information  Specify what the algorithm should display as a solution

Example Chapter 12: Computer Programming 19  Using BASIC to add, subtract, multiply and divide: Source Code 10 INPUT "ENTER TWO NUMBERS SEPARATED BY A COMMA: 20 LET S = N1 + N2 30 LET D = N1 - N2 40 LET P = N1 * N2 50 LET Q = N1 / N2 60 PRINT "THE SUM IS ", S 70 PRINT "THE DIFFERENCE IS ", D 80 PRINT "THE PRODUCT IS ", P 90 PRINT "THE QUOTIENT IS ", Q 100 END Sample Run ENTER TWO NUMBERS SEPARATED BY A COMMA: 4, 2 THE SUM IS 6 THE DIFFERENCE IS 2 THE PRODUCT IS 8 THE QUOTIENT IS 2

Expressing an Algorithm Chapter 12: Computer Programming 20  Structured English  Pseudocode

Expressing an Algorithm Chapter 12: Computer Programming 21  Perform a walkthrough to make sure your algorithm works

Sequence, Selection, and Repetition Controls Chapter 12: Computer Programming 22  Sequence control structure Executing a GOTO command directs the computer to a different part of the program.

Sequence, Selection, and Repetition Controls Chapter 12: Computer Programming 23  Selection control structure The computer executes a decision indicated on the flowchart by the question in the diamond shape.

Sequence, Selection, and Repetition Controls Chapter 12: Computer Programming 24  Repetition control structure To execute a loop, the computer repeats one or more commands until some condition indicates that the looping should stop.

Procedural Languages and Applications Chapter 12: Computer Programming 25  Popular procedural languages include COBOL, FORTH, APL, ALGOL, PL/1, Pascal, C, Ada, and BASIC  The procedural approach is best used for problems that can be solved by following a step- by-step algorithm  Does not fit gracefully with certain types of problems  Produces programs that run quickly and use system resources efficiently

Object-Oriented Programming Chapter 12: Computer Programming 26  Objects and Classes  Inheritance  Methods and Messages  Object-oriented Program Structure  Object-oriented Languages and Applications

Objects and Classes Chapter 12: Computer Programming 27  An object represents an abstract or real-world entity  A class is a template for a group of objects with similar characteristics  A class attribute defines the characteristics of a set of objects  Public vs. private attributes

Inheritance Chapter 12: Computer Programming 28  Passing certain characteristics from one class to other classes  Superclass  Subclass  Class hierarchy

Methods and Messages Chapter 12: Computer Programming 29  A method is a segment of code that defines an action  Collect input, perform calculations, etc.  A method is activated by a message  Can be defined along with the class they affect  Polymorphism refers to the ability to redefine a method in a subclass  Helps simplify program code

Object-Oriented Program Structure Chapter 12: Computer Programming 30

Object-Oriented Program Structure Chapter 12: Computer Programming 31

Object-Oriented Program Structure Chapter 12: Computer Programming 32 When the pizza program runs, on-screen prompts ask for the shape, size, and price of each pizza; then the program displays a message that indicates which pizza is the best deal.

Object-Oriented Languages and Applications Chapter 12: Computer Programming 33  SIMULA was believed to be the first object-oriented computer language  The Dynabook project was the second major development in object-oriented languages  Popular object-oriented languages today are Ada95, C++, Visual Basic, and C#  Facets of the object-oriented paradigm can also increase a programmer’s efficiency because encapsulation allows objects to be adapted and reused in a variety of different programs

Declarative Programming Chapter 12: Computer Programming 34  The Declarative Paradigm  Prolog Facts  Prolog Rules  Input Capabilities  Declarative Languages and Applications

The Declarative Paradigm Chapter 12: Computer Programming 35  Attempts to describe a problem without specifying exactly how to arrive at a solution  A fact is a statement for solving a problem  Rules describe the relationship between facts

The Declarative Paradigm Chapter 12: Computer Programming 36  A decision table is a tabular method for visualizing and specifying rules based on multiple factors

Declarative Languages and Applications Chapter 12: Computer Programming 37  Declarative programming languages are most suitable for problems that pertain to words and concepts rather than to numbers  Highly effective programming environment  Not commonly used for production applications  Minimal input and output capabilities  Poor performance on today’s personal computer architecture