Programming

Cards (34)

  • Computer program
    An ordered set of instructions to be performed by a computer
  • Computer program
    The solution to an existing problem
  • Computer program execution
    1. Fetch instruction
    2. Execute
    3. Repeat
  • High level language
    e.g. Python
  • Low level language
    e.g. machine code
  • Integrated Development Environment (IDE)
    Allows all tasks to be carried out in one application
  • IDE
    • Main reason we use an IDE is the Solution explorer
    • Debugger detects and corrects errors
    • GUI with toolbox
    • Source code editor
  • Source code editor
    • A basic window that allows you to enter source code
    • Provides developer with a clipboard, code auto-completion, code suggestion and syntax error assistance
  • IDE
    • Allows programmer to create windows applications on-screen
    • Contains buttons and combo-boxes giving 2 views of the GUI (Graphical or code based)
  • Compiler
    • Turns written program into an executable file
    • Converts written program code into machine code so it can be executed
    • Program must be error-free to be compiled
  • Translation of code
    1. Code written in high level language can only be understood by humans
    2. Must be translated into machine code so the computer can execute it
  • Types of translation
    • Interpreter
    • Compiler
    • Assembler
  • Interpreter
    • Translates source code programs line by line
    • Must be translated completely before proceeding to the next line
    • Errors are debugged as they are found
  • Compiler
    • Converts the whole program into machine code before executing the whole program at once
    • If the program contains errors, they are listed together by the computer
  • Assembler
    • Translates assembly language into machine code
    • Assembly language is already a low level language
  • Role of the compiler
    1. Lexical analysis - converting source code to fixed length binary tokens
    2. Pre-processing - including library code for classes within the source code
    3. Syntax analysis - checks that all statements follow the rules of grammar
    4. Semantic analysis - checking variables are declared before they are used in the program
    5. Code generation - creating the machine code from source code
    6. Code optimisation - making the executable program as efficient as possible
  • Algorithm
    • A set of steps that represent the solution to a problem
    • Order of the steps is important
  • Syntax
    • The rules of a programming language
    • Must be corrected before the program code can be compiled into machine code
  • Variable
    • A named location in computer memory used to hold a data value while the program is running
    • Variables can hold different values during the execution of a program
    • Most programming languages require the programmer to declare all variables and state their data type
  • Data types
    • Integers (whole numbers)
    • Real (decimals and fractions)
    • Character (letters, numbers, symbols)
    • Boolean (true/false)
    • String (sequence of characters)
  • Sequence
    The order in which instructions are performed in a computer program
  • Selection
    • The sequence of statements to be performed is determined by the input data
    • Allows decisions to be made based on the value of certain variables
  • Iteration
    Looping - a sequence of code is repeated a certain number of times
  • Count controlled loop
    A variable is used to control the loop, initialised and incremented each time the code loops
  • Condition controlled loop
    The sequence of code is repeated until a certain condition is met
  • Algorithms are used to help design the solution to a problem
  • Flowchart
    • A diagrammatic representation of an algorithm
    • Contains special symbols that represent the flow and control of actions specified in an algorithm
  • Class
    A template that describes the methods and properties that relate to a real world object
  • Object
    • A self-contained element that relates to a real world object
    • An instance of a class which describes details of the object's properties and methods
  • Property

    A data value within an object
  • Method
    • A routine within an object
    • Code that defines an action an object within the class can perform
    • Methods only have access to data within their own class
  • Inheritance
    • A new class can automatically have the methods and properties of an existing class
    • The new class can also define its own additional methods
  • Parent/Base Class
    An existing class whose methods and properties can be inherited
  • Child/Derived Class
    A class resulting from inheritance