Computer Programming.

Slides:



Advertisements
Similar presentations
Chapter 12 Computer Programming
Advertisements

Chapter 12 Computer Programming.
Computers Are Your Future
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.
Computers Are Your Future © 2006 Prentice Hall, Inc.
Computers: Tools for an Information Age
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Visual Basic Introduction IDS 306 from Shelly, Cashman & Repede Microsoft Visual Basic 5: Complete Concepts and Techniques.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 3 Planning Your Solution
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
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.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
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.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
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.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
CIS Computer Programming Logic
信息处理技术.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
CMPE13Cyrus Bazeghi 1 Programming Languages Telling computers what to do.
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
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.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
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.
The Software Development Process
1.
Chapter One An Introduction to Programming and Visual Basic.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
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.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
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.
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
Computer Programming.
Chapter 12: Computer Programming
Chapter 2- Visual Basic Schneider
Presentation transcript:

Computer Programming

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

Programming Basics Computer Programming and Software Engineering Programming Languages and Paradigms Program Planning Program Coding Program Testing and Documentation Programming Tools

Computer Programming and Software Engineering 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 Figure 12-1

Programming Languages and Paradigms Programming languages are made up of keywords and grammar rules designed for creating computer instructions Keywords can be combined with 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 First-generation languages Machine language Second-generation languages Assembly language Third-generation languages Easy-to-remember command words

Programming Languages and Paradigms 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

Programming Languages and Paradigms Figure 12-8

Program Planning 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 Problem statement: Assuming that there are two pizzas to compare, that both pizzas contain the same toppings, and that the pizzas could be round or square, and given the prices, shapes, and sizes of the two pizzas, the computer will print a message indicating which pizza has the lower price per square inch

Program Coding A text editor such as Notepad allows programmers to enter lines of code using a familiar word processing interface. Figure 12-11

Program Coding A VDE (visual development environment) provides programmers with tools to build substantial sections of a program Form design grid Control Properties Event Event- handling code Figure 12-12

Program Coding Controls, such as the Best Deal button, can be selected by a programmer from a properties list. Here a programmer is selecting the background color for the Best Deal button. Figure 12-13

Program Coding Figure 12-14

Program Testing and Documentation 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 Remarks or “comments” are a form of documentation that programmers insert into the program code Figure 12-16

Programming Tools 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) is a type of SDK that packages a set of development tools into a sleek programming application

Programming Tools 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 and C++ are the most popular programming languages Particle renderers Pathfinder algorithms

Procedural Programming Algorithms Expressing an Algorithm Sequence, Selection, and Repetition Controls Procedural Languages and Applications

Algorithms 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

Algorithms Figure 12-21

Expressing an Algorithm Structured English Pseudocode Figure 12-22

Expressing an Algorithm Flowchart The pizza program flowchart illustrates how the computer should proceed through the instructions in the final program. Figure 12-23

Expressing an Algorithm Perform a walkthrough to make sure your algorithm works Figure 12-24

Sequence, Selection, and Repetition Controls Sequence control structure Executing a GOTO command directs the computer to a different part of the program. Figure 12-25

Sequence, Selection, and Repetition Controls Subroutines, procedures, and functions are sections of code that are part of the program, but not included in the main sequential execution path Figure 12-26

Sequence, Selection, and Repetition Controls Selection control structure The computer executes a decision indicated on the flowchart by the question in the diamond shape. Figure 12-27

Sequence, Selection, and Repetition Controls Repetition control structure To execute a loop, the computer repeats one or more commands until some condition indicates that the looping should stop. Figure 12-28

Procedural Languages and Applications Popular procedural languages include FORTRAN, 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 well with certain types of problems Produces programs that run quickly and efficiently

Object-Oriented Programming Objects and Classes Inheritance Methods and Messages Object-oriented Program Structure Object-oriented Languages and Applications

Objects and Classes 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 Figure 12-30

Inheritance Passing certain characteristics from one class to other classes Superclass Subclass Class hierarchy Figure 12-33

Methods and Messages 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 Figure 12-39

Object-Oriented Program Structure Figure 12-40

Object-Oriented Program Structure 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. Figure 12-41

Object-Oriented Languages and Applications 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# The OO paradigm results in decreased runtime efficiency, but allows encapsulation, which hides the internal details of objects and their methods

Declarative Programming The Declarative Paradigm Prolog Facts Prolog Rules Input Capabilities Declarative Languages and Applications

The Declarative Paradigm 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 A decision table is a tabular method for visualizing and specifying rules based on multiple factors Figure 12-43

Prolog Facts Figure 12-44

Prolog Facts You can query a program’s database by asking a question, called a goal The ?- prompt allows you to query a set of Prolog facts and rules. Figure 12-46

Prolog Facts Finding a value for a variable is referred to as instantiation Prolog uses a process called instantiation to satisfy goals. Figure 12-47

Prolog Rules The order of program instructions is critically important Figure 12-48

Input Capabilities When the pizza program runs, the pizzainfo rule Figure 12-51 When the pizza program runs, the pizzainfo rule collects input for the prices, the sizes, and the shapes of two pizzas.

Declarative Languages and Applications 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

Secure Programming Black Hat Exploits Secure Software Development Mitigation

Black Hat Exploits Today’s operating systems, utilities, and application software are full of defects that create security holes, which are exploited by black hats A buffer overflow (also called a buffer overrun) is a condition in which data in memory exceeds its expected boundaries and flows into memory areas intended for use by other data

Black Hat Exploits Figure 12-53

Black Hat Exploits Verbose error messages can also present attackers with information about the directory location of programs or files, the structure of a database, or the layout of the program in memory Figure 12-54

Secure Software Development Most software security problems can be traced back to defects that programmers unintentionally introduce in software during design and development Formal methods help programmers apply rigorous logical and mathematical models to software design, coding, testing, and verification Threat modeling (risk analysis)

Secure Software Development

Secure Software Development An attack tree is a hierarchical diagram of potential attacks against a system Figure 12-56

Secure Software Development Defensive programming (also referred to as secure programming) is an approach to software development in which programmers anticipate what might go wrong as their programs run and take steps to smoothly handle those situations Source code walkthroughs Simplification Filtering input

Secure Software Development Signed code is a software program that identifies its source and carries a digital certificate attesting to its authenticity Figure 12-57

Mitigation Despite defensive programming and other tactics to produce secure software, some defects inevitably remain undiscovered in products that end up in the consumers’ hands When bugs are discovered, the programmer’s remaining line of defense is to produce a bug fix, or patch Figure 12-58

Mitigation Take the following steps to avoid security problems that stem from software defects Select applications from software publishers with a good security track record Watch for patches and apply them Consider using open source software, which has been extensively reviewed by the programming community Keep your firewall and antivirus software deployed and up-to-date

Computer Programming