1 / 21

Software – Computer Programs

Software – Computer Programs. “Computers do exactly what you tell them to do. This is often quite different from what you meant to tell them to do.”. Programming. What is programming? Creation of order Planning or scheduling the performance of a task What is computer programming?

dympna
Download Presentation

Software – Computer Programs

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. Software – Computer Programs “Computers do exactly what you tell them to do. This is often quite different from what you meant to tell them to do.”

  2. Programming • What is programming? • Creation of order • Planning or scheduling the performance of a task • What is computer programming? • “The process of specifying the data types and the operations for a computer to apply to data in order to solve a problem”.

  3. Data and Information • Information • any knowledge that can be communicated. • Data • information in a form the computer can use • comes in different forms : letters, words, integer numbers, real numbers, dates, times, coordinates on a map etc. Each type of data is said to have a specific data type

  4. Computer program “Data type specifications and instructions for carrying out operations that are used by a computer to solve a problem”

  5. How do we write a Program? PROBLEM-SOLVING PHASE IMPLEMENTATION PHASE Analysis and specification Concrete solution (program) General solution (algorithm) Test verify Maintenance phase

  6. Programming Language • Set of rules, symbols and special words used to construct a computer program • Simplified form of English ( with math symbols) that adheres to a strict set of grammatical rules • Why not translate from English directly into instructions for the computer? • Too complicated • Too ambiguous

  7. Other terms • Coding • Translating an algorithm into a programming language • Running code • Execution of code • Debugging • Determining what is wrong with a program and modifying it, or the algorithm, to fix it. • Implementation • Coding and testing of an algorithm

  8. Simon’s Java code Programming shortcut: More time spent debugging and revising program “Think first and code later!” Differences in implementation John’s Java code John’s C++ code PROBLEM John’s Pascal code Algorithm Peter’s Java code Mary’s Java code

  9. “Programmers who pay close attention to their programs by checking them before running them actually spend significantly less time producing successful programs. In contrast those programmers who simply write a program and then run it to see what it does spend more time.”

  10. How is a program converted into a form that a computer can use? • What is the form of data that the computer uses? • All data is converted into a set of binary codes, strings of 1s and 0s • Binary codes are distinguished by the manner in which the computer uses them. • Machine language

  11. Machine language to High-level languages • Machine language • made up binary-coded instructions used directly by the computer • tedious and error prone • programs were difficult to read and modify • Assembly language • Low-level programming language in which a mnemonic is used to represent each of the machine language instructions for a particular computer Assembly Language Machine Language ADD 100101 SUB 010011

  12. Machine language to High-level languages • Assembly language • Computer not able to process instructions directly hence a program, written in machine language, was used to translate from assembly language to machine language: Assembler • Easier for humans to use than machine language however programmers still forced to think in terms of individual machine instructions • High-level languages • Closer to English, and other natural languages, than assembly and machine languages.

  13. PROBLEM SOLVING TECHNIQUES ALGORITHMS PSEUDOCODE JAVA COMPILER HUMAN THOUGHT NATURAL LANGUAGE HIGH LEVEL PROGRAMMING LANGUAGE problem MACHINE CODE

  14. Converting a high-level language to machine language • Compiler • A program that translates a program written in a high-level language into machine code • Source code • Data type specifications and instructions written in a high-level programming language • Object code • A machine language version of a source code • Bytecode • A standard machine language into which Java source code is compiled

  15. Windows PC Running JVM Java program Java Compiler Java Bytecode UNIX Workstation Running JVM Macintiosh Running JVM Java compiler produces Bytecode that can be run on any machine with the JVM • Java Virtual Machine (JVM) a program that serves as a language interpreter • Bytecode is the machine language for the JVM Program running JVM Running on X Java Bytecode Machine Language for machine X INTERPRETATION

  16. Type of instructions • Reflect the operations a computer can perform • A computer can • transfer data from one place to another • receive input from and input device and write it to an output device • compare data values for equality or inequality • perform arithmetic operations • branch to a different section of the instructions • Programming languages require control structures to express algorithms as source code.

  17. Sequence Statement Statement Statement Selection True Statement1 Condition False Statement2 Selection False Condition True Statement1

  18. Subprogram/Method/Function STATEMENT1 SUBPROGRAM1 STATEMENT2 SUBPROGRAM1 A meaningful collection of any of the other control statements Asynchronous Control (Asynchronous –“not at the same time”, events can occur at any time) EVENT EVENTHANDLER A subprogram executed when an event occurs

  19. Object-Oriented Programming Languages • Earlier programming languages focused on the operations and control structures of programming – procedural languages • Procedural languages paid little explicit attention to the relationship between the operations and the data. There were few simple data types • Object-oriented languages focuses on the relationship between the operations and data

  20. Object-Oriented Programming Languages • OOPL allow us to collect a data type and its associated operations into a single entity called an object. • Objects make the relationship between the data type and operations explicit. • Objects are complete and self-contained hence promote reusability

  21. Object-oriented terminology • Class • A description of an object that specifies the types of data values that it can hold and the operations that it can perform • Classes are usually collected into packages • Instantiate • To create an object based on the description supplied by a class

More Related