2.1.1 Thinking Abstractly

Cards (11)

  • Abstraction
    • The process of removing excessive details to represent a problem of only its key features
    • A representation of reality
  • Generalisation
    • Part of process of Abstraction
    • Grouping together items with similar features which are relevant to problem
  • Need for Abstraction
    • Enables programmers to focus on important aspects of problem rather than the messy and unnecessary detail
    • Enables programmers to work on different aspects of problem
    • Enables programmers to use pre-built and built-in functions without concerning themselves with how they work
    • prevents program from getting too large
    • reduces time needed to be spent on the project
  • Examples of Abstraction
    1. Variables
    2. Objects
    3. Layers
    4. Data models
    5. Data Structures
    6. Entity-relationship diagrams
  • Abstraction vs Reality
    • in OOP, the objects are abstractions of real-world entities and the attributes and methods represent the real-world characteristics and actions
  • Data Abstraction
    Using a data structure without being concerned of how it works
  • Representational Abstraction:
    • analysing what is relevant to a given scenario and simplifying a problem based on this information
  • Abstraction by Generalisation:
    • grouping together items with similarities that are relevant to the problem (ignoring different features that are irrelevant to the problem)
    • solving new problems based on previous problems which already have an existing solution - involves using an algorithm that solves a problem and adapting it so it can solve similar problems
  • Data Abstraction
    • subcategory is abstraction where details about how data is being stored are hidden
    • as a result, programmers can make use of abstract data structures (stacks and queues) without knowing how the structures are implemented
  • Procedural Abstraction:
    • programmers can push and pop items to and from a stack without having any knowledge about the code used
    • once a procedure has been coded it can be used as a black-box
  • Devising an Abstract Model for a variety of situations:
    • can the problem be solved using a computer program?
    • if yes:
    • what are the key features of the problem?
    • how will it be used?
    • who will be using it?
    • what is the skill set of the target user group?
    • what features are required by target audience for the program?