Elements of computational thinking Flashcards
What is representational abstraction?
Analysisng a problem and what is relevant then simplifying the problem by removing information that isnt relevant
What is abstraction by generalisation?
Involves grouping together similarities within a problem to identify what kind of problem it is
Allows problems to be categorised as problems of a certain type so a common solution can be used to solve these problems
What is this?
Abstraction by generalisation
What is data abstraction?
A subcategory of abstraction
In which details about how data is being stored are hidden
So therefore programmers can use abstract data types (e.g stacks,queues) without worrying about how these structures are implemented
Programmers can use functions such as pop() push() on a stack but they dont need to have knowledge about the code to program these in order to implement the functions
What is this called?
Procedural abstraction
What is procedural abstraction?
Programmers can use functions such as pop() push() on a stack but they dont need to have knowledge about the code to program these in order to implement the functions
The lowest levels of abstraction are closer to the user
TRUE OR FALSE?
FALSE
The highest levels of abstraction are closer to the user as they are responsible for providing an interface for the user to interact with hardware
Lowest levels are responsible for performing these tasks that the user requests
What is meant by ‘preconditions’?
Requirements which must be met before a program can be executed
(if these arent meet then program will fail to execute or return an invalid answer)
Its important to ensure compatibility between the layers of the TCP/IP stack
How is this done?
Standards are agreed in advance.
These standards define how each layer should operate and interact with others, ensuring communication across different systems and networks.
What happens if preconditions are not met?
If these arent meet then program will fail to execute or return an invalid answer
Give advantages of using preconditions within program documentation
-Subroutine can safely expect the arguments passed will meet a certain criteria
-Reduces length and complexity of program (as developers do not need to include extensive validation logic within each subroutine)
-which saves time to debug and maintain a long program
-Subroutines can be made more reusable ( can quickly understand how to use the subroutine correctly without diving into its internal logic.)
What is meant by ‘caching’?
The process of storing frequently used instructions or values in cache memory as they are likely to be used again.
So the system can retrieve them quickly instead of going through the slower process of fetching them from the main memory or secondary storage.
What is an advantage of caching
-Saves time which would have been needed to retrieve the instructions from secondary storage or main memory
Caching is very common in web page storage
Can you explain this?
The process of storing instructions or values in cache memory after they have been used so they can be used again
-Web pages that are accessed freqeuntly by a user are cached, so that next time one of these is accessed it can be retrieve with no delay
Caching means that images and text dont have to be downloaded again multiple times
Give an advantage of this
Frees up bandwidth which can be used for other tasks on a network
What is meant by ‘primary storage’?
Primary storage refers to the storage directly accessible by the CPU. This includes main memory (rom and ram) and cache
CACHING
The process of storing instructions or values in cache memory after they have been used so they can be used again
-Saves time which would have been needed to retrieve the instructions from secondary storage. Why is that?
Caching Saves Time Because
Data retrieval from cache is faster than main memory (RAM):
Cache stores frequently accessed data or instructions closer to the CPU.
If data is found in the cache, it avoids the slower process of fetching it from RAM.
Algorithms predict which data and instructions are likely to be fetched soon
What is this process called?
Prefetching
What is prefetching?
Algorithms predict which data and instructions are likely to be fetched soon
These data and instructions are then loaded and stored in the cache before they are fetched
Give an advantage of prefetching
Less time spent waiting for instructions to be loaded into RAM from the hard disk
What is something that limits caching or the ability to do caching effectively?
Accuracy of caching algorithm, as they can only provide a prediction and there is no guarantee this will be right
Reusable components of code are more reliable that newly coded components
Can you explain why this is true?
The reusable ones have already been tested and any bugs have been dealt with.
The difference between abstraction and reality
IN COMPUTATIONAL THINKING
Abstraction is a simplified representation of reality
Realworld entities ==> computational structures (e.g. tables, databases)
Realworld values ==> variables
The difference between abstraction and reality
IN OBJECT ORIENTED PROGRAMMING
In OOP, objects are an abstraction for realworld entities
Abstraction also considers the functionallity interface and properties of these entities
Atributes are an abstraction for the characteristics of an object
Methods are an abstraction for actions the realworld entity can perform
Give disadvanatges of caching
-Requires additional memory or disk space (could become a bottleneck if not managed well)
-Managing cache adds complexity to the system (e.g updates)
-If the caching algorithm is poorly designed, it may keep outdated or unnecessary data in the cache.
Reusable program components
When designing a piece of software the probkem is decomposed. (broken down into smaller subtasks)
This allows programmers to think about how each task may be solved and identify where program components that were developed in the past or externally sourced program components can be reused ro simplify programming process
-More reliable than newly coded as they have already been tested
-Saves time, money and resources to develop new code
X-May not always be possible to reuse existing components fue to compatibility
X-May need to be modified to work with exisiting software (may be more time consuming and expensive than just doing it from scratch)
Give disadvantages of reusing components
X-May not always be possible to reuse existing components fue to compatibility
X-May need to be modified to work with exisiting software (may be more time consuming and expensive than just doing it from scratch)