CS 2.1 Thinking

Cards (17)

  • Abstraction is one of the most important principles in computer science. It is the act of removing excessive details to arrive at a representation of a problem that consists of only the key features. Abstraction often involves analysing what is relevant to a given scenario and simplifying a problem based on this information. This is representational abstraction.
  • Another form of abstraction involves grouping together similarities within a problem to identify what kind of problem it is. This is called abstraction by generalisation and allows certain problems to be categorised as being of a particular type.
  • Data abstraction is a type of abstraction in which details about how data is being stored are hidden. Therefore programmers can use abstract data structures such as stacks and queues without knowing how they work.
  • At its core, abstraction allows non-experts to make use of a range of systems or models by hiding information that is too complex or irrelevant to the system’s purpose. Abstraction enables for more efficient software design as programmers can focus on core elements rather than unnecessary details. This reduces the time spent on the project and prevents the program from getting unnecessarily large.
  • Designing a solution entails thinking ahead about the different components of a problem and how they will be handled in the best way possible. Thinking ahead allows developers to consider problems or difficulties that may arise when the software is used. Taking these factors into account at an early stage, developers can design strategies to make programs easy and intuitive to use.
  • Preconditions are requirements which must be met before a program can be executed. If the preconditions are not met, the program will fail to execute or return an invalid answer. Specifying preconditions means that a subroutine can safely expect the arguments passed to it to meet certain criteria, as defined by the preconditions. Preconditions can be tested for within the code but are more often included in the documentation accompanying a particular subroutine, library or program.
  • Caching is the process of storing instructions or values in cache memory after they have been used, as they may be used again. This saves time which would have been needed to store and retrieve the instructions from secondary storage again. Caching is very common in the storage of web pages.
  • Commonly used functions are often packaged into libraries for reuse. Teams working on large projects that are likely to make use of certain components in multiple places might also choose to put together a library so these components can be reused.
  • In computer science, thinking procedurally makes the task of writing a program a lot simpler by breaking a problem down into smaller parts which are easier to understand and consequently, easier to design.
  • The first stage of thinking procedurally in software development involves taking the problem defined by the user and breaking it down into its component parts, in a process called problem decomposition.
  • When constructing the final solution based on the solutions to the problem components, thinking about the order in which operations are performed becomes important.
  • To simplify the decision making process, we limit the solutions we can pick from. When deciding on a programming language, you should consider what is suited to the task and your understanding of the language. Identifying where decisions need to be made early allows us to gather enough information about our options.
  • When making a decision, there are certain factors which determine the outcome you choose. What is most effective? What is most convenient? Is this option reasonable? To make an appropriate decision, you need to evaluate these conditions.
  • Concurrent Thinking: Concurrent thinking is the process of completing more than one task at a given time. Does not always mean you have to be working on multiple tasks at once. Involves giving ‘slices’ of your time to different tasks. Parts of a problem which are related can often be solved concurrently.
  • Concurrent Processing: Concurrent processing and parallel processing are not the same thing. Parallel processing is when multiple processors are used to complete more than one task simultaneously. In concurrent processing, each task is given a slice of processor time to make it appear as if tasks are being completed simultaneously. In reality, tasks are executed sequentially.
  • 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 in this time.
  • 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.