Chp-7&8

Cards (83)

  • Program Development Life Cycle
    • Analysis
    • Design
    • Coding
    • Testing
  • Analysis
    • abstraction, decomposition of the problem, identification of the problem and requirements
  • Design
    • decomposition, structure diagrams, flowcharts, pseudocode
  • Coding
    • writing program code and iterative testing
  • Testing
    • testing program code with the use of test data
  • Variable
    A storage location. It is a named value that contains data that can be changed throughout the execution.
  • Constant
    A storage location. It is a named location that contains a value that we don't want to change during the running of the program.
  • Meaningful Names
    • The name should describe exactly the type of data stored in it.
  • Variables
    • Use lower case letters at the start of variable names
    • Use either camel casing (without any white space, 1st letter is lower and every word starts with a capital letter [fileNotFound]) or snake casing (uses an underscore between words to create separation [build_docker])
  • Constants
    • Use "Const" at the start of the name
    • Capitalise name
    • Use either camel casing or snake casing
  • Constants
    • ConstTICKETPRICE = 25
    • Const_TICKET_PRICE = 25
  • Array
    • Can be either a specified or unspecified length
    • Always use the square brakets
  • Arrays
    • totalPrice = []
    • home_start_code = [0:4]
  • Mathematical operators
    • ==
    • !=, <>
    <
    >
    >=
    <=
  • Logical Operators
    • &&
    • ||
  • Algorithm
    A set of instructions/steps/rules that are followed to solve a problem.
  • Algorithm design
    • Pseudocode
    • Flowcharts
  • Pseudocode
    • A method of expressing an algorithm design
    • Pseudocode is lines of instructions written in a language close to English but with common programming terms used where possible (selection and iteration etc)
    • Pseudocode is set out with the same structure as a programming language, but it is not a not programming language in itself
  • Pseudocode
    • a non-proportional font is used throughout
    • all keywords (words used to describe a specific action e.g. INPUT) are written in capital letters
    • all names given to data items and subroutines start with a capital letter
    • where conditional and loop statements are used, repeated or selected statements are indented by two spaces
  • Flowcharts
    • A graphical way of representing an algorithm design
    • A flowchart must have a clear start and finish (unless looping)
  • Sequence
    In an algorithm, each instruction is written one after the other
  • Selection or Conditional statements
    Creating the ability to choose the path to follow in a program
  • Types of Selection
    • IF.. THEN .. ELSE .. ENDIF
    • CASE .. OF .. OTHERWISE .. ENDCASE
  • IF.. THEN .. ELSE .. ENDIF
    • A logical condition is tested
    • A positive (true) outcome will result in the THEN statements of code being executed
    • A negative (false) outcome will result in the ELSE statements
  • Purpose Of A Conditional Statement
    To allow different routes through a program dependent on meeting certain criteria
  • Iteration (Looping)

    In a program there will be some instructions that need to be repeated. To repeat instructions we put them in a loop and this is referred to as iteration.
  • Types of Iteration
    • FOR .. TO .. NEXT
    • REPEAT .. UNTIL
    • WHILE .. DO .. ENDWHILE
  • FOR .. TO .. NEXT
    • Amount of iterations (times around the loop) is predetermined (fixed) at beginning of the loop
    • Already know how many iterations of the code is required
  • REPEAT .. UNTIL
    • Condition/check is placed at the bottom of the loop, this is referred to as bottom testing (or a post condition)
    • At least one iteration of the loop will be executed
    • If an exit criteria has been met yet
  • WHILE .. DO .. ENDWHILE
    • Condition is placed at the start of the loop, this is referred to as top testing (or a pre-condition)
    • Criteria has been met yet (to exit the loop)
  • Procedures and Functions
    • A SUB-ROUTINE is a set of programming instructions for a given task that forms a sub-system, not the whole system. Sub-routines written in high-level programming languages are called 'procedures' or 'functions'
    • A procedure is a set of programming statements grouped together under a single name that can be called to perform a task at any point in a program
    • A function is a set of programming statements grouped together under a single name that can be called to perform a task at any point in a program. In contrast to a procedure, a function will return a value back to the main program
    • Parameters are the variables that store the values of the arguments passed to a procedure or function. Some but not all procedures and functions will have parameters.
  • Counting
    Counting is used with repetition with the counter increased by 1 every time the loop is repeated.
  • Totalling
    Totalling is used with repetition with the total updated every time the loop is repeated.
  • Predefined Function
    a pre-programmed set of instructions that return a value.
  • Library
    a store of pre-programmed instructions that can be imported into a program
  • Predefined Procedures
    a pre-programmed set of instructions that do not return a value.
  • Global Variable
    can be used by any part of a program - its scope covers the whole program.
  • Local Variable
    can only be used by the part of the program it has been declared in - its scope is restricted to that part of the program.
  • Array
    A data structure containing several elements of the same data type; these elements can be accessed using the same identifier name.
  • Element
    An individual data location in an array.