1/99
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Abstraction
the process of removing any excessive details from a problem, arriving at a representation of said problem that consists only of its key features.
Representional Abstraction
Analysing what is relevant to a given scenario and simplifying a problem based on this information
Abstraction by Generalisation
Grouping together similarities within a problem to identify what kind of problem it is. This allows different problems to be categorised as being a particular type, and solved using a common solution.
Data Abstraction
Details about how data is being stored are hidden. Therefore programmers can make use of abstract data structures such as stacks and queues without worrying about how they are implemented.
Procedural Abstraction
Programmers can perform functions (such as pushing and popping items to and from stacks) without having any knowledge about the code used to implement this.
Abstraction Levels
Higher levels are closer to the user (e.g. providing a UI for them) whereas the lowest levels are further away (e.g. execution of machine code)
What is the purpose of abstraction in systems and models?
It allows non-experts to utilize systems/models by hiding complex or irrelevant information.
How does abstraction contribute to efficient software design?
It enables programmers to focus on essential elements, reducing project time by eliminating unnecessary details.
What are low-level programming languages?
Languages like machine code that directly interact with computers but are harder to write due to specific binary codes.
What are high-level programming languages known for?
Providing an abstraction for machine code, making development easier with syntax similar to natural language.
What is the TCP/IP model's purpose?
It serves as an abstraction for network functions, divided into four layers to simplify understanding and communication.
Why is compatibility between layers crucial in the TCP/IP model?
To ensure smooth communication, standards are necessary to allow each layer to function independently while hiding details of other layers.
What is a standard in the context of hardware or software?
A set of specifications agreed upon by academic and industry communities to ensure compatibility and functionality.
Abstraction vs Reality
Real-world entities can be represented using computational structures, such as tables and databases. Real-world values will often be stored as variables.
Thinking Ahead
allows developers to consider problems or difficulties that may arise when the software is used.
How is Thinking Ahead Used?
consideration of what outputs are required of the solution, and identify the inputs required and how these need to be processed to achieve the outputs after.
Satisfied Preconditions
a subroutine can safely expect the arguments passed to meet certain criteria.
Preconditions in Documentation
For example, the factorial function, which can only be used with positive numbers. Rather than checking the arguments, the documentation accompanying this function will specify this.
Caching
the process of storing instructions or values in cache memory after they have been used, as they may be used again.
Prefetching
more advanced version of caching that involves algorithms predicting which instructions are likely to be fetched soon. The instructions and data are then loaded and stored in cache before they can be fetched
Limitations of Prefetching
the accuracy of the algorithms used, as they can only provide an informed prediction as to the instructions which are likely to be used. There is no guarantee that this will be right.
Why are reusable program concepts important?
They save time, money, and resources by allowing components to be reused in multiple places.
What are examples of reusable components in software development?
Implementations of abstract data structures, classes, subroutines.
What is the advantage of using reusable components over newly-coded ones?
Reusable components are more reliable as they have been tested for bugs.
What is a potential drawback of integrating existing components developed by third parties?
Compatibility issues with the rest of the software may require costly modifications.
Thinking Procedurally - Decomposition
involves taking the problem defined by the user and breaking it down into its component parts.
Stepwise Refinement
Higher levels provide a more brief overview of the problem, whereas lower levels provide an increasingly more in-depth coverage.
The Goal of Stepwise Refinement
to keep splitting problems into subproblems until each subproblem is a single task, ideally a self-contained module or subroutine.
Why is the order of operations important in programming?
Inputs may need validation before being passed to subroutines. Some subroutines require data from others before execution.
How can executing multiple subroutines simultaneously benefit a program?
can increase program efficiency.
Provide an example illustrating the importance of order in programming.
In a fast food delivery app, users must confirm location before selecting food and confirm order before paying.
What is a Decision?
a result reached after some consideration.
How do we simplify the decision-making process?
we begin by trying to limit the possible solutions we can pick from, then identify any possible future decision points to gather information about our options.
Conditions that Affect Outcomes
What is most effective, what is more convenient, and is the option reasonable?
What is the purpose of decisions in programming?
Decisions determine how different parts of the program are completed and lead to different routes through the program.
How can decisions affect the flow of a program in a runner game?
Decisions in a runner game, such as choosing between an endless mode or level-based mode, result in different outcomes and routes through the program.
Why is it important to think logically when designing programs?
Thinking logically helps identify where user decisions are needed in the program and plan out the different outcomes that will lead to varied routes through the program.
Concurrent Thinking
built upon the idea of concurrent processing. It is the process of completing more than one task at a time.
Concurrent Processing
different tasks are given slices of processor time, to give the illusion of tasks being performed at the same time.
Benefits of Concurrent Processing
1. The number of tasks completed in a given time is increased.
2. Less time is wasted waiting for an input or user interaction, as other tasks can be completed.
Drawbacks of Concurrent Processing
1. It can take longer to complete when large numbers of users or tasks are involved as processes cannot be completed at once.
2. There is an overhead in coordinating and switching between processes, which reduces throughput (a measure of how many units of information a system can process in a given amount of time).
3. Not all tasks are suited to being broken up and performed concurrently.
Sequence
Code is executed line-by-line and top-to-bottom.
Selection
A certain block of code is run if a specific condition is met (using IF statements). This is also known as Branching.
Iteration
A certain block of code is run over and over until a certain condition is met (using FOR or WHILE loops)
Count-Controlled
Iteration is repeated a given number of times.
Condition-Controlled
Iteration is repeated until a given condition is met.
What is recursion?
A subroutine calls itself during its execution until a stopping condition is met.
What is the advantage of using recursion?
It usually takes fewer lines of code than other methods and is less prone to errors.
What is important for recursive subroutines?
They need to be clearly defined to reach a stopping condition after a finite number of calls.
Disadvantages of Recursion
inefficient use of memory and it is difficult to trace. If the subroutine calls itself too many times, there is a danger of stack overflow (when the call stack runs out of memory).
Local Variable
limited scope (meaning they can only be accessed within the block of code they were defined).
Global Variable
can be accessed across the whole program. Any variables used in the main body of the program are automatically global variables.
Advantage of having multiple local variables with the same name
They can reappear multiple times in the code, as long as they are not in the same subroutine.
Advantage of using local variables in subroutines
Ensures that subroutines are self-contained, with no risk of variables being affected by code outside of the subroutine.
Advantages of Global Variables
Useful for values that need to be used by multiple parts of the program.
Disadvantages of Global Variables
Easy to unintentionally overwrite and edit. Require more memory than local variables.
Difference between Global and Local Variables
Global variables are not deleted when the program terminates, while local variables are deleted when the subroutine is completed.
Modularity
used to split large, complex programs into smaller, self-contained modules.
Procedure
a named block of code that performs a specific task, without having to return a value. Procedures can return multiple values (if they chose to). Procedures are usually given data as parameters for manipulation.
Function
a named block of code that also performs a specific task, but it returns a value. A function will only ever return a single value. Functions make use of local variables.
Parameter Passing by Value
the parameter is basically treated as a local variable. A copy of it is passed into the subroutine and discarded at the end. Therefore its value outside of the subroutine is not affected.
Parameter Passing by Reference
the address of the parameter is given to the subroutine, so the value of the parameter will be updated at the given address.
What is an Integrated Development Environment (IDE)?
An IDE is a program that provides a set of tools that make it easier to write, develop, and debug code.
Name some examples of Integrated Development Environments (IDEs).
Examples of IDEs are PyCharm, IDLE, and Microsoft Visual Studio.
What is the purpose of the 'Stepping' feature in an IDE?
Stepping allows you to monitor the effect of each individual line of code by executing one line at a time.
What is the 'Variable watch' feature in an IDE used for?
Variable watch observes the contents of a variable change in real-time through the execution of a program. Sometimes used to pinpoint errors.
How does the 'Breakpoint' feature in an IDE help developers?
Breakpoint allows users to set a point in the program where it will stop. It can be set on a condition or on a specific line. This can help to pinpoint where an error is occurring.
What is the purpose of the 'Source code editor' in an IDE?
Source code editor is a basic text editor, enhanced with autocompletion, indentation, and syntax highlighting.
What do debugging tools in an IDE provide?
Some IDEs provide a run-time detection of errors, with a guide as to where in the code they are likely to have occurred.
Class (OOP)
a template for an object, defining the state and behaviour of said object.
State (OOP)
given by attributes which give an object's properties.
Behaviour (OOP)
the methods associated with a class, describing the actions it can perform.
Instantiation
An object is an instance of a class, and a class can be used to create multiple objects with the same attributes and methods.
What does encapsulation refer to in OOP?
In OOP, encapsulation is the process of declaring attributes as private and allowing them to be altered only by public methods.
How does encapsulation relate to information hiding?
Encapsulation in OOP implements the principle of information hiding by protecting data from being accidentally edited by other parts of the program.
What is the purpose of top-down design in programming?
Top-down design in programming aims to implement encapsulation by designing each module to be self-contained.
What makes a problem solvable using comp methods?
its consisting of of inputs, outputs, and calculations.
A problem that can be solved by an algorithm is known as __________.
computable.
What is the next step after a problem is deemed computationally solvable?
Problem Identification
How is the problem clearly defined in the problem identification step?
Stakeholders provide requirements for the finished product
What role do stakeholders play in problem identification?
They tell you what they require from the finished product
What is the purpose of defining system requirements in problem identification?
To clearly define the problem and system requirements
How can requirements be defined using problem recognition?
1. Analysing strengths and weaknesses with the current way the problem is being solved.
2. Considering types of data involved including inputs, outputs, stored data, and amount of data.
What is problem decomposition?
After a problem is defined, it is broken down into smaller, more manageable tasks to reduce complexity.
Why is problem decomposition important in programming?
It allows for the identification of subproblems, utilisation of pre-coded modules, easier project management, parallel development, and efficient debugging.
Why does problem decomposition make testing easier?
because testing can only be carried out after the entire application has been produced unless decomposition is used.
What are the three main parts of the Divide and Conquer technique?
Divide, Conquer, Merge
How is the problem divided in the Divide and Conquer technique?
By halving the size of the problem with each iteration
What happens in the 'Conquer' step of Divide and Conquer?
Each subproblem is solved, often recursively
What is the purpose of the 'Merge' step in Divide and Conquer?
To combine the solutions of each subproblem into one solution
In which algorithms is Divide and Conquer used?
Binary search, quick sort, and merge sort
What is the time complexity of Divide and Conquer algorithms?
O(log n)
What advantage does Divide and Conquer offer in solving complex problems?
It simplifies complex problems and the time taken to solve them doesn't grow significantly as the problem size increases
What is backtracking in problem solving?
It is a methodical algorithm that visits each path and builds a solution based on correct paths, backtracking when an invalid path is encountered.
How is backtracking implemented?
Backtracking is often implemented using algorithms, with recursive methods. Depth-first graph traversals are an example of backtracking.
What is data mining used for?
Data mining is used to identify patterns or outliers in large sets of data, known as 'big data'.
How can insights from data mining be used?
Insights from data mining can be used to predict the future based on previous trends, assisting in business and marketing decisions.
What can data mining uncover about shopping habits?
Data mining can uncover information about which products are bought at certain times of the year, helping businesses prepare stocks in advance.
Why is it important to handle personal data carefully in data mining?
Data mining often involves personal data, so it is crucial to comply with data protection legislation.
What are heuristics?
Heuristics are non-optimal 'rule of thumb' approaches to problem solving.