0% found this document useful (0 votes)
15 views

2.2 Problem Solving and Programming.280155520

1. Problem recognition involves defining system requirements and understanding the current problem by considering inputs, outputs, and stored data. 2. Modular programming breaks large programs into smaller self-contained modules to simplify maintenance and improve reusability. 3. Programming constructs like sequence, branching, and iteration allow programs to execute code conditionally or repeatedly through the use of statements like IF/ELSE, FOR, and WHILE.

Uploaded by

Mark Robson
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

2.2 Problem Solving and Programming.280155520

1. Problem recognition involves defining system requirements and understanding the current problem by considering inputs, outputs, and stored data. 2. Modular programming breaks large programs into smaller self-contained modules to simplify maintenance and improve reusability. 3. Programming constructs like sequence, branching, and iteration allow programs to execute code conditionally or repeatedly through the use of statements like IF/ELSE, FOR, and WHILE.

Uploaded by

Mark Robson
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Variables Problem Recognition Modularity Programming Constructs

• Variables can be either global or local scope. • Stakeholders say what they need from the solution. • Large or complex programs can • Sequence – Code is executed line by line from the
• Scope refers to the section of code where the • This information is used to produce a clear list of system requirements and a be split into smaller self top down.
variable can be accessed. definition of the problem. contained modules. • Breaching – A block of code is run only if a condition
• A local variable in a subroutine has • We may consider the strengths and weaknesses of a current system. • This makes it easier to divide is met using IF and ELSE statements
precedence over a global variable with the • We may consider the required inputs, outputs and the volume of stored data. tasks between a team and • Count Controlled Iteration – A block of code is run a
same name. manage the project. certain number of times. Uses FOR, WHILE or
Local Variables • It simplifies maintenance since REPEAT UNTIL statements.
• Can only be accessed within the subroutine each component can be handled • Condition Controlled Iteration – A block of code is
where they were defined. individually. run while or until a condition is met. Uses FOR,
• Multiple variables with the same name can • It improves the reusability of WHILE or REPEAT UNTIL statements.
exist in different subroutines. code.
• Are deleted when the subroutine ends. • Top Down (Stepwise) Refinement
• Ensures subroutines are self contained. • A technique used to modularise Integrated Development Environment
programs. • Programs used to write code.
Global Variables
• The problem is broken into sub • Contains a set of tools which make it easier for
• Can be accessed through the whole program.
problems until each sub problem programmers to write, develop and debug code.
• Used for values needed throughout the
is a single task. • May include stepping, variable watching,
program.
• Modules form blocks of code breakpoints, source code editor and debugging
• Risk the variable is unintentionally edited.
called subroutines. tools.
• Uses memory for longer.

Unit 2.2 Problem Solving and Programming


Recursion Object Orientated Techniques Problem Solving Strategies Functions and
• When a subroutine calls • Object oriented programming Backtracking Procedures
itself during execution. languages use classes. • Uses algorithms, often recursively. • Named code blocks
• Continues until a stopping • A class is a template for an object. • Builds a solution methodically. which perform a
condition is met. • An object is an instance of a class. • Based on paths which have been visited and found to be correct. particular task.
Advantages • It defines the behaviour and state
of objects.
Can a Problem be Solved by • The algorithm backtracks to the previous stage if an invalid path is • Functions must always
• Requires fewer lines of found. return a single value.
code. • Object state uses attributes. Computational Methods?
• Not all problems can be solved in this way. Data Mining • Procedures do not have
• Easier to express functions • Object behaviour uses methods.
• Some may need too many resources or • Identifies patterns or outliers in large data sets, often collected from to return a value.
such as factorials • Encapsulation is used to edit
time. multiple sources. • Parameters can be
recursively. attributes.
• Problems which can be solved using • These data sets are known as big data. passed to them by
Disadvantages • Top down design applies
algorithms lend themselves well to being • It spots correlations between data and other trends which might not either reference or
• Risk of stack overflow if encapsulation to modules.
solved via computational methods. be easy to see. value.
memory runs out. • Modules are built to be
• We must identify whether the problem can • Can be used to make predictions about the future. Passing by Reference
• Often challenging to trace self contained and reusable.
be solved using computational methods • A useful tool to assist in business and marketing. • The address of the
and locate errors.
before we attempt to solve it. Heuristics parameter only is given
• A non optimal or rule of thumb approach. to the subroutine.
• Used to find an approximate solution to a problem. • The subroutine works
Divide and Conquer Problem Decomposition Abstraction
• Used where the standard solution takes too long. on the value at the
• A problem solving • The problem is broken down into smaller • Represents real world entities using
• Does not produce a 100% accurate or complete solution. given address.
technique with subproblems. computational elements.
three parts. • Provides an estimate for intractable problems. Passing by Value
• This is repeated until each subproblem can be • Excessive details are removed to simplify
• Performance Modelling • A copy of the value is
• Divide - halve the represented using a single subroutine. the problem.
• Mathematical method to test loads on systems. passed to the
size of the • This reduces the complexity of the problem • This may then match a problem which
• A cheaper and less time consuming method of testing applications. subroutine.
problem with each and makes it easier to solve. has previously been solved.
iteration. • Used for safety critical systems where a trial run can’t be carried out. • The original value is
• It enables programmers to see which areas can • Existing modules, functions or libraries
Pipelining unchanged.
• Conquer - solve be solved using pre-existing libraries or can then be used to solve the problem.
the subproblems. • Modules are divided into individual tasks. • The copy is deleted at
modules. • Levels of abstraction divide a complex
• Tasks are developed in parallel. the end of the
• Merge - combine • It makes the project easier to manage. problem into smaller parts.
• Allows faster completion. subroutine.
the solutions. • Subproblems can be assigned to different • Different levels can be assigned to teams
• The output of one process is often the input of another. • Exam questions will use
• It is applied in specialist teams or individuals. whilst hiding details of other layers.
• Often used in RISC processors, which perform different parts of the this technique unless
binary search, • Modules can be designed and tested • This makes the project easier to manage.
Fetch-Decode-Execute cycle at the same time. told otherwise.
quick sort and individually before being combined. • Abstraction by generalisation groups
merge sort. Visualisation • Exam questions will use
• It makes it possible to develop modules in together sections with similar
• Presenting data using charts or graphs. the format function
• It is a quick way to parallel and therefore finish more quickly. functionality.
• Makes it easier for humans to understand. function(x:value,
simplify complex • It is easier to debug the code and locate errors. • This allows segments to be coded
• Allows trends or patterns to be more easily identified. y:value)
problems. together, saving time.

You might also like