paper 2 Flashcards
representational abstraction
removing excessive details to arrive at representation of a problem with only the key features
abstraction by generalization
grouping together similarities in a problem to better understand the issue, allows better categorization and the application of common solutions
data abstraction
nuisances in data are hidden to allow the application of common data structures, without focusing on the details of data
procedural abstraction
using functions and library without knowledge of how the code is implemented - used in psudeocode and decomposition as procedures are reused as black boxes
multilevel abstraction
in complex problems - highest levels of abstraction are closest to user, responsible to interface - lowest levels responsible for performing functions through execution
non expert use of abstraction
hide complex or irreverent parts to allow more people to understand code
design uses of abstraction
allows for more efficient designs - allows developers to focus on necessary elements rather than worrying about the details - prevents program from becoming too large and wasting development time
layers of abstraction in programming
lower level languages difficult to write, abstracted to high level languages it is easier to write as it is closer to english
levels of abstraction in networking
TCP/IP abstracts data transition into 4 parts - makes them simpler to program and understand - layers are independent but must return a common format
caching
storing commonly used instructions and data in ultra fast memory in, on or next to the CPU - decreases fetch time - common on commonly used web pages
prefetching
an advanced form of caching, algorithms predict what is likely to be fetched soon and loads it to cache - decreases idle time whilst waiting for fetch
limitation of caching
- prefetching can fetch wrong item clogging up RAM and offering no benefit
- effectiveness depends on cache algorithm
- large caches take a long time to search
- difficult to implement
reusable program components
commonly used functions and procedures are commonly packaged as libraries - allows reuse without rewriting functions
+ promotes more efficient design as procedures are planned and packaged before hand
+ increased reliability - better testing and bugs encountered sooner
+ saves time money and resources + reused in other projects
-can cause compatibility issues when using third party libraries - requiring refactoring of code
recursion
where a subroutine calls itself until a certain condition is met - same result as iteration but suits some problems better
+ fewer lines of code - less prone to errors
- can create infinite loop if end condition never met
call stack
each time a recursive function is called a stack frame is added to the call stack containing the parameters, local variables and a return address - allows the subroutine to return to a given point when complete - once the stop condition is met the subroutine unwinds through the stack frame