1 / 17

What is Programming?

What is Programming?. A program is a list of instructions that is executed by a computer to accomplish a particular task . Creating those instructions is programming by a programmer. Programming language : Special language (like French or German) Understood by the computer

barbra
Download Presentation

What is Programming?

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. What is Programming? • A program is a list of instructions that is executed by a computer to accomplish a particular task. • Creating those instructions is programming by a programmer

  2. Programming language: • Special language (like French or German) • Understood by the computer • Tells the computer what to do • Used by a programmer to write a program • Visual Basic, Java, C#, C++, COBOL • Machine language: • Language of the computer • Every “Programmer” language is converted to machine language • Consists of bits on or off only • Compiler or interpreter: • Software that translates programming languages to machine language

  3. Coding the program: • Select the programming language • Write the instructions • Using software to translate the program into machine language: • Programmers write instructions in English-like high-level languages • Compilers or interpreters change the programs into low-level machine language that can be executed • Syntax errors are identified by the compiler or interpreter

  4. Binary Machine Language – • all data types consist of 1s and 0s • 1 bit (0 or 1) • 4 bits = nibble • 1 byte = 8 bits = 2 nibbles • Is the storage for one character • 1 word = 4 bytes • 1 K = 1 KB = 1 kilobyte = 1,0240 bytes = 210 bytes • Kilo = 1,000 : 1 KB = 1,000 bytes • 1 Meg = 1 megabyte (MB) = 1 million = 1024 KB • 1 GB = 1 gigabyte (GB) = 1024 MB = 1,000,000,000 • Many people approximate to steps of 1000, not 1024

  5. Programming Languages • Machine Languages • 0110110111110111 0000000100000000 0000000100000000 • Assembly Languages • One programmer instruction converted to 1 machine level instruction • ADD A,B • High-level Languages • Looks more like English words and algebraic expressions • Examples of high level languages • Programmer instruction converted to many machine level • ADA BASIC • C++ FORTRAN • COBOL Java • Pascal Visual Basic

  6. One Machine Language Instruction Machine Language Generation Programmer written computer code Programmer written computer code Translator (Interpreter) Program(browser) Compiler Assembler FUNCTIONBrowsersnetscapeMS ExplorerJavascriptPHPASP Many machine Language Instructions .exe file Execute Execute MS Word, Windows XP, MS Excel, Vista, MS Explorer

  7. Writing Programs • To write a program in a high-level language, you need: • Appropriate software • A text editor to type and edit program statements • A debugger to help find errors in program code • A compiler or interpreter to translate the program into machine language

  8. Error Types • Logic errorsare more difficult to locate than syntax errors Syntax: the rules governing word usage and punctuation in the language(format, recipe, formula)

  9. Syntax Error Cycle

  10. A program must be free of syntax errors to be run, or executed, on a computer • The program will not compile or be translated • A message will point out the offending instruction • To function properly, the logic must be correct • The program will still execute • The output may be incorrect • The program may exit prematurely • The program may ABEND (Abnormal Termination) • The program may execute with no errors/problems

  11. Logic • A program must be free of syntax errors to be run, or executed, on a computer • To function properly, the logic must be correct • What’s wrong with this logic for making a cake?

  12. Two major programming techniques: • Procedural programming • Object-oriented programming • Procedural programming: focuses on the procedures that programmers create • Object-oriented programming: focuses on objects that represent real-world things and their attributes and behaviors • Both techniques employ reusable program modules

  13. Mainline Logical Flow Through a Program • Procedural program: one procedure follows another from beginning to end • Mainline logic has three distinct parts: • Housekeeping: steps to get ready • Main loop: instructions executed for every input record • End-of-job: steps taken at end of program • Break the logic down into at least three modules

  14. Mainline Logical Flow Through a Program

  15. Mainline Logical Flow Through a Program • Modularization of the program: • Keeps the job manageable • Allows multiple programmers to work simultaneously • Keeps the program structured

  16. Housekeeping Tasks • Housekeeping tasks: include all steps that occur at the beginning of the program • Declare variables • Open files • Perform one-time-only tasks such as printing headings • Read the first input record

  17. Annotate the Output • If the output consists of numbers or any data that has no explanatory text with it, you should annotate your output – this means to add some text so the user knows what the output means.

More Related