2.1 - Elements of computational thinking Flashcards
What is abstraction
Where a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. It gets rid of unnecessary detail.
What will a computer scientist do when planning a system to “plan ahead”?
1) Determine outputs required
2) Determine the inputs necessary to achieve the outputs
3) Consider the resources needed
4) Consider user expectations
Anyone else can:
1) Decide what is to be achieved
2) Determine prerequisites
3) Determine what is possible
What is an example of thinking ahead in computers?
Caching
1) Data that is used is stored in the cache/RAM in case it is needed again.
2) Allows faster access for future use
What is decomposition?
Any large problem is divided into smaller sub-problems.
Eventually, they will equate to program modules or groups of modules.
Order of execution needs to be taken into account – may need data to be processed by one module before another can use it.
Some modules need to be accessible in an unpredictable way.
Large human projects benefit from the same approach.
What is concurrent thinking?
Concurrent thinking is the process of completing more than one task at any given time.
This doesn’t always mean that you have to be working on multiple tasks at once, however.
Concurrent processing is when tasks are given slices of processor time, to give the illusion that tasks are being performed simultaneously, and concurrent thinking is similar to this. It allows you to spot patterns and parts of problems where concurrency can be applied, thus speeding up processes.
What is the difference between concurrent processing and parallel processing?
Parallel processing is when multiple processors are used to complete more than one task simultaneously.
Meanwhile, concurrent processing is when each task is given a slice of processor time to make it look like the tasks are being completed simultaneously when in reality they are executed sequentially.
What are the benefits and drawbacks of concurrent processing?
Benefits of concurrent processing
● The number of tasks completed in a given time is increased.
● Less time is wasted waiting for an input or user interaction, as other tasks can be completed.
Drawbacks of concurrent processing
● Concurrent processing can take longer to complete when large numbers of users or tasks are involved as processes cannot be completed at once.
● There is an overhead in coordinating and switching between processes, which reduces program throughput.
● Just as with parallel processing, not all tasks are suited to being broken up and performed concurrently
What is representational abstraction?
A technique in which excessive details are removed to arrive at a representation of a problem that consists of only the key features.
Which form of abstraction involves grouping together similarities within a problem to identify what kind of problem it is?
Abstraction by generalisation
What is meant by data abstraction?
A form of abstraction in which details about how data is being stored are hidden.
What kind of problems make use of multiple levels of abstraction?
Large, complex problems
State two advantages of using abstraction in software development
- Easier for programmers to focus on core elements
- Reduces the time needed to be spent on the project.
- Prevents program from getting unnecessarily large.
Give two applications of layers of abstraction
-Networking (TCP/IP layer)
- Programming languages
State two advantages of using abstraction in programming languages
- hiding information that is too complex or irrelevant
- more efficient software design
- reduces the time spent on the project and prevents
the program from getting unnecessarily large
What three considerations do programmers need to make regarding inputs and outputs when thinking ahead?
- Method of input/output (device used)
- Data structures used
- Data types used
- Order of data