big data, functions, and more paper 2 stuff Flashcards
(41 cards)
a database is stored at an office. staff use a client server database system. describe an example of a problem that could occur if no systems were in place to manage concurrent access to the database
- two users edit the same data simultaneously
- one user writes the data then the other user writes the data
- only one users update is lost
- the performance of a system is unsatisfactory. the time delay between a client sending a query to the server and the client receiving the results is long
- explain how the performance of the system might be improved, include the following factors:
- the hardware of the server
- the design of the computer network
- the database and software running on the server
- Server hardware
- replace the processor with one that had more cores
- replace processor with one that has more cache memory
- use a processor with a bigger word size
- faster clock speed
- replace HDD’s with SSDs
- use the harvard architecture
- Replace the motherboard with one which has buses which run at a faster clock speed
- Replace the motherboard with one which has more lines in the data bus
- Use the Harvard architecture
- Distribute the processing across multiple servers - Network
- Replace the network cable with cable that has a higher bandwidth
- Replace any wireless/WiFi connections with wired ones
- Replace the network cards with ones that can transmit data at a higher bitrate
- Consider the overall network design eg how the network is divided into subnets A. split
the network into subnets
- Use a star topology (instead of a bus)
- Consider using a more efficient protocol for the data across the network
- Add additional wireless access points - Database and Software
- Use a more efficient technique for controlling concurrent access to the database
- Replace the database software with software that uses more efficient algorithms for
tasks
- Rewrite the database software in a language that is suitable for concurrent execution //
- Ensure the software is compiled rather than executed by an interpreter
- normalise the database design
- Use a non-relational database system
- Distribute the data across multiple servers
- Try to reduce the amount of other (unrelated) software that might be running on the
database server at the same time
- run some tasks at quiet times/overnight
- Purge / archive data that is no longer necessary
explain some of the challenges that face legislators in the digital age
- information can be combined/transferred in ways that were not previously possible
- technology evolves quickly so it’s difficult for the law to keep up with changes
- different laws in different countries
- some crimes may be committed by states rather than individuals
- methods such as encryption makes it harder to monitor criminal activity
- individuals may have access to large amounts of sensitive information that may be of public interest
what is a programming paradigm
a style of computer programming
what is procedural programming
- supported by languages like Python/Pascal
- have a series of instructions that tell the computer what to do with the input in order to solve the problem
what is structured programming
a type of procedural programming approach using clear control structures: sequence, selection (if/else), and iteration (loops).
Improves code readability and maintenance by avoiding “goto” statements.
Breaks programs into smaller, manageable blocks (functions or procedures).
eg python
what is oop
- supported by languages like Java, Python, Delphi
- type of programming that organises software design around data or objects
what is declarative programming
- eg sql
- you write statements that describe the problem to be solved
- You describe what the program should do, not how to do it.
what is functional programming
- supported by Haskell, Python, Java, C++ and more
- statements are written as a series of functions which accept data as arguments and return an output
what is a function
- a mapping from a set of inputs
what is the domain
the set of input values
what is the codomain
set of output values
the domain or codomain have to be…
part of a data type
isEqual :: int -> int -> bool
int = input time
isequal = function name
bool = what gets returned
isEqual :: x y = x == y
return True if x = y
what is a first class object
an object which may:
- appear in expressions
- be assigned to a variable
- be assigned as an argument
- be returned in a function call
differences between functional
and procedural
Functional: Based on mathematical functions and immutability.
Procedural: Based on step-by-step instructions (procedures).
Functional: Avoids changing state; uses pure functions.
Procedural: Changes program state using variables.
what is functional composition
when we combine two functions to get a new function
partial function application
- process + one of the variables
eg (add 6) 4
what are high order functions
- any function that takes a function as an argument or returns a function as a result or does both
what is map
- a higher order function that takes a list and the function to be applied to the elements in the list
- makes a list by applying the function to each element in old list
eg map (max 3) [1,2,3,4,5] = [3,3,3,4,5]
what is filter
- another high order function which takes a predicate(to define a Booleon condition) and a list
- it returns the elements within a list that satisfies the Bool condition
eg
filter (==5) [2,5,7,2,5] = [5,5]
what is the fold function
- refuse a list to a single value using recursion, by applying an operator
eg to add all the elements in a list, function will be foldl (+) 0[2,3,4,5]
foldl foldr
foldl = fold left
eg, foldl (/) 100[2,5] = (100/2) / 5 = 5
foldr = fold right
eg foldr (/) 100[2,5] = 2/(5/100) = 40
heads and tails of a list
- heads is the first item in the list
- tails is the rest of the list
eg [1,2,3,4] - 1 is the head
- [2,3,4] is the tail