1 / 12

Understanding Programming Process: Phases & Algorithms

Learn about computer programming process phases - problem-solving, implementation, and maintenance. Explore concepts of algorithms, programming languages, and their representations. Dive into programming languages from machine code to high-level languages like C++ and Java.

roundy
Download Presentation

Understanding Programming Process: Phases & Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 11: 10/1/2002 CS149D Fall 2002

  2. Outline • Skip section 3.6 and 3.7 • Overview of Computer Programming Process • Overview of algorithms and programming languages • Should cover section 4.1 from Brookshear Text, and sections 1.1-1.2 from Etter Text CS149D Fall 2002

  3. Computer Programming • Computer program • A sequence of instructions to be performed by a computer • Computer programming • The process of planning a sequence of steps for a computer to follow • Programming Process • Problem-solving phase • Implementation phase • Maintenance phase CS149D Fall 2002

  4. Programming Process1/3 • Problem-solving phase • Analysis and specification ( understand and define problem, and what is expected of solution) • General solution (algorithm: a logical sequence of steps that solves the problem) • Verification (Follow steps to make sure solution solves the problem) • Implementation phase • Concrete solution (Program in a Programming language) • Testing (make sure the program produces the desired results) • Maintenance phase • Use Program • Maintain Program (meet changing requirements) CS149D Fall 2002

  5. Programming Process2/3 Analysis and Specification Concrete solution (Program) General solution (algorithm) Testing Verification Maintenance Phase Documentation: writing program documentation, and user manuals In “Programming and Problem Solving with C++”, 3rd Edition, Jones and Bartlett Publishers, 2002 CS149D Fall 2002

  6. Programming Process3/3 How about we take a shortcut and start the programming process by the implementation phase? Costly shortcut Develop a general solution (algorithm) first Think first and code later! CS149D Fall 2002

  7. Algorithm1/3 • Algorithm • An ordered set of unambiguous executable steps, defining a terminating process • A step-by-step procedure for solving a problem in a finite amount of time • Make a list of all positive integers • Arrange the list in descending order (from largest to smallest) • Extract the first integer from the list • What are the problems with these instructions? CS149D Fall 2002

  8. Algorithm2/3 • Difference between an algorithm and its representation • Analogous to difference between a story and a book • An algorithm is abstract and can be represented in many ways • Algorithm for converting from Celsius to Fahrenheit can be represented as • 1. F = (9/5) C + 32 (algebraic equation) • 2. “ Multiply the temperature reading in Celsius by 9/5 and then add 32 to the product” An algorithm can be represented using some sort of language 1950s, 1960s  represented using flowcharts pseudocode (precisely defined textual structures) CS149D Fall 2002

  9. Algorithm3/3 • An algorithm for starting the car • Insert the key in ignition • Make sure transmission is in Park (or Neutral) • Depress the gas pedal • Turn key to start position • If engine starts within six seconds, release key to ignition position • If engine does not start in six seconds, release key and gas pedal, wait ten seconds, and repeat steps 3 through 6, but not more than five times • If the car does not start, call the garage CS149D Fall 2002

  10. Programming Language1/3 • A set of rules, symbols, and special words used to construct a computer program. There are rules for syntax (grammar) and semantics (meaning) • Machine language • Binary-coded instructions • Closely coupled with design of computer hardware • Assembly language • Low-level programming language in which a mnemonic is used to represent each of the machine language instructions • We have seen an example in chapter 2 from Brookshear Text • We need an assembler • Translate an assembly language program into machine code CS149D Fall 2002

  11. Programming Language2/3 • High-level language • closer to English and other natural languages • C++, Java, C, Fortran, Ada, Pascal, COBOL, BASIC • We need a compiler • Translate a high-level language program into machine code • Source program • Program written in a high-level language • Object program • Machine language version of a source program • Difference between compilation and execution of a program CS149D Fall 2002

  12. Programming Language3/3 • Some programming languages are translated by an interpreter (some versions of BASIC) • Interpreter translates and executes each instruction in the source program • Java uses both a compiler and interpreter CS149D Fall 2002

More Related