1-Introduction-to-Computer-Programming-Copy.pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

An Introduction to Computer Programming Disclaimer: This material is intended for educational purposes only. The used images and other information are owned by respective authors. Next Arrow Icon Special Green Round Button Stock Illustration - Download...

An Introduction to Computer Programming Disclaimer: This material is intended for educational purposes only. The used images and other information are owned by respective authors. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Logout exit icon symbol Royalty Free Vector Image Logout exit icon symbol Royalty Free Vector Image An Introduction to Computer Programming The Programming Language The Programming Process Data, Information, and Knowledge Algorithm Evolution of Programming Languages Debugging Data Hierarchy Aspects of Program Quality Computer Program An Introduction to Computer Programming Data, Information, and Knowledge DATA – are the raw facts, gathered from the environment which does not have much meaning. Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Data, Information, and Knowledge INFORMATION – is the end product of the processing of data, which has more meaning, and is used in decision making. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Data, Information, and Knowledge KNOWLEDGE – is the proved and generalized form of information, that is used in strategic planning. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Data, Information, and Knowledge DATA INFORMATION KNOWLEDGE Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Home Menu An Introduction to Computer Programming Evolution of Programming Languages Just as human beings, we communicate with each other through the use of languages such as English, Tagalog, Other Local Dialect, etc.. On the other hand, the programmers also use a variety of programming languages to communicate with the computer. Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages PROGRAMMING LANGUAGE – a set of rules, symbols, and special words used to construct a computer program. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages Programming language rules consist of: 1. Rules of SYNTAX which specify how valid instructions are written in the language. 2. Rules of SEMANTICS which determine the meaning of the instructions (what the computer will do). Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages Low Level Languages o Machine code o Assembler language Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages High Level Languages o Codes similar to everyday English o Use mathematical notations (translated via compilers) o High level languages are categorized into procedural and object-oriented languages. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 1st Generation: MACHINE LANGUAGE o Consists of binary numbers ▪ 0s - OFF ▪ 1s - ON o On and Off is the only process that computers understand. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock Evolution of Programming Languages 1st Generation: MACHINE LANGUAGE o It is the earliest programming language o Is the only language the computer understands without translation Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming An Introduction to Computer Programming Evolution of Programming Languages 1st Generation: MACHINE LANGUAGE o It is machine dependent; each family of processors has its own machine language Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 1st Generation: MACHINE LANGUAGE Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 2nd Generation: ASSEMBLY LANGUAGE o Is a low-level language o Uses brief abbreviations for program instructions, called mnemonics. Mnemonics is an alphabetic abbreviations used to represent instructions in assembly languages. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 2nd Generation: ASSEMBLY LANGUAGE o A program is written in source code (text file) and translated into machine language by an assembler Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages.model small.stack 100h.data msg db “Hello$” 2nd Generation:.code ASSEMBLY LANGUAGE mov ax, @data mov ds, ax... mov ax, 4ch int 21h Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: PROCEDURAL LANGUAGES (Structured and Modular) o Are high-level languages that tell the computer what to do and how to do it. o Reduces complex problems to collections of simple, interconnected modules – it combines structured and modular programming. o Create programs at a high level of abstraction o Are easier to read, write, and maintain than machine and assembly languages Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome Image Now - iStock - Download Menu An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: PROCEDURAL LANGUAGES (Structured and Modular) o Use a compiler or interpreter to translate code o Use instructions that more closely resemble to English language. o Procedural languages ▪ Fortran ▪ Cobol ▪ C ▪ Basic ▪ Pascal Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming 3rd Generation: Procedural language Evolution of Programming Languages (a) Structured Programming languages o Were developed to improve software development o Structured programming is a set of rules that prescribe good style habits for programmer. ▪ An organized, well-structured code ▪ Easily sharable; easy to debug and test ▪ Requires shorter time to develop, test, and update o Forbid the use of go to statements o Use three fundamental control structures: ▪ Sequence, Selection, Repetition Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome Image Now - iStock - Download Menu An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: Procedural language (b) Modular Programming languages o Were developed because of problems in structured programming languages o Complex tasks need to be broken down into simpler subtasks by dividing into separate modules or subroutines. ▪ Each module carries out a special function Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: Procedural language (b) Modular Programming languages o Three objectives when creating routines: 1. Smaller, simpler routines ▪ Breakup complex routines into simple functions 2. Strong cohesion ▪ Routine does one function such as printing ▪ Instructions are closely related Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: Procedural language (b) Modular Programming languages o Three objectives when creating routines: 3. Loose coupling ▪ Non-existent or weak connection between routines ▪ One routine does not depend on other routines Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: Object-Oriented Programming (OOP) Languages o Relies on component reusability ▪ The ability to produce program modules that perform a specific task o Eliminates the distinction between programs and data o Uses objects that contain data and procedures o Objects are units of information that contain data as well as methods that process and manipulate the data. Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 3rd Generation: Object-Oriented Programming (OOP) Languages o Classes of objects: ▪ Hierarchy or category of objects ▪ Objects at the top of the category are broader in scope than the subclass objects ▪ Objects near the bottom are narrower in scope o Inheritance refers to an object’s capacity to “pass on” its characteristics to its subclasses Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 4th Generation: o Fourth-generation languages are non- procedural, high-level specification languages o They do not force programmers to follow procedures to produce results (they’re very close to English, sometimes) o Types of 4GL includes: 1. Report generators – Languages for printing database reports (generate a program to generate the report) Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 4th Generation: o Types of 4GL includes: 2. Query languages – Languages for getting information out of databases (generate a program to process a query or generate a form) Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 4th Generation: o Types of 4GL includes: 3. Also include visually-oriented languages – More ambitious 4GL environments attempt to automatically generate whole systems from the outputs of CASE tools, specifications of screens and reports, and possibly also the specification of some additional processing logic, including data flow diagrams, entity relationship diagrams, entity life history diagrams Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages 5th Generation: o These include artificial intelligence and neural networks-oriented language Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Next Arrow Icon Special Green Round Button Stock IllustrationHome - Download Menu Image Now - iStock An Introduction to Computer Programming Evolution of Programming Languages Next Arrow Icon Special Green Round Button Stock Illustration - Download Image Now - iStock Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image Data Hierarchy Data Hierarchy Bits / Binary Digits Records Characters Files Fields Database Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION – The smallest data item in a computer. BITS / BINARY DIGITS – Can assume the value 0 or 1. Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION – DIGITS, LETTERS, AND SPECIAL SYMBOLS ARE KNOWN AS CHARACTERS. CHARACTERS – EVERY CHARACTER IS REPRESENTED AS PATTERN OF 1S AND 0S. – UNICODE, ASCII Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION – COMPOSED OF GROUP OF CHARACTERS OR BYTES. – A FIELD OF CONSISTING OF UPPERCASE AND FIELDS LOWERCASE LETTERS MAY REPRESENT PERSON’S NAME. – A FIELD OF CONSISTING OF DECIMAL DIGITS COULD REPRESENT A PERSON’S AGE. Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION – GROUP OF RELATED FIELDS. – E.G. PAYROLL SYSTEM- THE RECORD OF EMPLOYEE MIGHT CONSIST OF THE FOLLOWING FIELDS WITH POSSIBLE DATA TYPES:  EMPLOYEE ID NUMBER (WHOLE NUMBER)  NAME (STRING OF CHARACTERS) RECORDS  ADDRESS (STRING OF CHARACTERS)  HOURLY PER RATE (NUMBER WITH A DECIMAL POINT)  YEAR-TO-DATE EARNINGS (NUMBER WITH A DECIMAL POINT)  AMOUNT OF TAXES WITHHELD (NUMBER WITH A DECIMAL POINT) Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION FILES – GROUP OF RELATED RECORDS. Home Menu An Introduction to Computer Programming Data Hierarchy LEVEL DESCRIPTION – AN ELECTRONIC COLLECTION OF DATA THAT’S ORGANIZED FOR EASY ACCESS AND MANIPULATIONS. DATABASE – THE MOST POPULAR DATABASE MODEL IS THE RELATIONAL DATABASE IN WHICH DATA IS STORED IN SIMPLE TABLES.  A TABLE INCLUDES RECORDS AND FIELDS. Home Menu An Introduction to Computer Programming Data Hierarchy SUMMARY Levels of Data Hierarchy: 1. Bits / Binary Digits 2. Characters 3. Fields 4. Records 5. Files 6. Database Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image Computer Program What is Computer Program, Programmer, Programming? Data Instructions Compilers and Interpreters Home Menu An Introduction to Computer Programming Computer Program Computer Program (Software) – A set of instructions that directs the computer on its operations written using a programming language. Home Menu An Introduction to Computer Programming Computer Program Programmer – The person who writes a program. Home Menu An Introduction to Computer Programming Computer Program Programming – The act of developing a program. Home Menu An Introduction to Computer Programming Computer Program Program = Data + Instructions Home Menu An Introduction to Computer Programming Computer Program Data  there are several data types (numbers, characters, etc.)  each individual data item must be declared and named  each individual data item must have a value before use Home Menu An Introduction to Computer Programming Computer Program - Data Data  initial values come from  program instructions  user input  disk files Home Menu An Introduction to Computer Programming Computer Program - Data Data  program instructions can alter these values  for data input (from keyboard, disk)  for data output (to screen, printer, disk) Home Menu An Introduction to Computer Programming Computer Program - Instructions Instructions  computation of new values  program control (decisions, repetition)  modularization (putting a sequence of instructions into a package called a function) Home Menu An Introduction to Computer Programming Computer Program – Compilers and Interpreters Compilers and Interpreters  Compiler and Interpreter are used for high-level languages. Home Menu An Introduction to Computer Programming Computer Program – Compilers and Interpreters Interpreters Compilers  translates source code one line  is a program that changes at a time and executes the source code into an object instruction. code.  does not create separate file  all-in-one converter of high- for assembly code. level programming languages.  once the program is  produces executable files terminated, you need to re-run (.exe) – a readily program the whole program. (machine code) – no need to re-run the whole code Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image The Programming Process The Software Development Life Cycle (SDLC) The Five Phases of SDLC Home Menu An Introduction to Computer Programming The Programming Process Software Development Life Cycle (SDLC)  The SDLC was introduced in the 1970s to address problems in creating programs.  It provides an organized plan for breaking down the task of program development into manageable parts. Home Menu An Introduction to Computer Programming The Programming Process The 5 Phases of Software Development Life Cycle 1. Defining the problem 2. Designing the program 3. Coding the program 4. Testing, debugging, and formalizing the program 5. Implementing and maintaining the program Home Menu An Introduction to Computer Programming The Programming Process Phase 1: Defining the Problem Home Menu An Introduction to Computer Programming The Programming Process Phase 1: Defining the Problem  The first step in program development  What do you want to solve?  What is the objective and question?  Get the requirements from the client (possibly other software engineers) Home Menu An Introduction to Computer Programming The Programming Process Phase 1: Defining the Problem  Systems analysts provide program specifications (specs) to the programmers  The specs define:  Input data  Processing  Output  GUI Home Menu An Introduction to Computer Programming The Programming Process Phase 1: Defining the Problem  Software engineers need clear specifications (as opposed to requirements):  Clear, specific statement of goal  Expected output  Expected input Home Menu An Introduction to Computer Programming The Programming Process Phase 1: Defining the Problem  Software engineers need clear specifications (as opposed to requirements):  Clear, specific statement of goal  Expected output  Expected input Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program  Programmers create the program’s design:  Top-down design focuses on the program’s main goal (main routine), then breaks the program into manageable components (subroutines/modules)  Control structures are used to see how each subroutine will do its job  Makes programming easier to develop, debug, and maintain Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program  Developing an algorithm, which is a step-by-step description of how to arrive at a solution Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program  Program design tools:  Structure Charts – show the top-down design Home Menu An Introduction to Computer Programming The Programming Process Phase 2 Designing the Program  Program design tools:  Flowcharts – show the logic of program Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program  Program design tools:  Pseudocode – alternative to flowcharts. – English-like representation of the logical steps to solve a problem. Home Menu An Introduction to Computer Programming The Programming Process Phase 2: Designing the Program  Program design tools:  Pseudocode – Pseudo is a prefix means false, and to code a program means to put it in a programming language. – False code Home Menu An Introduction to Computer Programming The Programming Process Phase 3: Coding the Program Home Menu An Introduction to Computer Programming The Programming Process Phase 3: Coding the Program  Coding requires the translation of the algorithm into specific program instructions.  An appropriate programming language is chosen, and the code is typed according to its syntax rules. Home Menu An Introduction to Computer Programming The Programming Process Phase 3: Coding the Program  Documentation is created for future use.  Best if the documentation is done in-line using a tool like JavaDoc, Doxygen, etc.  The variable names and definitions, a description of the files needed, and the layout of the output are produced.  A user manual is developed to explain how the program works Home Menu An Introduction to Computer Programming The Programming Process Phase 4: Testing and Debugging the Program Home Menu An Introduction to Computer Programming The Programming Process Phase 4: Testing and Debugging the Program  Testing and debugging eliminate all errors.  Syntax and logic errors are corrected.  Debugging is the process of eliminating errors. Home Menu An Introduction to Computer Programming The Programming Process Phase 5: Implementing and Maintaining the Program Home Menu An Introduction to Computer Programming The Programming Process Phase 5: Implementing and Maintaining the Program  The program is:  Tested by users.  Thoroughly documented.  Maintained and evaluated regularly. Home Menu An Introduction to Computer Programming The Programming Process SUMMARY Five phases of SDLC: Phase 1 : Defining the Problem Phase 2 : Designing the Program Phase 3 : Coding the Program Phase 4 : Testing and Debugging the Program Phase 5 : Implementing and Maintaining the Program Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image Algorithm What is an Algorithm? Characteristics of an Algorithm Method for Developing an Algorithm Tools of Algorithm Home Menu An Introduction to Computer Programming Algorithm What is an algorithm?  The word “algo-rithm” comes to us from the name of a great ninth century mathematician, Mohammed ibn Musa Al-Khowa- rizmi.  His work, written in Arabic, came to have influence in Europe, where his algorithmic method of calculating competed successfully with the use of the abacus.  His misfortune was that algorithms came into their full use only with computer programming, more than a thousand years after he died. Home Menu An Introduction to Computer Programming Algorithm What is an algorithm?  An algorithm is a step-by-step procedure for solving a problem  with a finite amount of data  in a finite amount of time  It is a procedure for solving a problem in terms of:  The actions to execute, and;  The order in which the actions execute Home Menu An Introduction to Computer Programming Algorithm Home Menu An Introduction to Computer Programming Algorithm Characteristics of an Algorithm  Well-ordered: the steps are in a clear order.  Unambiguous: the operations are understood by the computer module without any further simplification.  Effectively computable: the computer module can actually complete the execution of the specified operations in a finite amount of time. Home Menu An Introduction to Computer Programming Algorithm Method for Developing an Algorithm  Define the problem: Describe the problem in clear and brief terms  List inputs: Clearly specify information needed for the solution of the problem (can be input from the keyboard, a file etc.) Home Menu An Introduction to Computer Programming Algorithm Method for Developing an Algorithm  List outputs: Describe the result that the algorithm will produce  Describe the steps needed to accomplish the desired result: How to manipulate/use the inputs to produce the desired output Home Menu An Introduction to Computer Programming Algorithm Method for Developing an Algorithm  Test the algorithm: Verify that the algorithm works.  IPO Chart – Input, Process, Output. Home Menu An Introduction to Computer Programming Algorithm Tools of Algorithm  Pseudocode  Flowchart Home Menu An Introduction to Computer Programming Algorithm Pseudocode  Pseudocode is structured English that is used as an alternative method to flowcharts for planning structured programs.  Consists of natural language-like statements that precisely describe the steps of an algorithm or program (Written in English and symbols, terms, etc.).  they can be easily understood and reviewed by users.  No language-specific elements. Home Menu An Introduction to Computer Programming Algorithm Pseudocode  There are no general accepted standards for pseudocode.  Emphasis is placed on expressing the behavior or outcome of each portion of code (logic of the algorithm or program) rather than on strictly correct syntax.  Not actually executed on computers. Home Menu An Introduction to Computer Programming Algorithm Pseudocode  (Optional) Steps are numbered.  Subordinate numbers and/or indentation are used for dependent statements in selection and repetition structures. Home Menu An Introduction to Computer Programming Algorithm Sample Pseudocode constructs  Assignment  Set num1 to 1  Num1 1  Computation  Use all arithmetic operators: addition (+), subtraction (-). Division (/), multiplication (*), modulus (%) … Home Menu An Introduction to Computer Programming Algorithm Sample Pseudocode constructs  Input  Input – to enter from the keyboard  Read – to read from a file  Output  Display – to display on screen  Print – to print on the printer Home Menu An Introduction to Computer Programming Algorithm Sample Pseudocode constructs  Selection  IF.. END IF  IF.. ELSE …END IF  IF.. ELSE IF.. ELSE …END IF  SWITCH.. CASE … Home Menu An Introduction to Computer Programming Algorithm Pseudocode Rules  Avoid the use of words peculiar to a particular programming language.  Indent lines to make the pseudocode easy to read and understand. Home Menu An Introduction to Computer Programming Algorithm Pseudocode Rules  Show key words (Move, Write, Read) in a different color, font, or capitalized.  Punctuation is optional.  End every If with EndIf. Home Menu An Introduction to Computer Programming Algorithm Pseudocode Rules  Begin every loop with a Loop instruction; End every loop with EndLoop.  Main routine is to be shown first.  Terminate all routines with an End instruction (e.g., EndMain). Home Menu An Introduction to Computer Programming Algorithm Sample Pseudocode Rules Home Menu An Introduction to Computer Programming Algorithm Flowchart  Flowchart is a graphic representation of an algorithm  often used in the design phase of programming to work out the logical flow of a program.  Uses symbols to represent each logical step of the algorithm. Home Menu An Introduction to Computer Programming Algorithm Flowchart  The order in which the steps are carried out is indicated by connecting “flow lines”  Use a few, basic flowchart symbols Home Menu An Introduction to Computer Programming Algorithm Flowchart  Single-entry/single-exit control structures  Case-Diagram Tool: https://app.diagrams.net/ Home Menu An Introduction to Computer Programming Algorithm Flowchart Symbols Home Menu An Introduction to Computer Programming Algorithm Flowcharting Rules  All boxes of the flowchart are connected with Arrows (Not lines).  Flowchart symbols have an entry point on the top of the symbol with no other entry points.  Exception: connector symbol circle used in loops. Home Menu An Introduction to Computer Programming Algorithm Flowcharting Rules  The exit point for all flowchart symbols is on the bottom.  Exception: The Decision symbol has two exit points; these can be on the sides or the bottom and one side.  Generally, a flowchart will flow from top to bottom, and left to right. Home Menu An Introduction to Computer Programming Algorithm Flowcharting Rules  Connectors are used to connect breaks in the flowchart. Examples are:  From one page to another page.  From the bottom of the page to the top of the same page. Home Menu An Introduction to Computer Programming Algorithm Flowcharting Rules  Subroutines have their own and independent flowcharts.  All flow charts start with a Terminal or Predefined Process symbol.  All flowcharts end with a terminal. Home Menu An Introduction to Computer Programming Algorithm Sample Algorithm with Flowchart Home Menu An Introduction to Computer Programming Algorithm Advantages Disadvantages o Quick o Difficult to understand complex Uses Text Processor logic o Mimics programming o Harder to see 'Big Picture' in code sequences, which complex solutions especially if makes the conversion alignment is poor and/or if Pseudocode into program code easier "nesting" of structures is deep o Spatially dense (permits a lot of activity to represented in a relatively small space) Home Menu An Introduction to Computer Programming Algorithm Advantages Disadvantages o Make communication on the logic of o Time consuming a system easier. o A picture is worth 1000 words. o Space consuming o Serve as a good program documentation, which is needed for o Requires template or various purposes. special software Flowcharts o Act as a guide or blueprint during the systems analysis and program development phase. o Aid in debugging process. o Make maintenance of programs easier Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image Debugging What is Bug and Debugging? Types of Error Desk Checking Home Menu An Introduction to Computer Programming Debugging  Bug – error/mistake  Debugging – the process of locating and correcting an error. Home Menu An Introduction to Computer Programming Debugging Types of Errors  Syntax Errors  Semantics Errors  Run-time Errors Home Menu An Introduction to Computer Programming Debugging Syntax Errors  Violation of grammar rules of the programming language detected during program translation.  Example – Omitting semicolon, Wrong spelling used in variable vs the declared variable.  Error Messages – contains a direct violation of the syntax rules  Warning Messages – unusual enough to indicate a likely mistake. “Are you sure you mean this?  Effect – Compiler helps user to identify the Syntax error and correct it. Home Menu An Introduction to Computer Programming Debugging Semantic Errors  Mistakes in the underlying algorithm or in translating the algo into the language.  Example – Wrong use of increment/decrement operators.  Effect – The Compiler cannot notice these errors, but on execution, they cause unexpected wrong results. These errors can only be corrected by the careful programmer.  Program does not perform properly.  Hardest kind to diagnose. Home Menu An Introduction to Computer Programming Debugging Run-Time Errors  Occur on program execution. Mostly caused by invalid data entry or tries to use none existing resources.  Example – Attempting to divide a number by 0.  Effect – It occurs on run time and may crash the program execution. Home Menu An Introduction to Computer Programming Debugging Desk Checking  Hand tracing  Using pencil and paper, along with sample data, to walk through each of the steps in the algorithm manually, just as if you were the computer.  Purpose: to verify that it will work as intended Home Menu Home Menu Logout exit icon symbol Royalty Free Vector Image Aspects of Program Quality Characteristics of a good program The Program Is Well Documented The Program Is Maintainable and modifiability Efficiency Robustness Usability Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program 1. The Program Is Well Documented Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program 2. The Program Is Maintainable and modifiability Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program 3. Efficiency Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program 4. Robustness Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program 5. Usability Home Menu An Introduction to Computer Programming Aspects of Program Quality - Characteristics of a good Program SUMMARY Characteristics of a Good Program: 1. The Program Is Well Documented 2. The Program Is Maintainable and modifiability 3. Efficiency 4. Robustness 5. Usability Home Menu Home Menu Home Menu Home Menu Home Menu

Use Quizgecko on...
Browser
Browser