This is the topic: 2.1 Elements of Computational Thinking for the OCR Computer Science (H446) course. I got 4 A*s in my A-Levels (Computer Science, Physics, Maths, Further Maths) , so they are very detailed and cover all of the specification for this topic.
Abstraction = The process of removing unnecessary details from a problem to focus on the relevant
and important features to implement in a solution. It involves:
Separating ideas from reality
Hiding detail and only using relevant detail
Using symbols to represent elements of the problem
It is a representation of reality
Advantages:
Saves programming time and money as only the core features are implemented.
Saves memory as the program won’t be as large.
Simplifies the problem.
Less computation.
Disadvantages:
Models will not be as accurate.
Compared to reality:
Abstraction is a simplified representation of reality.
Entities are represented as computational structures (e.g. tables, databases).
Real-world values can be stored as variables and constants.
Objects in OOP are an abstraction of real-world entities. Attributes represent its
characteristics, and methods represent the actions it can perform.
E.g. A simulator such as a car or flight simulator, a representation of a building/house in a
program/game, a map of a bus or train route in a city.
In a city map, greenspace and buildings are usually unnecessary. Only roads and junctions,
and places represented by icons/symbols can be included.
In order to provide a usable map to a computer (to process routes) the map must be
abstracted. All junctions can be represented by graph nodes and each road as an edge
between each junction. Elements such as no left turnings can be represented by directed
edges. The distance between each junction can be an appropriate weight on each edge.
Other examples of abstraction are saving files (users don’t need to know how memory is managed),
sending an email (users don’t need to know which protocols are being used and how data is
formatted) and downloading content (user doesn’t need to know what security checks are made).
Programming languages are an abstraction of other languages. Assembly language uses mnemonics
to represent groups of binary digits. This is quicker, easier and less error prone than using binary (the
implementation of 0s and 1s was abstracted from the developer). However, each processor has its
own version of assembly language that can only run on a particular family of processors, and
programs had to be rewritten to run on other instruction set machines.
High level languages abstract long, complicated sequences of instructions into shorter instructions,
allowing developers to ignore how data is stored in memory. This allows them to focus on creating
1
, more complex programs quicker and easier. Therefore, a programmer doesn’t need to know all the
underlying technical complexity to create complex programs and can focus on solving the problem.
Data can also be abstracted, as programmers don’t need to know how data types are stored and
represented on a computer. High level languages allow programmers to create abstracted data
types to represent logical structures, such as modelling a queue of a restaurant, without needing to
know how queues are implemented in memory.
2.1.2 Thinking Ahead
Preconditions:
Thinking ahead is identifying the preconditions of a system: inputs, outputs and reusable
components.
Input = Any piece of data that an algorithm requires in order to run, sometimes passes as a
parameter to a subroutine.
Output = Any piece of data provided to an output device or returned to the calling subroutine.
When designing an algorithm, the inputs and outputs must be explicitly defined, including their type,
size, and format. If not defined explicitly, creating an algorithm becomes more difficult and can
cause errors and problems later on when unexpected events occur.
Preconditions = Conditions that must be true for an algorithm to complete successfully without
errors or crashing (e.g. a binary search must be supplied with an ordered list). Examples include: the
parameter list can’t be empty (index out of bounds errors will occur if not), data must be all the
same data type, the target data must be the same datatype as the list, a bubble sort may require a
list size limit to prevent it taking too long.
Advantages of specifying preconditions in a subroutine:
If the preconditions are provided in documentation, the developer is aware of what checks
are required before calling the subroutine.
If no preconditions are specified then the program itself will carry out any validation checks,
so the developer doesn’t have to write additional code. This reduces the length and
complexity of the program, and saves time spent on debugging and maintenance.
Defining preconditions and inputs and outputs allows the subroutine to be reusable and put
into a library and called on at any time.
Caching:
Caching:
Cache is the tiny storage on a processor used to temporarily store frequently used data and
instructions while a program is running. Caching is the act of storing data and instructions. This is
usually performed automatically by an OS. Web caching is where HTML pages and images most
recently viewed are stored, allowing for faster access, and saving bandwidth by not requiring them
to be redownloaded each time.
Advantages:
Saves time of retrieving instructions or values from secondary storage again.
2
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller maddysunter1. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.88. You're not tied to anything after your purchase.