<<

DEMONSTRATE LOGICAL PROBLEM SOLVING AND

ERROR DETECTION TECHNIQUES 115367

PURPOSE OF THE UNIT STANDARD People credited with this unit standard are able to:  Describe different approaches to problem solving  Use logical operations in descriptions of rules and relationships in problem situations  Simplify Boolean expressions with and Karnaugh maps  Describe the basic concepts of error detection The performance of all elements is to a standard that allows for further learning in this area.

LEARNING ASSUMED TO BE IN PLACE AND RECOGNITION OF PRIOR LEARNING The credit value of this unit is based on a person having prior knowledge and skills to:  Demonstrate understanding of , at least at level 3.  Apply problem solving strategies

UNIT STANDARD RANGE N/A

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 141

INDEX

Competence Requirements Page Unit Standard 115367 alignment index Here you will find the different outcomes explained which you need to be proved 143 competent in, in order to complete the Unit Standard 115367. Unit Standard 115367 145 Describe different approaches to problem solving 149 Use logical operations in descriptions of rules and relationships in problem 160 situations Simplify Boolean expressions with Boolean Algebra and Karnaugh maps 182 Describe the basic concepts of error detection 201 Self-assessment Once you have completed all the questions after being facilitated, you need to check the progress you have made. If you feel that you are competent in the areas mentioned, you may tick the blocks, if however, you feel that you require 214 additional knowledge, you need to indicate so in the block below. Show this to your facilitator and make the necessary arrangements to assist you to become competent.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 142

Unit Standard 115367 – Alignment Index

SPECIFIC OUTCOMES AND RELATED ASSESSMENT CRITERIA SO 1 Describe different approaches to problem solving. AC 1 The description identifies the different problem solving techniques. The description identifies situations where specific problem solving techniques would AC 2 be more suitable than others The description utilises the top-down problem solving approach in real life problems AC 3 known to the learner. The description allows for the practice of problem breakdown in picture drawing AC 4 applications. Use logical operators in descriptions of rules and relationships in a problem SO 2 situation. AC 1 Usage describes the logical operators by drawing truth tables AC 2 Usage provides examples of problem situations where a specific operator can be used AC 3 Usage identifies which of the operators should be used to represent given situations. Usage combines different operators to form Boolean expressions by setting up truth AC 4 tables. SO 3 Simplify Boolean expressions with Boolean algebra and Karnaugh maps. AC 1 The simplification describes the rules of Boolean algebra. AC 2 The simplification uses the Boolean algebra rules to simplify given expressions. AC 3 The simplification uses Karnaugh maps to represent Boolean expressions. AC 4 The simplification involves writing down the simplified expression from the map. SO 4 Describe the basic concepts of error detection. AC 1 The description identifies the common causes of errors. AC 2 The description identifies error isolation techniques AC 3 The description identifies various testing techniques

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 143

CRITICAL CROSS FIELD OUTCOMES UNIT STANDARD CCFO IDENTIFYING Identify, solve problems and make decisions in relation to the current systems development environments UNIT STANDARD CCFO ORGANISING Organise and manage him/her self and his/her activities responsibly and effectively UNIT STANDARD CCFO COMMUNICATING Communicate effectively using visual, mathematical and or language skills in the modes of oral and/ or written persuasion when engaging with systems development UNIT STANDARD CCFO DEMONSTRATING Demonstrate an understanding of the world as a set of related systems by recognising that problem solving contexts do not exists in isolation UNIT STANDARD CCFO CONTRIBUTING Contribute to his/her full personal development and the social and economic development of the society at large by being aware of the importance of: reflecting on and exploring a variety of strategies to learn more effectively, exploring education and career opportunities and developing entrepreneurial opportunities

ESSENTIAL EMBEDDED KNOWLEDGE 1. Performance of all elements should be performed with a solid understanding of the use of development tools needed in the areas applicable to the unit standard. Examples of such tools are, but is not limited to CASE tools, editors with syntax checking, program source version control systems. 2. Performance of all elements should make use of International capability models used for Software Development. Examples of such models include (but are not limited to) the ISO SPICE model as well as the CMM model for Software Development.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 144

All qualifications and part qualifications registered on the National Qualifications Framework are public property. Thus the only payment that can be made for them is for service and reproduction. It is illegal to sell this material for profit. If the material is reproduced or quoted, the South African Qualifications Authority (SAQA) should be acknowledged as the source.

SOUTH AFRICAN QUALIFICATIONS AUTHORITY REGISTERED UNIT STANDARD: Demonstrate logical problem solving and error detection techniques

SAQA US UNIT STANDARD TITLE ID 115367 Demonstrate logical problem solving and error detection techniques ORIGINATOR SGB Sciences and Information Systems PRIMARY OR DELEGATED QUALITY ASSURANCE FUNCTIONARY - FIELD SUBFIELD Field 10 - Physical, Mathematical, Computer and Life Sciences Information Technology and Computer Sciences ABET UNIT STANDARD PRE-2009 NQF LEVEL NQF LEVEL CREDITS BAND TYPE Undefined Regular Level 5 Level TBA: Pre-2009 was 8 L5 REGISTRATION STATUS REGISTRATION START REGISTRATION END SAQA DECISION DATE DATE NUMBER Reregistered 2018-07-01 2023-06-30 SAQA 06120/18 LAST DATE FOR ENROLMENT LAST DATE FOR ACHIEVEMENT 2024-06-30 2027-06-30

In all of the tables in this document, both the pre-2009 NQF Level and the NQF Level is shown. In the text (purpose statements, qualification rules, etc), any references to NQF Levels are to the pre-2009 levels unless specifically stated otherwise.

This unit standard does not replace any other unit standard and is not replaced by any other unit standard.

PURPOSE OF THE UNIT STANDARD People credited with this unit standard are able to:  Describe different approaches to problem solving  Use logical operations in descriptions of rules and relationships in problem situations  Simplify Boolean expressions with Boolean Algebra and Karnaugh maps  Describe the basic concepts of error detection The performance of all elements is to a standard that allows for further learning in this area.

LEARNING ASSUMED TO BE IN PLACE AND RECOGNITION OF PRIOR LEARNING The credit value of this unit is based on a person having prior knowledge and skills to:  Demonstrate understanding of Mathematics, at least at level 3.  Apply problem solving strategies

UNIT STANDARD RANGE N/A

Specific Outcomes and Assessment Criteria:

SPECIFIC OUTCOME 1 Describe different approaches to problem solving. OUTCOME RANGE Top-down; Bottom-up; Systems Approach (at least two)

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 145

ASSESSMENT CRITERIA

ASSESSMENT CRITERION 1 The description identifies the different problem solving techniques. ASSESSMENT CRITERION RANGE As for outcome above

ASSESSMENT CRITERION 2 The description identifies situations where specific problem solving techniques would be more suitable than others ASSESSMENT CRITERION RANGE As for outcome above

ASSESSMENT CRITERION 3 The description utilises the top-down problem solving approach in real life problems known to the learner.

ASSESSMENT CRITERION 4 The description allows for the practice of problem breakdown in picture drawing applications. ASSESSMENT CRITERION RANGE Example: Logo, Powerpoint or any other chosen by the learner

SPECIFIC OUTCOME 2 Use logical operators in descriptions of rules and relationships in a problem situation.

ASSESSMENT CRITERIA

ASSESSMENT CRITERION 1 Usage describes the logical operators by drawing truth tables ASSESSMENT CRITERION RANGE AND; OR; NOT; NOR; XOR; NAND

ASSESSMENT CRITERION 2 Usage provides examples of problem situations where a specific operator can be used ASSESSMENT CRITERION RANGE AND; OR; NOT; NOR; XOR; NAND

ASSESSMENT CRITERION 3 Usage identifies which of the operators should be used to represent given situations. ASSESSMENT CRITERION RANGE AND; OR; NOT; NOR; XOR; NAND

ASSESSMENT CRITERION 4 Usage combines different operators to form Boolean expressions by setting up truth tables. ASSESSMENT CRITERION RANGE AND; OR; NOT

SPECIFIC OUTCOME 3 Simplify Boolean expressions with Boolean algebra and Karnaugh maps. OUTCOME RANGE Use up to 4 variables.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 146

ASSESSMENT CRITERIA

ASSESSMENT CRITERION 1 The simplification describes the rules of Boolean algebra. ASSESSMENT CRITERION RANGE Associative; Cumulative rules

ASSESSMENT CRITERION 2 The simplification uses the Boolean algebra rules to simplify given expressions. ASSESSMENT CRITERION RANGE Use up to 4 variables.

ASSESSMENT CRITERION 3 The simplification uses Karnaugh maps to represent Boolean expressions. ASSESSMENT CRITERION RANGE Use up to 4 variables.

ASSESSMENT CRITERION 4 The simplification involves writing down the simplified expression from the map. ASSESSMENT CRITERION RANGE Use up to 4 variables.

SPECIFIC OUTCOME 4 Describe the basic concepts of error detection.

ASSESSMENT CRITERIA

ASSESSMENT CRITERION 1 The description identifies the common causes of errors. ASSESSMENT CRITERION RANGE Logical errors; integration errors.

ASSESSMENT CRITERION 2 The description identifies error isolation techniques. ASSESSMENT CRITERION RANGE Ceteris paribus

ASSESSMENT CRITERION 3 The description identifies various testing techniques. ASSESSMENT CRITERION RANGE Glassbox; Blackbox; V-Model

UNIT STANDARD ACCREDITATION AND MODERATION OPTIONS The relevant Education and Training Quality Authority (ETQA) must accredit providers before they can offer programs of education and training assessed against unit standards

Moderation Process: Moderation of assessment will be overseen by the relevant ETQA according to the moderation guidelines in the relevant qualification and the agreed ETQA procedures

UNIT STANDARD ESSENTIAL EMBEDDED KNOWLEDGE

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 147

1. Performance of all elements should be performed with a solid understanding of the use of development tools needed in the areas applicable to the unit standard. Examples of such tools are, but is not limited to CASE tools, programming language editors with syntax checking, program source version control systems. 2. Performance of all elements should make use of International capability models used for Software Development. Examples of such models include (but are not limited to) the ISO SPICE model as well as the CMM model for Software Development.

UNIT STANDARD DEVELOPMENTAL OUTCOME N/A

UNIT STANDARD LINKAGES N/A

Critical Cross-field Outcomes (CCFO):

UNIT STANDARD CCFO IDENTIFYING Identify, solve problems and make decisions in relation to the current systems development environments

UNIT STANDARD CCFO ORGANISING Organise and manage him/her self and his/her activities responsibly and effectively

UNIT STANDARD CCFO COMMUNICATING Communicate effectively using visual, mathematical and or language skills in the modes of oral and/ or written persuasion when engaging with systems development

UNIT STANDARD CCFO DEMONSTRATING Demonstrate an understanding of the world as a set of related systems by recognising that problem solving contexts do not exists in isolation

UNIT STANDARD CCFO CONTRIBUTING Contribute to his/her full personal development and the social and economic development of the society at large by being aware of the importance of: reflecting on and exploring a variety of strategies to learn more effectively, exploring education and career opportunities and developing entrepreneurial opportunities

UNIT STANDARD ASSESSOR CRITERIA N/A

REREGISTRATION HISTORY As per the SAQA Board decision/s at that time, this unit standard was Reregistered in 2012; 2015.

UNIT STANDARD NOTES Supplementary information:

Sub-Sub-Field (Domain): Systems Development

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 148

Describe different approaches to problem solving Time: 180 minutes Activity: Self and Group

AC 1 he description identifies the different problem solving techniques. Top-down; Bottom-up; Systems Approach T Top-down and bottom-up are both strategies of information processing and knowledge ordering, used in a variety of fields including software, humanistic and scientific theories and management and organization. In practice, they can be seen as a style of thinking, teaching, or leadership.

A top-down approach (also known as stepwise design and stepwise refinement and in some cases used as a synonym of decomposition) is essentially the breaking down of a system to gain insight into its compositional sub-systems in a reverse engineering fashion. In a top- down approach an overview of the system is formulated, specifying, but not detailing, any first-level subsystems.

Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. A top-down model is often specified with the assistance of "black boxes", which makes it easier to manipulate. However, black boxes may fail to clarify elementary mechanisms or be detailed enough to realistically validate the model. Top down approach starts with the big picture. It breaks down from there into smaller segments.

A bottom-up approach is the piecing together of systems to give rise to more complex systems, thus making the original systems sub-systems of the emergent system. Bottom-up processing is a type of information processing based on incoming data from the environment to form a perception. From a cognitive psychology perspective, information enters the eyes in one direction (sensory input, or the "bottom"), and is then turned into an image by the brain that can be interpreted and recognized as a perception (output that is "built up" from processing to final cognition).

In a bottom-up approach the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 149

This strategy often resembles a "seed" model, by which the beginnings are small but eventually grow in complexity and completeness. However, "organic strategies" may result in a tangle of elements and subsystems, developed in isolation and subject to local optimization as opposed to meeting a global purpose.

Product design and development During the design and development of new products, designers and engineers rely on both a bottom-up and top-down approach. The bottom-up approach is being utilized when off-the- shelf or existing components are selected and integrated into the product. An example would include selecting a particular fastener, such as a bolt, and designing the receiving components such that the fastener will fit properly.

In a top-down approach, a custom fastener would be designed such that it would fit properly in the receiving components. For perspective, for a product with more restrictive requirements (such as weight, geometry, safety, environment, etc.), such as a space-suit, a more top-down approach is taken and almost everything is custom designed.

Computer science Software development In the software development process, the top-down and bottom-up approaches play a key role. Top-down approaches emphasize planning and a complete understanding of the system. It is inherent that no coding can begin until a sufficient level of detail has been reached in the design of at least some part of the system. Top-down approaches are implemented by attaching the stubs in place of the module. This, however, delays testing of the ultimate functional units of a system until significant design is complete.

Bottom-up emphasizes coding and early testing, which can begin as soon as the first module has been specified. This approach, however, runs the risk that modules may be coded without having a clear idea of how they link to other parts of the system, and that such linking may not be as easy as first thought. Re-usability of code is one of the main benefits of the bottom-up approach.

Top-down design was promoted in the 1970s by IBM researchers Harlan Mills and Niklaus Wirth. Mills developed structured programming concepts for practical use and tested them in a 1969 project to automate the New York Times morgue index. The engineering and management success of this project led to the spread of the top-down approach through IBM and the rest of the computer industry.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 150

Among other achievements, Niklaus Wirth, the developer of Pascal programming language, wrote the influential paper Program Development by Stepwise Refinement. Since Niklaus Wirth went on to develop languages such as Modula and Oberon (where one could define a module before knowing about the entire program specification), one can infer that top-down programming was not strictly what he promoted. Top-down methods were favoured in software engineering until the late 1980s, and object-oriented programming assisted in demonstrating the idea that both aspects of top-down and bottom-up programming could be utilized.

Modern software design approaches usually combine both top-down and bottom-up approaches. Although an understanding of the complete system is usually considered necessary for good design, leading theoretically to a top-down approach, most software projects attempt to make use of existing code to some degree. Pre-existing modules give designs a bottom-up flavour. Some design approaches also use an approach where a partially functional system is designed and coded to completion, and this system is then expanded to fulfil all the requirements for the project.

AC 2 he description identifies situations where specific problem solving techniques would be more suitable than others Programming T Building blocks are an example of bottom-up design because the parts are first created and then assembled without regard to how the parts will work in the assembly. Top-down is a programming style, the mainstay of traditional procedural languages, in which design begins by specifying complex pieces and then dividing them into successively smaller pieces. The technique for writing a program using top–down methods is to write a main procedure that names all the major functions it will need. Later, the programming team looks at the requirements of each of those functions and the process is repeated.

These compartmentalized sub-routines eventually will perform actions so simple they can be easily and concisely coded. When all the various sub-routines have been coded the program is ready for testing. By defining how the application comes together at a high level, lower level work can be self-contained. By defining how the lower level abstractions are expected to integrate into higher level ones, interfaces become clearly defined.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 151

In a bottom-up approach, the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed. This strategy often resembles a "seed" model, by which the beginnings are small, but eventually grow in complexity and completeness.

Object-oriented programming (OOP) is a paradigm that uses "objects" to design applications and computer programs. In mechanical engineering with software programs such as Pro/ENGINEER, Solidworks, and Autodesk Inventor users can design products as pieces not part of the whole and later add those pieces together to form assemblies like building with Lego. Engineers call this piece part design.

In a bottom-up approach, good intuition is necessary to decide the functionality that is to be provided by the module. If a system is to be built from an existing system, this approach is more suitable as it starts from some existing modules.

Parsing Parsing is the process of analysing an input sequence (such as that read from a file or a keyboard) in order to determine its grammatical structure. This method is used in the analysis of both natural languages and computer languages, as in a compiler.

Bottom-up parsing is a strategy for analysing unknown data relationships that attempts to identify the most fundamental units first, and then to infer higher-order structures from them. Top-down parsers, on the other hand, hypothesize general parse tree structures and then consider whether the known fundamental structures are compatible with the hypothesis.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 152

Nanotechnology Top-down and bottom-up are two approaches for the manufacture of products. These terms were first applied to the field of nanotechnology by the Foresight Institute in 1989 in order to distinguish between molecular manufacturing (to mass-produce large atomically precise objects) and conventional manufacturing (which can mass-produce large objects that are not atomically precise).

Bottom-up approaches seek to have smaller (usually molecular) components built up into more complex assemblies, while top-down approaches seek to create nanoscale devices by using larger, externally controlled ones to direct their assembly. Certain valuable nanostructures, such as Silicon nanowires, can be fabricated using either approach, with processing methods selected on the basis of targeted applications.

The top-down approach often uses the traditional workshop or microfabrication methods where externally controlled tools are used to cut, mill, and shape materials into the desired shape and order. Micropatterning techniques, such as photolithography and inkjet printing belong to this category. Vapour treatment can be regarded as a new top-down secondary approaches to engineer nanostructures.

Bottom-up approaches, in contrast, use the chemical properties of single molecules to cause single-molecule components to (a) self-organize or self-assemble into some useful conformation, or (b) rely on positional assembly. These approaches utilize the concepts of molecular self-assembly and/or molecular recognition. Such bottom-up approaches should, broadly speaking, be able to produce devices in parallel and much cheaper than top- down methods, but could potentially be overwhelmed as the size and complexity of the desired assembly increases.

Neuroscience and psychology An example of top-down processing: Even though the second letter in each word is ambiguous, top-down processing allows for easy disambiguation based on the context. These terms are also employed in neuroscience, cognitive neuroscience and cognitive psychology to discuss the flow of information in processing. Typically sensory input is considered "bottom-up", and higher cognitive processes, which have more information from other sources, are considered "top-down".

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 153

A bottom-up process is characterized by an absence of higher level direction in sensory processing, whereas a top-down process is characterized by a high level of direction of sensory processing by more cognition, such as goals or targets.

According to college teaching notes written by Charles Ramskov, Rock, Neiser, and Gregory claim that top-down approach involves perception that is an active and constructive process. Additionally, it is an approach not directly given by stimulus input, but is the result of stimulus, internal hypotheses, and expectation interactions. According to Theoretical Synthesis, "when a stimulus is presented short and clarity is uncertain that gives a vague stimulus, perception becomes a top-down approach."

Conversely, psychology defines bottom-up processing as an approach wherein there is a progression from the individual elements to the whole.

According to Ramskov, one proponent of bottom-up approach, Gibson, claims that it is a process that includes visual perception that needs information available from proximal stimulus produced by the distal stimulus. Theoretical Synthesis also claims that bottom-up processing occurs "when a stimulus is presented long and clearly enough."

Cognitively speaking, certain cognitive processes, such as fast reactions or quick visual identification, are considered bottom-up processes because they rely primarily on sensory information, whereas processes such as motor control and directed attention are considered top-down because they are goal directed. Neurologically speaking, some areas of the brain, such as area V1 mostly have bottom-up connections.

Other areas, such as the fusiform gyrus have inputs from higher brain areas and are considered to have top-down influence. The study of visual attention provides an example. If your attention is drawn to a flower in a field, it may be because the colour or shape of the flower are visually salient. The information that caused you to attend to the flower came to you in a bottom-up fashion—your attention was not contingent upon knowledge of the flower; the outside stimulus was sufficient on its own.

Contrast this situation with one in which you are looking for a flower. You have a representation of what you are looking for. When you see the object you are looking for, it is salient. This is an example of the use of top-down information.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 154

In cognitive terms, two thinking approaches are distinguished. "Top-down" (or "big chunk") is stereotypically the visionary, or the person who sees the larger picture and overview. Such people focus on the big picture and from that derive the details to support it. "Bottom-up" (or "small chunk") cognition is akin to focusing on the detail primarily, rather than the landscape. The expression "seeing the wood for the trees" references the two styles of cognition

AC 3 The description utilises the top-down problem solving approach in real life problems known to the learner. A top-down approach (also known as stepwise design) is essentially the breaking down of a system to gain insight into the sub-systems that make it up. In a top-down approach an overview of the system is formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements.

Once these base elements are recognised then we can build these as computer modules. Once they are built we can put them together, making the entire system from these individual components. Top-down design - in which design begins by specifying complex pieces and then dividing them into successively smaller pieces

Example: Making Pancakes To show you an example of Top-Down design we'll take the act of making pancakes. Starting from the top we have the task to: Make some pancakes But saying that by itself isn't enough to actually make any pancakes, we need to break the task down: Make some pancakes Organise Kitchen Make Pancakes Serve Each of these tasks can then be broken down further: Organise Kitchen Clean surfaces Get out mixing bowl, whisk, spoon, sieve Get out plain flour, salt, eggs, full fat milk, butter Put on apron

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 155

Make Pancakes Sift salt and flour into bowl Break eggs into bowl Whisk Add water and milk Add butter Whisk Cook Serve And each of these tasks can be broken down further, let us take a look at the Cook: Cook Get pan to temperature Pour batter in Spread batter to edges Use plastic spatula to check bottom of pancake When brown, flip Use plastic spatula to check bottom of pancake When brown finish We can break down some of these tasks even further. So starting at a single point, the creation of a pancake, we have broken down the task into it individual parts

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 156

AC 4 he description allows for the practice of problem breakdown in picture drawing applications. T Understand the problem

Define the problem

Goal

Ownership

Resources and constraints

Define boundaries

Plan solution

Check solution

Understand the problem

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 157

Before we should start solving a problem, we need to understand exactly what the problem is that we are dealing with. Only then can we start to think of solutions. By doing this we can avoid spending a lot of time on unsuitable solutions that we'd then have to throw away. Knowing the level of thinking required to solving the problem and having an idea of a solution which is relevant to the problem.

Define the problem To fully understand a problem we need to think about the following: Given(s): the initial situation Goal: desired target situation Ownership: who does what? Resources and constraints: tools, knowledge, skills, materials and rules, regulations, guidelines, boundaries, timing

For example: Example: Defining the problem (Football game) After observing and researching the business I have found out the following: Given(s) Electronic Crafts is a small programming house looking to create a football game for the mass market. They have experience making games for the Super MES and are looking for the next hit.

Goal To create a football game for the Super MES.

Ownership Barry is a graphics designer, Mike is the lead programmer, Coral is an AI programmer, Jaya is the boss.

Resources and constraints The Electronic Crafts offices have 4 development machines running Linux and C++, The platform that is being developed for is the Super MES using Visual Basic. Barry, Coral and Jaya have all programmed the Super MES before, but Mike hasn't. Mike is skilled in C++. The game must be complete within 9 months.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 158

Electronic Crafts have a game engine already running on the Super MES that you could use. Electronic Crafts specialise in cartoon like games for children and this football game should be branded as such. There should be no violence or swearing.

Define boundaries Understanding the limits to coming up with a solution and knowing what can and cannot be done through lateral thinking. These boundaries may also be known as a type of constraint. It is important to define what your system is not going to do - as important as considering what it should do.

Most software projects fail because of specification creep - where the code in development moves away from the requirements because someone (often the developers themselves) feels that it would be good if the application also did and thinking. You will end up with code that you do not know how to test or fix when it goes wrong - which is a sign of poor development that markers will not be able to ignore!

Plan solution Once you have defined the problem, given, goal, ownership and resources you need to start thinking about how you will implement a solution. This might involve using tools such as flow charts, pseudo code, top down design, finite state machines etc. These will allow you to get started with actually making the solution. We will meet all of these methods shortly.

Check solution Once you have created a solution you need to check it against the original problem. If it solves the problem then you have a successful solution. If it doesn't then you have failed and will have to go back to the drawing board to try another solution that works.

Note that you can (and should) test your design on paper against the specification (and your test plans) before you code it. This "walk through" approach is often done in team working - which encourages the consideration of abnormal data input, or using work flows that had not been thought of.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 159

Use logical operators in descriptions of rules and relationships in a problem situation Time: 180 minutes Activity: Self and Group

AC 1 sage describes the logical operators by drawing truth tables AND; OR; NOT; NOR; XOR; NAND Boolean Algebra Truth Tables U Boolean Algebra Expressions can be used to construct digital truth tables for their respective functions. As well as a standard Boolean Expression, the input and output information of any or circuit can be plotted into a standard table to give a visual representation of the switching function of the system.

The table used to represent the Boolean expression of a logic gate function is commonly called a . A logic gate truth table shows each possible input combination to the gate or circuit with the resultant output depending upon the combination of these input(s). For example, consider a single 2-input logic circuit with input variables labelled as A and B. There are “four” possible input combinations or 22 of “OFF” and “ON” for the two inputs. However, when dealing with Boolean expressions and especially logic gate truth tables, we do not general use “ON” or “OFF” but instead give them bit values which represent a logic level “1” or a logic level “0” respectively. Then the four possible combinations of A and B for a 2- input logic gate is given as: Input Combination 1. – “OFF” – “OFF” or (0, 0 ) Input Combination 2. – “OFF” – “ON” or ( 0, 1 ) Input Combination 3. – “ON” – “OFF” or ( 1, 0 ) Input Combination 4. – “ON” – “ON” or ( 1, 1 )

Therefore, a 3-input logic circuit would have 8 possible input combinations or 23 and a 4- input logic circuit would have 16 or 24, and so on as the number of inputs increases. Then a logic circuit with “n” number of inputs would have 2n possible input combinations of both “OFF” and “ON”. So in order to keep things simple to understand, in this tutorial we will only deal with standard 2-input type logic gates, but the principals are still the same for gates with more than two inputs. Then the Truth tables for a 2-input AND Gate, a 2-input OR Gate and a single input NOT Gate are given as:

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 160

2-input AND Gate For a 2-input AND gate, the output Q is true if BOTH input A “AND” input B are both true, giving the Boolean Expression of: ( Q = A and B ).

Symbol Truth Table

A B Q

0 0 0

0 1 0

1 0 0

1 1 1

Boolean Expression Q = A.B Read as A AND B gives Q

Note that the Boolean Expression for a two input AND gate can be written as: A.B or just simply AB without the decimal point.

2-input OR (Inclusive OR) Gate For a 2-input OR gate, the output Q is true if EITHER input A “OR” input B is true, giving the Boolean Expression of: ( Q = A or B ).

Symbol Truth Table

A B Q

0 0 0

0 1 1

1 0 1

1 1 1

Boolean Expression Q = A+B Read as A OR B gives Q

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 161

NOT Gate () For a single input NOT gate, the output Q is ONLY true when the input is “NOT” true, the output is the inverse or complement of the input giving the Boolean Expression of: ( Q = NOT A ).

Symbol Truth Table

A Q

0 1

1 0

Boolean Expression Q = NOT A or A Read as inversion of A gives Q

The NAND and the NOR Gates are a combination of the AND and OR Gates respectively with that of a NOT Gate (inverter).

2-input NAND (Not AND) Gate For a 2-input NAND gate, the output Q is NOT true if BOTH input A and input B are true, giving the Boolean Expression of: ( Q = not(A AND B) ).

Symbol Truth Table

A B Q

0 0 1

0 1 1

1 0 1

1 1 0

Boolean Expression Q = A .B Read as A AND B gives NOT-Q

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 162

2-input NOR (Not OR) Gate For a 2-input NOR gate, the output Q is true if BOTH input A and input B are NOT true, giving the Boolean Expression of: ( Q = not(A OR B) ).

Symbol Truth Table

A B Q

0 0 1

0 1 0

1 0 0

1 1 0

Boolean Expression Q = A+B Read as A OR B gives NOT-Q

As well as the standard logic gates there are also two special types of logic gate function called an Exclusive-OR Gate and an Exclusive-NOR Gate. The Boolean expression to indicate an Exclusive-OR or Exclusive-NOR function is to a symbol with a plus sign inside a circle, ( ⊕ ).

The switching actions of both of these types of gates can be created using the above standard logic gates. However, as they are widely used functions they are now available in standard IC form and have been included here as reference.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 163

2-input EX-OR () Gate For a 2-input Ex-OR gate, the output Q is true if EITHER input A or if input B is true, but NOT both giving the Boolean Expression of: ( Q = (A and NOT B) or (NOT A and B) ).

Symbol Truth Table

A B Q

0 0 0

0 1 1

1 0 1

1 1 0

Boolean Expression Q = A ⊕ B

2-input EX-NOR (Exclusive NOR) Gate For a 2-input Ex-NOR gate, the output Q is true if BOTH input A and input B are the same, either true or , giving the Boolean Expression of: ( Q = (A and B) or (NOT A and NOT B) ).

Symbol Truth Table

A B Q

0 0 1

0 1 0

1 0 0

1 1 1

Boolean Expression Q = A ⊕ B

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 164

Summary of 2-input Logic Gates The following Truth Table compares the logical functions of the 2-input logic gates above.

Inputs Truth Table Outputs For Each Gate

A B AND NAND OR NOR EX-OR EX-NOR

0 0 0 1 0 1 0 1

0 1 0 1 1 0 1 0

1 0 0 1 1 0 1 0

1 1 1 0 1 0 0 1

The following table gives a list of the common logic functions and their equivalent Boolean notation.

Logic Function Boolean Notation

AND A.B

OR A+B

NOT A

NAND A .B

NOR A+B

EX-OR (A.B) + (A.B) or A ⊕ B

EX-NOR (A.B) + (A.B) or A ⊕ B

2-input logic gate truth tables are given here as examples of the of each logic function, but there are many more logic gates with 3, 4 even 8 individual inputs. The multiple input gates are no different to the simple 2-input gates above, so a 4-input AND gate would still require ALL 4-inputs to be present to produce the required output at Q and its larger truth table would reflect that.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 165

AC 2 sage provides examples of problem situations where a specific operator can be used U Logical operators There are three logical operators in JavaScript: || (OR), && (AND),! (NOT). Although they are called “logical”, they can be applied to values of any type, not only Boolean. Their result can also be of any type. Let’s see the details. || (OR)

The “OR” operator is represented with two vertical line symbols: result = a || b; In classical programming, the logical OR is meant to manipulate Boolean values only. If any of its arguments are true, it returns true, otherwise it returns false. In JavaScript, the operator is a little bit trickier and more powerful. But first, let’s see what happens with Boolean values.

There are four possible logical combinations: alert( true || true ); // true alert( false || true ); // true alert( true || false ); // true alert( false || false ); // false As we can see, the result is always true except for the case when both operands are false. If an operand is not a Boolean, it’s converted to a Boolean for the evaluation. For instance, the number 1 is treated as true, the number 0 as false: if (1 || 0) { // works just like if( true || false ) alert( 'truthy!' ); }

Most of the time, OR || is used in an if to test if any of the given conditions is true. For example: let hour = 9; if (hour < 10 || hour > 18) { alert( 'The office is closed.' ); }

We can pass more conditions:

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 166

let hour = 12; let isWeekend = true; if (hour < 10 || hour > 18 || isWeekend) { alert( 'The office is closed.' ); // it is the weekend } OR “||” finds the first truthy value The logic described above is somewhat classical. Now, let’s bring in the “extra” features of JavaScript. The extended algorithm works as follows.

Given multiple OR’ed values: result = value1 || value2 || value3; The OR || operator does the following: Evaluates operands from left to right. For each operand, converts it to Boolean. If the result is true, stops and returns the original value of that operand. If all operands have been evaluated (i.e. all were false), returns the last operand. A value is returned in its original form, without the conversion. In other words, a chain of OR "||" returns the first truthy value or the last one if no truthy value is found.

For instance: alert( 1 || 0 ); // 1 (1 is truthy) alert( null || 1 ); // 1 (1 is the first truthy value) alert( null || 0 || 1 ); // 1 (the first truthy value) alert( undefined || null || 0 ); // 0 (all falsy, returns the last value) This leads to some interesting usage compared to a “pure, classical, Boolean-only OR”.

Getting the first truthy value from a list of variables or expressions. For instance, we have firstName, lastName and nickName variables, all optional. Let’s use OR || to choose the one that has the data and show it (or anonymous if nothing set): let firstName = ""; let lastName = ""; let nickName = "SuperCoder"; alert( firstName || lastName || nickName || "Anonymous"); // SuperCoder If all variables were falsy, Anonymous would show up.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 167

Short-circuit evaluation. Another feature of OR || operator is the so-called “short-circuit” evaluation. It means that || processes its arguments until the first truthy value is reached, and then the value is returned immediately, without even touching the other argument. That importance of this feature becomes obvious if an operand isn’t just a value, but an expression with a side effect, such as a variable assignment or a function call. In the example below, only the second message is printed: true || alert("not printed"); false || alert("printed"); In the first line, the OR || operator stops the evaluation immediately upon seeing true, so the alert isn’t run. Sometimes, people use this feature to execute commands only if the condition on the left part is falsy.

&& (AND) The AND operator is represented with two &&: result = a && b; In classical programming, AND returns true if both operands are truthy and false otherwise: alert( true && true ); // true alert( false && true ); // false alert( true && false ); // false alert( false && false ); // false

An example with if: let hour = 12; let minute = 30; if (hour == 12 && minute == 30) { alert( 'The time is 12:30' ); }

Just as with OR, any value is allowed as an operand of AND: if (1 && 0) { // evaluated as true && false alert( "won't work, because the result is falsy" ); }

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 168

AND “&&” finds the first falsy value Given multiple AND’ed values: Result = value1 && value2 && value3; The AND && operator does the following: Evaluates operands from left to right. For each operand, converts it to a Boolean. If the result is false, stops and returns the original value of that operand.

If all operands have been evaluated (i.e. all were truthy), returns the last operand. In other words, AND returns the first falsy value or the last value if none were found. The rules above are similar to OR. The difference is that AND returns the first falsy value while OR returns the first truthy one.

Examples: // if the first operand is truthy, // AND returns the second operand: alert( 1 && 0 ); // 0 alert( 1 && 5 ); // 5

// if the first operand is falsy, // AND returns it. The second operand is ignored alert( null && 5 ); // null alert( 0 && "no matter what" ); // 0 We can also pass several values in a row. See how the first falsy one is returned: alert( 1 && 2 && null && 3 ); // null

When all values are truthy, the last value is returned: alert( 1 && 2 && 3 ); // 3, the last one

Precedence of AND && is higher than OR || The precedence of AND && operator is higher than OR ||. So the code a && b || c && d is essentially the same as if the && expressions were in parentheses: (a && b) || (c && d).

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 169

Don’t replace if with || or && Sometimes, people use the AND && operator as a "shorter to write if". For instance: let x = 1;

(x > 0) && alert( 'Greater than zero!' ); The action in the right part of && would execute only if the evaluation reaches it. That is, only if (x > 0) is true.

So we basically have an analogue for: let x = 1; if (x > 0) alert( 'Greater than zero!' ); Although, the variant with && appears shorter, if is more obvious and tends to be a little bit more readable. So we recommend using every construct for its purpose: use if if we want if and use && if we want AND.

! (NOT) The Boolean NOT operator is represented with an exclamation sign !.

The syntax is pretty simple: result = !value; The operator accepts a single argument and does the following: Converts the operand to Boolean type: true/false. Returns the inverse value. For instance: alert( !true ); // false alert( !0 ); // true

A double NOT !! is sometimes used for converting a value to Boolean type: alert( !!"non-empty string" ); // true alert( !!null ); // false That is, the first NOT converts the value to Boolean and returns the inverse, and the second NOT inverses it again. In the end, we have a plain value-to-boolean conversion. There’s a little more verbose way to do the same thing – a built-in : alert( Boolean("non-empty string") ); // true alert( Boolean(null) ); // false The precedence of NOT ! is the highest of all logical operators, so it always executes first, before && or ||.

AC 3

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 170

sage identifies which of the operators should be used to represent given situations. Truth table U A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and —which sets out the functional values of logical expressions on each of their functional arguments, that is, for each combination of values taken by their logical variables. In particular, truth tables can be used to show whether a propositional expression is true for all legitimate input values, that is, logically valid.

A truth table has one column for each input variable (for example, P and Q), and one final column showing all of the possible results of the logical operation that the table represents (for example, P XOR Q). Each row of the truth table contains one possible configuration of the input variables (for instance, P=true Q=false), and the result of the operation for those values. See the examples below for further clarification.

Ludwig Wittgenstein is generally credited with inventing and popularizing the truth table in his Tractatus Logico-Philosophicus, which was completed in 1918 and published in 1921. Such a system was also independently proposed in 1921 by Emil Leon Post. An even earlier iteration of the truth table has also been found in unpublished manuscripts by Charles Sanders Peirce from 1893, antedating both publications by nearly 30 years.

Unary operations There are 4 unary operations: Always true Never true, unary falsum Unary Identity Unary

Logical true The output value is always true, regardless of the input value of p Logical True p T

T T

F T

Logical false The output value is never true: that is, always false, regardless of the input value of p

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 171

Logical False p F

T F

F F

Logical identity Logical identity is an operation on one logical value p, for which the output value remains p. The truth table for the logical identity operator is as follows: Logical Identity p p

T T

F F

Logical negation Logical negation is an operation on one logical value, typically the value of a that produces a value of true if its operand is false and a value of false if its operand is true. The truth table for NOT p (also written as ¬p, Np, Fpq, or ~p) is as follows: Logical Negation p ¬p

T F

F T

Binary operations: There are 16 possible truth functions of two binary variables:

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 172

Truth table for all binary logical operators Here is an extended truth table giving definitions of all possible truth functions of two Boolean variables P and Q:

p T F NO ↚ ¬p ↛ ¬q XO NAN AN XNO q1 → ← OR p q 1 1 0 R1 2 3 4 5 R6 D7 D8 R9 0 11 13 14 2 5

T T F F F F F F F F T T T T T T T T

T F F F F F T T T T F F F F T T T T

F T F F T T F F T T F F T T F F T T

F F F T F T F T F T F T F T F T F T

Co ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ m

p T F NOR ↛ ¬q ↚ ¬p XOR NAN AND XNO ← q1 → OR Adj 1 1 0 1 4 5 2 3 6 D7 8 R9 13 0 11 14 2 5

T ¬ OR1 ← p1 → q1 XNO AND NAN XOR ¬q ↛ ↚ NO F Neg 1 p 4 13 2 11 0 R9 8 D7 6 5 4 2 R1 0 5 3

T p Du NAN → ¬p ← ¬q XNO NOR OR1 XOR q1 ↚ ↛ AN F 1 1 al D7 11 3 13 5 R9 1 4 6 0 2 4 D8 0 5 2

L T, F F T T T F id F

R T, F F T T T F id F

Where T = true. F = false. The Com row indicates whether an operator, op, is commutative - P op Q = Q op P. The Adj row shows the operator op2 such that P op Q = Q op2 P The Neg row shows the operator op2 such that P op Q = ¬(Q op2 P) The Dual row shows the dual operation obtained by interchanging T with F, and AND with OR. The L id row shows the operator's left identities if it has any - values I such that I op Q = Q.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 173

The R id row shows the operator's right identities if it has any - values I such that P op I = P. The four combinations of input values for p, q, are read by row from the table above. The output function for each p, q combination, can be read, by row, from the table.

Key: The following table is oriented by column, rather than by row. There are four columns rather than four rows, to display the four combinations of p, q, as input. p: T T F F q: T F T F There are 16 rows in this key, one row for each binary function of the two binary variables, p, q. For example, in row 2 of this Key, the value of nonimplication ('{\displaystyle

\nleftarrow } ') is solely T, for the column denoted by the unique combination p=F, q=T; while in row 2, the value of that '{\displaystyle \nleftarrow } ' operation is F for the three remaining columns of p, q. The output row for {\displaystyle \nleftarrow } is thus 2: F F T F and the 16-row key is

operator Operation name

(F F F 0 ⊥ false, Opq F)(p, q)

(F F F 1 NOR p ↓ q, Xpq Logical NOR T)(p, q)

(F F T Converse 2 ↚ p ↚ q, Mpq F)(p, q) nonimplication

(F F T 3 ¬p, ~p ¬p, Np, Fpq Negation T)(p, q)

(F T F Material 4 ↛ p ↛ q, Lpq F)(p, q) nonimplication

(F T F 5 ¬q, ~q ¬q, Nq, Gpq Negation T)(p, q)

(F T T Exclusive 6 XOR p ⊕ q, Jpq F)(p, q) disjunction

7 (F T T NAND p ↑ q, Dpq Logical NAND

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 174

T)(p, q)

(T F F 8 AND p ∧ q, Kpq F)(p, q)

(T F F p If and only Logical 9 XNOR T)(p, q) if q, Epq biconditional

(T F T 10 q q, Hpq Projection function F)(p, q)

(T F T 11 p → q if p then q, Cpq Material implication T)(p, q)

(T T F 12 p p, Ipq Projection function F)(p, q)

(T T F Converse 13 p ← q p if q, Bpq T)(p, q) implication

(T T T 14 OR p ∨ q, Apq F)(p, q)

(T T T 15 ⊤ true, Vpq T)(p, q)

Logical operators can also be visualized using Venn diagrams.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 175

Logical conjunction (AND) Logical conjunction is an operation on two logical values, typically the values of two , that produces a value of true if both of its operands are true. The truth table for p AND q (also written as p ∧ q, Kpq, p & q, or p {\displaystyle \cdot }

q) is as follows: Logical conjunction p q p ∧ q T T T T F F F T F F F F In ordinary language terms, if both p and q are true, then the conjunction p ∧ q is true. For all other assignments of logical values to p and to q the conjunction p ∧ q is false. It can also be said that if p, then p ∧ q is q, otherwise p ∧ q is p.

Logical disjunction (OR) Logical disjunction is an operation on two logical values, typically the values of two propositions, that produces a value of true if at least one of its operands is true. The truth table for p OR q (also written as p ∨ q, Apq, p || q, or p + q) is as follows: Logical disjunction p q p ∨ q T T T T F T F T T F F F Stated in English, if p, then p ∨ q is p, otherwise p ∨ q is q.

Logical implication Logical implication and the are both associated with an operation on two logical values, typically the values of two propositions, which produces a value of false if the first operand is true and the second operand is false, and a value of true otherwise.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 176

The truth table associated with the logical implication p implies q (symbolized as p ⇒ q, or more rarely Cpq) is as follows: Logical implication p q p ⇒ q T T T T F F F T T F F T

The truth table associated with the material conditional if p then q (symbolized as p → q) is as follows: Material conditional p q p → q T T T T F F F T T F F T It may also be useful to note that p ⇒ q and p → q are equivalent to ¬p ∨ q.

Logical (also known as biconditional or exclusive nor) is an operation on two logical values, typically the values of two propositions, that produces a value of true if both operands are false or both operands are true.

The truth table for p XNOR q (also written as p ↔ q, Epq, p = q, or p ≡ q) is as follows: Logical equality p q p ↔ q T T T T F F F T F F F T So p EQ q is true if p and q have the same (both true or both false), and false if they have different truth values.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 177

AC 4 sage combines different operators to form Boolean expressions by setting up truth tables. Truth Tables, Logic, and DeMorgan's Laws U Truth tables summarize how we combine two logical conditions based on AND, OR, and NOT. Logic tells us that if two things must be true in order to proceed them both condition_1 AND condition_2 must be true. If it only takes one out of two things to be true, then condition_1 OR condition_2 must be true. DeMorgan's Laws tell us how to negate a Boolean expression and what it means to do so.

Truth Values in a computer: Booleans At the end of the day, one of the few things, and most powerful things a computer can determine if a statement (expression) is "true" or "false". Because true and false are so prevalent in decision making, they are their own keywords. In other words, in a program we write true not the string 'true'.

Logical Operators: AND, OR, and NOT We can combine several "boolean" statements that have true/false meaning into a single statement using the key concepts AND and OR (and NOT). If I want to go to the movie AND I have enough money, then I will go to the movie. BOTH conditions have to evaluate to true (have to be true) before the entire expression is true. i_want_to_go_to_move = true; if ( ( i_want_to_go_to_move ) && ( money > 20 ) ) go to movie(); end

OR is written with double "pipes" || AND is written with double "ampersands" && True is written: true; False is written: false; Not is written in a variety of ways. In Matlab it is the (~). In C, Java, ActionScript, it is written as the exclamation point (!).

Warning: Again, the two Booleans are true and false, (not the strings 'true' and 'false' but keywords true and false. Further, while Matlab allows you to use 1 and 0 for true and false, every time you write a program and need to assign the value's true or false, you should use the keywords true and false, not the shortcut 1, 0.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 178

Truth Tables, Logic, and DeMorgan's Laws Computer programs are constantly making decisions based on the current "STATE" of the data held by the program. For example, a heart monitoring program might sound an alarm if the pulse is too slow or the blood pressure is too weak. Combining multiple conditions to form one True/False value is the domain of Logic.

The primary way to combine two Boolean expressions into one is through the use of AND or OR. In most programming languages, AND is written using double ampersands: &&. OR is written using double pipes: ||

The truth tables Truth tables show the result of combining any two expression Boolean expressions using the AND operator and the OR operator (or the NOT operator). You should memorize/learn these values and be able to duplicate this table: condition 1 condition 2 NOT X X AND Y X OR Y (e.g., X) (e.g., Y) ( ~ X ) ( X && Y ) ( X || Y ) false false true false false false true true false true true false false false true true true false true true

DeMorgan's Laws DeMorgan's laws tell us how to transform logical expressions (with multiple AND and/or OR statements) using the NOT operator. For example: You want your loop to finish after 8 iterations have been made (and you want to use a while loop). This is the same as saying: You want your loop to continue when less than or equal to 8 iterations have been made. Thus to continue, you want the opposite (or the NOT) condition of the finishing condition.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 179

The pseudocode looks something like: if (count > 8) { finish }

which becomes:

while ( ! (count > 8) ) // Not the case that the count is greater than 8 { do something }

Now say there is an additional criteria to finishing, say when the total value of some variable is greater than 100. How you would say this in English: if (line_count > 8 _OR_ the total is greater than 100) { finish } which becomes: while ( NOT (line_count > 8) _AND_ NOT(the total is greater than 100)) { do something }

% % Which can be rewritten as: %

while ( line_count <= 8 && the total is less than or equal to 100) { do something }

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 180

DeMorgan's Laws tell us how to translate from a "positive" version of a statement into a negative version, or more concisely: The DeMorgan laws tells us how to translate an logical expression ( E ) into NOT( E ).

Here is what DeMorgan's law states that: NOT(A || B) is Equivalent to (NOT(A) AND NOT (B)) Additionally: NOT(A && B) is Equivalent to (NOT (A) OR NOT(B))

This goes in reverse as well: (NOT (A) || NOT (B)) is Equivalent to NOT(A AND B) Thus if you are having problems thinking of when something should continue, think about when it should stop and then use NOT!

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 181

Simplify Boolean expressions with Boolean algebra and Karnaugh maps Time: 180 minutes Activity: Self and Group

AC 1 he simplification describes the rules of Boolean algebra. Laws of Boolean Algebra Boolean Algebra uses a set of Laws and Rules to define the operation of a digital T logic circuit As well as the logic symbols “0” and “1” being used to represent a digital input or output, we can also use them as constants for a permanently “Open” or “Closed” circuit or contact respectively.

A set of rules or Laws of Boolean Algebra expressions have been invented to help reduce the number of logic gates needed to perform a particular logic operation resulting in a list of functions or theorems known commonly as the Laws of Boolean Algebra.

Boolean Algebra is the mathematics we use to analyse digital gates and circuits. We can use these “Laws of Boolean” to both reduce and simplify a complex Boolean expression in an attempt to reduce the number of logic gates required. Boolean Algebra is therefore a system of mathematics based on logic that has its own set of rules or laws which are used to define and reduce Boolean expressions.

The variables used in Boolean Algebra only have one of two possible values, a logic “0” and a logic “1” but an expression can have an infinite number of variables all labelled individually to represent inputs to the expression, For example, variables A, B, C etc, giving us a logical expression of A + B = C, but each variable can ONLY be a 0 or a 1.

Examples of these individual laws of Boolean, rules and theorems for Boolean Algebra are given in the following table.

Truth Tables for the Laws of Boolean

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 182

Boolean Equivalent Boolean Algebra Description Expression Switching Circuit Law or Rule

A in parallel with A + 1 = 1 Annulment closed = “CLOSED”

A in parallel with A + 0 = A Identity open = “A”

A in series with A . 1 = A Identity closed = “A”

A in series with A . 0 = 0 Annulment open = “OPEN”

A in parallel with A + A = A Idempotent A = “A”

A in series with A . A = A Idempotent A = “A”

NOT NOT A NOT A = A Double Negation (double negative) = “A”

A in parallel with A + A = 1 Complement NOT A = “CLOSED”

A in series with A . A = 0 Complement NOT A = “OPEN”

A in parallel with B = A+B = B+A Commutative B in parallel with A

A in series with B = A.B = B.A Commutative B in series with A

A+B = A.B invert and replace OR with AND de Morgan’s Theorem

A.B = A+B invert and replace AND with OR de Morgan’s Theorem

The basic Laws of Boolean Algebra that relate to the Commutative Law allowing a change in position for addition and multiplication, the Associative Law allowing the removal of brackets for addition and multiplication, as well as the Distributive Law allowing the factoring of an expression, are the same as in ordinary algebra. Each of the Boolean Laws above are given with just a single or two variables, but the number of variables defined by a single law is not limited to this as there can be an infinite number of

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 183

variables as inputs too the expression. These Boolean laws detailed above can be used to prove any given Boolean expression as well as for simplifying complicated digital circuits. A brief description of the various Laws of Boolean are given below with A representing a variable input.

Description of the Laws of Boolean Algebra Annulment Law – A term AND´ed with a “0” equals 0 or OR´ed with a “1” will equal 1 A . 0 = 0 A variable AND’ed with 0 is always equal to 0 A + 1 = 1 A variable OR’ed with 1 is always equal to 1 Identity Law – A term OR´ed with a “0” or AND´ed with a “1” will always equal that term A + 0 = A A variable OR’ed with 0 is always equal to the variable A . 1 = A A variable AND’ed with 1 is always equal to the variable Idempotent Law – An input that is AND´ed or OR´ed with itself is equal to that input A + A = A A variable OR’ed with itself is always equal to the variable A . A = A A variable AND’ed with itself is always equal to the variable

Complement Law – A term AND´ed with its complement equals “0” and a term OR´ed with its complement equals “1” A . A = 0 A variable AND’ed with its complement is always equal to 0 A + A = 1 A variable OR’ed with its complement is always equal to 1

Commutative Law – The order of application of two separate terms is not important A . B = B . A The order in which two variables are AND’ed makes no difference A + B = B + A The order in which two variables are OR’ed makes no difference

Double Negation Law – A term that is inverted twice is equal to the original term A = A A double complement of a variable is always equal to the variable de Morgan´s Theorem – There are two “de Morgan´s” rules or theorems, (1) Two separate terms NOR´ed together is the same as the two terms inverted (Complement) and AND´ed for example: A+B = A . B (2) Two separate terms NAND´ed together is the same as the two terms inverted (Complement) and OR´ed for example: A.B = A + B

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 184

Other algebraic Laws of Boolean not detailed above include: Distributive Law – This law permits the multiplying or factoring out of an expression. A(B + C) = A.B + A.C (OR Distributive Law) A + (B.C) = (A + B).(A + C) (AND Distributive Law) Absorptive Law – This law enables a reduction in a complicated expression to a simpler one by absorbing like terms. A + (A.B) = A (OR Law) A(A + B) = A (AND ) Associative Law – This law allows the removal of brackets from an expression and regrouping of the variables. A + (B + C) = (A + B) + C = A + B + C (OR Associate Law) A(B.C) = (A.B)C = A . B . C (AND Associate Law)

Boolean Algebra Functions Using the information above, simple 2-input AND, OR and NOT Gates can be represented by 16 possible functions as shown in the following table.

Function Description Expression

1. NULL 0

2. IDENTITY 1

3. Input A A

4. Input B B

5. NOT A A

6. NOT B B

7. A AND B (AND) A . B

8. A AND NOT B A . B

9. NOT A AND B A . B

10. NOT AND (NAND) A . B

11. A OR B (OR) A + B

12. A OR NOT B A + B

13. NOT A OR B A + B

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 185

14. NOT OR (NOR) A + B

15. Exclusive-OR A . B + A . B

16. Exclusive-NOR A . B + A . B

Laws of Boolean Algebra Example No1 Using the above laws, simplify the following expression: (A + B)(A + C)

Q = (A + B).(A + C)

A.A + A.C + A.B + B.C – Distributive law

A + A.C + A.B + B.C – Idempotent AND law (A.A = A)

A(1 + C) + A.B + B.C – Distributive law

A.1 + A.B + B.C – Identity OR law (1 + C = 1)

A(1 + B) + B.C – Distributive law

A.1 + B.C – Identity OR law (1 + B = 1)

Q = A + (B.C) – Identity AND law (A.1 = A)

Then the expression: (A + B)(A + C) can be simplified to A + (B.C) as in the Distributive law.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 186

AC 2 he simplification uses the Boolean algebra rules to simplify given expressions. Boolean algebra, a logic algebra, allows the rules used in the algebra of numbers T to be applied to logic. It formalizes the rules of logic. Boolean algebra is used to simplify Boolean expressions which represent combinational logic circuits. It reduces the original expression to an equivalent expression that has fewer terms which means that less logic gates are needed to implement the combinational logic circuit.

Truth Table

A B output

0 0 1

0 1 1

1 0 0

1 1 0

Use ~ * + to represent NOT AND OR respectively. Do not omit the * operator for an AND operation. (~AB)+(B~C)+(AB) will return an error (~A*B)+(B*~C)+(A*B) is OK Boolean operations follows a precedence order of NOT AND OR. Expressions inside brackets () are always evaluated first, overriding the precedence order. Please enter variables only, constants like 0,1 are not allowed. Variables E, I, N, O, Q, S are not allowed

Boolean Expression Simplification The following shows an example of using algebraic techniques to simplify a Boolean expression

~(A * B) * (~A + B) * (~B + B)

~(A * B) * (~A + B) * 1 6 - Complement law

~(A * B) * (~A + B) 5 - Identity law

(~A + ~B) * (~A + B) 8 - DeMorgan's law

~A + ~B * B 4 - Distributive law

~A + 0 6 - Complement law

~A 5 - Identity law

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 187

Each line gives the new expression and the rule or rules used to derive it from the previous one. Usually there are several ways to reach the result.

Laws of Boolean Algebra Boolean Algebra Laws are used to simplify Boolean expressions.

Basic Boolean Laws Idempotent Law A * A = A A + A = A

Associative Law (A * B) * C = A * (B * C) (A + B) + C = A + (B + C)

Commutative Law A * B = B * A A + B = B + A

Distributive Law A * (B + C) = A * B + A * C A + (B * C) = (A + B) * (A + C)

Identity Law A * 0 = 0 A * 1 = A A + 1 = 1 A + 0 = A

Complement Law A * ~A = 0 A + ~A = 1

Involution Law ~(~A) = A

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 188

DeMorgan's Law ~(A * B) = ~A + ~B ~(A + B) = ~A * ~B

Redundancy Laws Absorption A + (A * B) = A A * (A + B) = A

(A * B) + (A * ~B) = A (A + B) * (A + ~B) = A

A + (~A * B) = A + B A * (~A + B) = A * B Each law is described by two parts that are duals of each other. The Principle of duality is Interchanging the + (OR) and * (AND) operations of the expression. Interchanging the 0 and 1 elements of the expression. Not changing the form of the variables.

Application of Boolean Algebra Combinational Logic Circuit Design comprises the following steps From the design specification, obtain the truth table From the truth table, derive the Sum of Products Boolean Expression. Use Boolean Algebra to simplify the Boolean expression. The simpler the Boolean expression, the less logic gates will be used. Use logic gates to implement the simplified Boolean Expression.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 189

AC 3 The simplification uses Karnaugh maps to represent Boolean expressions Karnaugh map The Karnaugh map (KM or K-map) is a method of simplifying Boolean algebra expressions. Maurice Karnaugh introduced it in 1953 as a refinement of Edward Veitch's 1952 Veitch chart, which actually was a rediscovery of Allan Marquand's 1881 logical diagram aka Marquand diagram' but with a focus now set on its utility for switching circuits.' Veitch charts are therefore also known as Marquand–Veitch diagrams,' and Karnaugh maps as Karnaugh–Veitch maps (KV maps).

The Karnaugh map reduces the need for extensive calculations by taking advantage of humans' pattern-recognition capability. It also permits the rapid identification and elimination of potential race conditions. The required Boolean results are transferred from a truth table onto a two-dimensional grid where, in Karnaugh maps, the cells are ordered in Gray code, and each cell position represents one combination of input conditions, while each cell value represents the corresponding output value. Optimal groups of 1s or 0s are identified, which represent the terms of a canonical form of the logic in the original truth table. These terms can be used to write a minimal Boolean expression representing the required logic.

Karnaugh maps are used to simplify real-world logic requirements so that they can be implemented using a minimum number of physical logic gates. A sum-of-products expression can always be implemented using AND gates feeding into an OR gate, and a product-of-sums expression leads to OR gates feeding an AND gate. Karnaugh maps can also be used to simplify logic expressions in software design. Boolean conditions, as used for example in conditional statements, can get very complicated, which makes the code difficult to read and to maintain.

Once minimised, canonical sum-of-products and product-of-sums expressions can be implemented directly using AND and OR logic operators. Diagrammatic and mechanical methods for minimizing simple logic expressions have existed since at least the medieval times. More systematic methods for minimizing complex expressions began to be developed in the early 1950s, but until the mid to late 1980s the Karnaugh map was the most common used in practice.

Example

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 190

Karnaugh maps are used to facilitate the simplification of Boolean algebra functions. For example, consider the Boolean function described by the following truth table. Truth table of a function

A B C D {\displaystyle f(A,B,C,D)}

0 0 0 0 0 0

1 0 0 0 1 0

2 0 0 1 0 0

3 0 0 1 1 0

4 0 1 0 0 0

5 0 1 0 1 0

6 0 1 1 0 1

7 0 1 1 1 0

8 1 0 0 0 1

9 1 0 0 1 1

10 1 0 1 0 1

11 1 0 1 1 1

12 1 1 0 0 1

13 1 1 0 1 1

14 1 1 1 0 1

15 1 1 1 1 0

Following are two different notations describing the same function in unsimplified Boolean algebra, using the Boolean variables A, B, C, D, and their inverses. {\displaystyle f(A,B,C,D)=\sum _{}m_{i},i\in \{6,8,9,10,11,12,13,14\}}

where {\displaystyle m_{i}} are the minterms to map (i.e., rows that have output 1 in the truth table).

{\displaystyle f(A,B,C,D)=\prod _{}M_{i},i\in \{0,1,2,3,4,5,7,15\}} where {\displaystyle

M_{i}} are the maxterms to map (i.e., rows that have output 0 in the truth table).

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 191

Karnaugh ma K-map drawn on a torus, and in a plane. The dot-marked cells are adjacent. K-map construction. Instead of the output values (the rightmost values in the truth table), this diagram shows a decimal representation of the input ABCD (the leftmost values in the truth table), therefore it is not a Karnaugh map. In three dimensions, one can bend a rectangle into a torus. In the example above, the four input variables can be combined in 16 different ways, so the truth table has 16 rows, and the Karnaugh map has 16 positions. The Karnaugh map is therefore arranged in a 4 × 4 grid.

The row and column indices (shown across the top, and down the left side of the Karnaugh map) are ordered in Gray code rather than binary numerical order. Gray code ensures that only one variable changes between each pair of adjacent cells. Each cell of the completed Karnaugh map contains a binary digit representing the function's output for that combination of inputs.

After the Karnaugh map has been constructed, it is used to find one of the simplest possible forms — a canonical form — for the information in the truth table. Adjacent 1s in the Karnaugh map represent opportunities to simplify the expression. The minterms ('minimal terms') for the final expression are found by encircling groups of 1s in the map. Minterm groups must be rectangular and must have an area that is a power of two (i.e., 1, 2, 4, 8…).

Minterm rectangles should be as large as possible without containing any 0s. Groups may overlap in order to make each one larger. The optimal groupings in the example below are marked by the green, red and blue lines, and the red and green groups overlap. The red group is a 2 × 2 square, the green group is a 4 × 1 rectangle, and the overlap area is indicated in brown.

The cells are often denoted by a shorthand which describes the logical value of the inputs that the cell covers. For example, AD would mean a cell which covers the 2x2 area where A and D are true, i.e. the cells numbered 13, 9, 15, 11 in the diagram above. On the other hand, AD would mean the cells where A is true and D is false (that is, D is true). The grid is toroidally connected, which means that rectangular groups can wrap across the edges. Cells on the extreme right are actually 'adjacent' to those on the far left, in the sense that the corresponding input values only differ by one bit; similarly, so are those at the very top and those at the bottom. Therefore, AD can be a valid term—it includes cells 12 and 8 at

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 192

the top, and wraps to the bottom to include cells 10 and 14—as is B, D, which includes the four corners.

Solution Diagram showing two K-maps. The K-map for the function f(A, B, C, D) is shown as coloured rectangles which correspond to minterms. The brown region is an overlap of the red 2×2 square and the green 4×1 rectangle. The K-map for the inverse of f is shown as gray rectangles, which correspond to maxterms.

Once the Karnaugh map has been constructed and the adjacent 1s linked by rectangular and square boxes, the algebraic minterms can be found by examining which variables stay the same within each box.

For the red grouping: A is the same and is equal to 1 throughout the box, therefore it should be included in the algebraic representation of the red minterm. B does not maintain the same state (it shifts from 1 to 0), and should therefore be excluded. C does not change. It is always 0, so its complement, NOT-C, should be included. Thus, C should be included. D changes, so it is excluded. Thus the first minterm in the Boolean sum-of-products expression is AC.

For the green grouping, A and B maintain the same state, while C and D change. B is 0 and has to be negated before it can be included. The second term is therefore AB. Note that it is acceptable that the green grouping overlaps with the red one. In the same way, the blue grouping gives the term BCD. The solutions of each grouping are combined: the normal form of the circuit is {\displaystyle

A{\overline {C}}+A{\overline {B}}+BC{\overline {D}}} . Thus the Karnaugh map has guided a simplification of {\displaystyle {\begin{aligned}f(A,B,C,D)={}&{\overline {A}}BC{\overline {D}}+A{\overline {B}}\,{\overline {C}}\,{\overline {D}}+A{\overline {B}}\,{\overline {C}}D+A{\overline {B}}C{\overline {D}}+{}\\&A{\overline {B}}CD+AB{\overline {C}}\,{\overline {D}}+AB{\overline {C}}D+ABC{\overline {D}}\\={}&A{\overline {C}}+A{\overline {B}}+BC{\overline {D}}\end{aligned}}}

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 193

It would also have been possible to derive this simplification by carefully applying the axioms of Boolean algebra, but the time it takes to do that grows exponentially with the number of terms.

Inverse The inverse of a function is solved in the same way by grouping the 0s instead. The three terms to cover the inverse are all shown with grey boxes with different coloured borders: Brown: A, B Gold: A, C Blue: BCD This yields the inverse: {\displaystyle {\overline {f(A,B,C,D)}}={\overline {A}}\,{\overline {B}}+{\overline {A}}\,{\overline

{C}}+BCD} Through the use of De Morgan's laws, the product of sums can be determined: {\displaystyle {\begin{aligned}f(A,B,C,D)&={\overline {\overline {f(A,B,C,D)}}}\\&={\overline {{\overline {A}}\,{\overline {B}}+{\overline {A}}\,{\overline {C}}+BCD}}\\&=\left({\overline {{\overline {A}}\,{\overline {B}}}}\right)\left({\overline {{\overline {A}}\,{\overline {C}}}}\right)\left({\overline {BCD}}\right)\\&=\left(A+B\right)\left(A+C\right)\left({\overline

{B}}+{\overline {C}}+{\overline {D}}\right)\end{aligned}}} Don't cares

The value of {\displaystyle f(A,B,C,D)} for ABCD = 1111 is replaced by a "don't care". This removes the green term completely and allows the red term to be larger. It also allows blue inverse term to shift and become larger. Karnaugh maps also allow easier minimizations of functions whose truth tables include "don't care" conditions. A "don't care" condition is a combination of inputs for which the designer doesn't care what the output is. Therefore, "don't care" conditions can either be included in or excluded from any rectangular group, whichever makes it larger. They are usually indicated on the map with a dash or X. The example on the right is the same as the example above but with the value of f(1,1,1,1) replaced by a "don't care". This allows the red term to expand all the way down and, thus, removes the green term completely.

This yields the new minimum equation: {\displaystyle f(A,B,C,D)=A+BC{\overline {D}}}

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 194

Note that the first term is just A, not AC. In this case, the don't care has dropped a term (the green rectangle); simplified another (the red one); and removed the race hazard (removing the yellow term as shown in the following section on race hazards). The inverse case is simplified as follows:

AC 4 he simplification involves writing down the simplified expression from the map. The Karnaugh Map Boolean Algebraic Simplification Technique T Introduction deals with the discrete-valued digital signals. In general, any electronic system based on the digital logic uses binary notation (zeros and ones) to represent the states of the variables involved in it. Thus, Boolean algebraic simplification is an integral part of the design and analysis of a digital electronic system.

Although Boolean algebraic laws and DeMorgan's theorems can be used to achieve the objective, the process becomes tedious and error-prone as the number of variables involved increases. This necessitates the use of a suitable, relatively-simple simplification technique like that of Karnaugh map (K-map), introduced by Maurice Karnaugh in 1953.

A Typical K-Map The K-map method of solving the logical expressions is referred to as the graphical technique of simplifying Boolean expressions. K-maps are also referred to as 2D truth tables as each K- map is nothing but a different format of representing the values present in a one-dimensional truth table. K-maps basically deal with the technique of inserting the values of the output variable in cells within a rectangle or square grid according to a definite pattern. The number of cells in the K-map is determined by the number of input variables and is mathematically expressed as two raised to the power of the number of input variables, i.e., 2n, where the number of input variables is n.

Thus, to simplify a logical expression with two inputs, we require a K-map with 4 (=22) cells. A four-input logical expression would lead to a 16 (=24) celled-K-map, and so on.

Gray Coding Further, each cell within a K-map has a definite place-value which is obtained by using an encoding technique known as Gray code. The specialty of this code is the fact that the adjacent code values differ only by a single bit. That is, if the given code-word is 01, then the

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 195

previous and the next code-words can be 11 or 00, in any order, but cannot be 10 in any case. In K-maps, the rows and the columns of the table use Gray code-labelling which in turn represent the values of the corresponding input variables. This means that each K-map cell can be addressed using a unique Gray Code-Word.

These concepts are further emphasized by a typical 16-celled K-map shown in Figure 1, which can be used to simplify a logical expression comprising of 4-variables (A, B, C and D mentioned at its top-left corner). Here the rows and the columns of the K-map are labelled using 2-bit Gray code, shown in the figure, which assigns a definite address for each of its cells.

For example, the grey coloured cell of the K-map shown can be addressed using the code- word "0101" which is equivalent to 5 in decimal (shown as the green number in the figure) and corresponds to the input variable combination ABC̅ D̅ or A+B+C+D̅ ,̅ depending on whether the input–output relationship is expressed in SOP (sum of products) form or POS (product of sums) form, respectively.

Similarly, ABCD̅ or A+B+C̅ +D̅ ̅ refers to the Gray code-word of "1011", equivalent to 11 in decimal (again, shown in green in the figure), which in turn means that we are addressing the pink-coloured K-map cell in the figure.

K-Map Simplification Technique With this general idea of K-maps, let us now move on to the procedure employed in designing an optimal (in terms of the number of gates used to realize the logic) digital system. We'll start with a given problem statement.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 196

Example 1: Design a digital system whose output is defined as logically low if the 4-bit input is a multiple of 3; otherwise, the output will be logically high. The output is defined the input binary number is greater than 2.

Step 1: Truth Table / Canonical Expression Leading to Min- or Max-Terms The first step in designing any digital system is to have a clear idea of the variables involved in the process, along with their state-values. Further, depending on the problem statement, we have to arrive at the number of output variables and their values for each and every combination of the input literals, which can be conveniently represented in the form of a truth table.

In the given example: Number of input variables = 4, which we will call A, B, C and D. Number of output variables = 1, which we will call Y where Y = Don't Care, if the input number is less than 3 (orange entries in the truth table) Y = 0, if the input number is an integral multiple of 3 (green entries in the truth table) Y = 1, if the input number is not an integral multiple of 3 (blue entries in the truth table)

Note that, in addition to the input and output columns, the truth table also has a column which gives the decimal equivalent of the input binary combination, which makes it easy for us to arrive at the minterm or maxterm expansion for the given problem. Thus for the given example,

Minterm expansion will be ∑m(4,5,7,8,10,11,13,14) + ∑d (0,1,2) Maxterm expansion will be ∏M(3,6,9,12,15) · ∏D (0,1,2) However, sometimes the logical expression which is to be simplified might be directly given in terms of SOP or POS forms. In this case, the requirement for the truth table can be overlooked provided that we express the given expression in its canonical form, from which the corresponding minterms or maxterms can be obtained.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 197

Step 2: Select and Populate K-Map From Step 1, we know the number of input variables involved in the logical expression from which size of the K-map required will be decided. Further, we also know the number of such K-maps required to design the desired system as the number of output variables would also be known definitely. This means that, for the example considered, we require a single (due to one output variable) K-map with 16 cells (as there are four input variables). Next, we have to fill the K-map cells with one for each minterm, zero for each maxterm, and X for Don't Care terms. The procedure is to be repeated for every single output variable. Hence for this example, we get the K-map as shown in Figure 2.

Step 3: Form the Groups K-map simplification can also be referred to as the "simplification by grouping" technique as it solely relies on the formation of clusters. That is, the main aim of the entire process is to gather together as many ones (for SOP solution) or zeros (for POS solution) under one roof for each of the output variables in the problem stated. However, while doing so we have to strictly abide by certain rules and regulations: The process has to be initiated by grouping the bits which lie in adjacent cells such that the group formed contains the maximum number of selected bits.

This means that for an n-variable K-map with 2n cells, try to group for 2n cells first, then for 2n-1 cells, next for 2n-2 cells, and so on until the “group” contains only 20 cells, i.e., isolated bits (if any). Note that the number of cells in the group must be equal to an integer power to 2, i.e., 1, 2, 4, 8. . . .

The procedure must be applied for all adjacent cells of the K-map, even when they appear to be not adjacent—the top row is considered to be adjacent to the bottom row and the rightmost column is considered to be adjacent to the leftmost column, as if the K-map wraps around from top to bottom and right to left. For example, Group 1 of SOP form solution in Table 1.

A bit appearing in one group can be repeated in another group provided that this leads to the increase in the resulting group-size. For example, cell 5 is repeated in both Group 3 as well as 4 in SOP form solution of Table 1 as it results in the formation of a group with two cells instead of a group with just one cell.

Don’t Care conditions are to be considered for the grouping activity if and only if they help in obtaining a larger group. Otherwise, they are to be neglected. Here the Don't Care terms in

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 198

the cells 0 and 1 are considered to create Group 2 of SOP solution form as it results in a group with four cells instead of just two.

SOP Form Solution POS Form Solution

Number of groups 0 0 having 16 cells

Number of groups 0 0 having 8 cells

Number of groups having Group 1 (Cells 0,2,8,10) Group 1 (Cells 4 cells (Blue Enclosures in 2 1 Group 2 (Cells 0,1,4,5) 0,1,2,3) Figure 3)

Group 3 (Cells Group 4 (Cells Group 2 (Cells Number of groups having 5,7) 5,13) 1,9) 2 cells (Orange Enclosures 4 2 Group 5 (Cells Group 6 (Cells Group 3 (Cells in Figure 3) 10,11) 10,14) 2,6)

Number of groups having Group 4 (Cell 12) 1cell (Green Enclosures in 0 2 Group 5 (Cell 15) Figure 3)

Step 4: Simplified Logical Expression For each of the resulting groups, we have to obtain the corresponding logical expression in terms of the input-variables. This can be done by expressing the bits which are common amongst the Gray code-words which represent the cells contained within the considered group. Another way to describe the process of obtaining the simplified logical expression for a group is to eliminate the variable(s) for which the corresponding bits appear within the group as both 0 and 1.

Finally, all these group-wise logical expressions need to be combined appropriately to form the simplified Boolean equation for the output variable. The same procedure must be repeated for every output variable of the given problem.

For instance, in the example considered, the logical term for Group 2 of SOP form solution is obtained as AC̅ .̅ This is due to the fact that this group has 0 as the common Gray code-word

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 199

bit both along its rows as well as its columns, highlighted in Figure 4(a). This gives us the literals A ̅ and C.̅

Similarly, in the case of Group 1 of POS form solution, we can obtain the logical expression as A+B. This is because the group has the common Gray code-words as 0,0 along its row only (no code-word bits are common along its columns) which correspond to the input variables A and B.

Following this same process, we can obtain the logical terms corresponding to each of the groups to finally form the logical expression for the particular output, as shown by Table 2.

SOP Form Solution POS Form Solution

Groups Logical Expression Groups Logical Expression

Group 1 BD̅ ̅ Group 1 A+B

Group 2 AC̅ ̅ Group 2 B+C+D ̅

Group 3 ABD̅ Group 3 A+C+D̅

Group 4 BCD̅ Group 4 A+B̅ +C+D̅

Group 5 ABC̅ Group 5 A+B̅ +C̅ +D̅ ̅

Group 6 ACD ̅

Thus, Y = (A+B) (B+C+D)̅ (A+C+D)̅ Thus, Y = BD̅ ̅ + AC̅ ̅ + ABD̅ + BCD̅ + ABC̅ + ACD ̅ (A+B̅ +C+D)̅ (A+B̅ +C̅ +D̅ )̅

Step 5: System Design Having obtained the simplified logical expression, we can decide on the type and the number of gates required to realize the expected logic for every output bit, which further results in the complete design of the desired system.

Thus, the digital system corresponding to SOP and POS forms of solution for the given example can be designed using the basic gates like NOT, AND, and OR as shown by Figure 5(a) and 5(b).

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 200

Describe the basic concepts of error detection Time: 180 minutes Activity: Self and Group

AC 1 he description identifies the common causes of errors. Logical errors; integration errors. Programming software and the IDE T There are many programming languages. To execute, they have to be compiled or interpreted. An IDE (integrated development environment) is used to write code, test for errors and translate a program.

Errors There are different types of errors, or bugs, which can prevent computer programs from working in the way they should. Three of the key error types are runtime, syntax and semantic.

Runtime errors Runtime errors are errors which will cause the program or computer to crash even if there appears to be nothing wrong with the program code. Running out of memory will often cause a runtime error. This could be because instructions have been written in the wrong order.

Syntax errors Syntax errors are mistakes in the way that the code is written. Translators can only execute a program if it is syntactically correct. Common syntax errors include spelling mistakes, incorrect use of punctuation and the use of capital letters.

Question This is a piece of Python code designed to add two numbers together and display the result: first = input("Input the first number ") second = imput("Input the second number ") print("The sum is,First+secnd)

Semantic errors

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 201

Semantic errors, or logical errors, are those where the program works but produces different results from what you designed or expected. A program with semantic errors will execute without any errors being reported.

This Python code contains a semantic error. The program will run, but it will only be obvious what the problem is when you see the output result. first = input("Input the first number ") second = input("Input the second number ") print("The sum is",first+second)

The first two lines ask the user to suggest number values. However, the input function returns a string data type for each variable. If the user gives the value '2' for the first and second numbers, these will be stored as strings.

When you add two strings together, e.g. "Jam" and "Sandwich", the answer is "JamSandwich". Adding "2" and "2" together will concatenate 2 and 2 to produce an answer of "22".

If you try this program - because it is a valid program with no syntax errors - it should work first time. However, after testing it you would notice the unexpected results. The correct code would require each value to be set as an integer. However, the integers then need to be output as a string along with the rest of the outputted message.

The correct code should be: first = int(input("Input the first number ")) second = int(input("Input the second number")) print(“The sum is: “ + str(first+second))

Assemblers, compilers and interpreters Translators - usually included within programming software - convert high-level code into machine code. Translators are assemblers, interpreters or compilers.

Assembler 'An assembler translates assembly language into machine code. Assembly language is a low- level language written in mnemonics that closely reflects the operations of the CPU.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 202

Interpreter An interpreter translates code into machine code, instruction by instruction - the CPU executes each instruction before the interpreter moves on to translate the next instruction. Interpreted code will show an error as soon as it hits a problem, so it is easier to debug than compiled code.

An interpreter does not create an independent final set of source code - source code is created each time it runs. Interpreted code is slower to execute than compiled code. Interpreted languages include JavaScript, PHP, Python and Ruby. Interpreted languages are also called scripting languages. These are ideal for using within dynamic web applications. They are used for client-side and server-side coding, as they are small programs that are executed within the browser.

Compiler A compiler translates the whole program into machine code before the program is run. It can be difficult to test individual lines of compiled code compared to interpreted languages as all bugs are reported after the program has been compiled.

The machine code is saved and stored separately to the high-level code. Compilation is slow but machine code can be executed quickly.

Java and C++ are compiled programming languages. Java is a high-level programming language which is compiled to produce bytecode which is then interpreted by a virtual machine (VM). Bytecode is code which is compiled and can then be interpreted.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 203

AC 2 he description identifies error isolation techniques. Ceteris Paribus What Is Ceteris Paribus? T Ceteris paribus, literally "holding other things constant," is a Latin phrase that is commonly translated into English as "all else being equal." A dominant assumption in mainstream economic thinking, it acts as a shorthand indication of the effect of one economic variable on another, provided all other variables remain the same.

Understanding Ceteris Paribus In the fields of economics and finance, ceteris paribus is often used when making arguments about cause and effect. An economist might say raising the minimum wage increases unemployment, increasing the supply of money causes inflation, reducing marginal costs boosts economic profits for a company, or establishing rent control laws in a city causes the supply of available housing to decrease.

Key takeaways Ceteris paribus is a Latin phrase that generally means "all other things being equal." In economics, it acts as a shorthand indication of the effect one economic variable has on another, provided all other variables remain the same. Many economists rely on ceteris paribus to describe relative tendencies in markets and build and test economic models, although it is not without flaws.

Ceteris paribus assumptions help transform an otherwise deductive social science into a methodologically positive "hard" science. It creates an imaginary system of rules and conditions from which economists can pursue a specific end. Put another way; it helps the economist circumvent human nature and the problems of limited knowledge.

Most, though not all, economists rely on ceteris paribus to build and test economic models. In simple language, it means the economist can hold all variables in the model constant and tinker with them one at a time. Ceteris paribus has its limitations, especially when such arguments are layered on top of one another. Nevertheless, it is an important and useful way to describe relative tendencies in markets.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 204

Examples of Ceteris Paribus Suppose you wanted to explain the price of milk. With a little thought, it becomes apparent that milk costs are influenced by numerous things: the availability of cows, their health, the costs of feeding cows, the amount of useful land, the costs of possible milk substitutes, the number of milk suppliers, the level of inflation in the economy, consumer preferences, transportation, and many other variables. So an economist instead applies ceteris paribus, which essentially says if all other factors remain constant, a reduction in the supply of milk- producing cows causes the price of milk to rise.

As another example, take the laws of supply and demand. Economists say the law of demand demonstrates that ceteris paribus (all else being equal), more goods tend to be purchased at lower prices. Or that, if demand for any given product exceeds the product's supply, ceteris paribus, prices will likely rise. The complicated nature of economics makes it difficult to account for all of the possible variables that determine supply and demand, so ceteris paribus assumptions simplify the equation so that the causal change can be isolated.

Ceteris paribus is an extension of scientific modelling. The scientific method is built on identifying, isolating, and testing the impact of an independent variable on a dependent variable. Since economic variables can only be isolated in theory and not in practice, ceteris paribus can only ever highlight tendencies, not absolutes.

History of Ceteris Paribus Two major publications helped move mainstream economics from a deductive social science based on logical observations and deductions into an empirically positivist natural science. The first was Léon Walras' Elements of Pure Economics in 1874, which introduced general equilibrium theory. The second was John Maynard Keynes' The General Theory of Employment, Interest, and Money in 1936, which created modern macroeconomics. In an attempt to be more like the academically respected "hard sciences" of physics and chemistry, economics became math-intensive. Variable uncertainty, however, was a major problem; economics could not isolate controlled and independent variables for math equations.

There was also a problem with applying the scientific method, which isolates specific variables and tests their interrelatedness to prove or disprove a hypothesis. Economics does not naturally lend itself to scientific hypothesis testing. In the field of epistemology, scientists can learn through logical thought experiments, also called deduction, or through empirical observation and testing, also called positivism. Geometry is a logically deductive science. Physics is an empirically positive science.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 205

Unfortunately, economics and the scientific method are naturally incompatible. No economist has the power to control all economic actors, hold all of their actions constant, and then run specific tests. No economist can even identify all of the critical variables in a given economy. For any given economic event, there could be dozens or hundreds of potential independent variables.

Enter ceteris paribus. Mainstream economists construct abstract models where they pretend all variables are held constant, except the one they want to test. This style of pretending, called ceteris paribus, is the crux of general equilibrium theory. As economist Milton Friedman wrote in 1953, "Theory is to be judged by its predictive power for the class of phenomena which it is intended to 'explain.'" By imagining all variables save one are held constant, economists can transform relative deductive market tendencies into absolute controllable mathematical progressions. Human nature is replaced with balanced equations.

Benefits of Ceteris Paribus Suppose an economist wants to prove a minimum wage causes unemployment or that easy money causes inflation. He could not possibly set up two identical test economies and introduce a minimum wage law or start printing dollar bills. So the positive economist, charged with testing his theories, must create a suitable framework for the scientific method, even if this means making very unrealistic assumptions. The economist assumes buyers and sellers are price-takers rather than price makers.

The economist also assumes actors have perfect information about their choices, since any indecision or incorrect decision based on incomplete information creates a loophole in the model.If the models produced in ceteris paribus economics appear to make accurate predictions in the real world, the model is considered successful. If the models do not appear to make accurate predictions, they are revised. This can make positive economics tricky; circumstances might exist that make one model look correct one day but incorrect a year later. Some economists reject positivism and embrace deduction as the principal mechanism of discovery. The majority, however, accept the limits of ceteris paribus assumptions, to make the field of economics more like chemistry and less like philosophy.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 206

Criticisms of Ceteris Paribus Ceteris paribus assumptions are at the heart of nearly all mainstream microeconomic and macroeconomic models. Even so, some critics of mainstream economics point out that ceteris paribus gives economists the excuse to bypass real problems about human nature. Economists admit these assumptions are highly unrealistic, and yet these models lead to concepts such as utility curves, cross elasticity, and monopoly. Antitrust legislation is actually predicated on perfect competition arguments.

The Austrian school of economics believes ceteris paribus assumptions have been taken too far, transforming economics from a useful, logical social science into a series of math problems. Let's go back to the example of supply and demand, one of the favourite uses of ceteris paribus.

Every introductory textbook into microeconomics, notably Samuelson (1948) and Mankiw (2012), show static supply and demand charts where prices are given to both producers and consumers; that is, at a given price, consumers demand and producers supply a certain amount. This is a necessary step, at least in this framework, so that economics can assume away the difficulties in the price-discovery process.

But prices are not a separate entity in the real world of producers and consumers. Rather, consumers and producers themselves determine prices based on how much they subjectively value the good in question versus the quantity of money for which it is traded. In 2002, financial consultant Frank Shostak wrote that this supply-demand framework is "detached from the facts of reality."

Rather than solving equilibrium situations, he argued, students should learn how prices emerge in the first place. He claimed any subsequent conclusions or public policies derived from these abstract graphical representations are necessarily flawed.

Like prices, many other factors that affect the economy or finance are continuously in flux. Independent studies or tests may allow for the use of the ceteris paribus principle. But in reality, with something like the stock market, one cannot ever assume "all other things being equal." There are too many factors affecting stock prices that can and do change constantly; you can't isolate just one.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 207

AC 3 he description identifies various testing techniques. Black-box testing Black-box testing is a method of software testing that examines the functionality T of an application without peering into its internal structures or workings. This method of test can be applied virtually to every level of software testing: unit, integration, system and acceptance. It is sometimes referred to as specification- based testing.

Test procedures Specific knowledge of the application's code, internal structure and programming knowledge in general is not required. The tester is aware of what the software is supposed to do but is not aware of how it does it. For instance, the tester is aware that a particular input returns a certain, invariable output but is not aware of how the software produces the output in the first place.

Test cases Test cases are built around specifications and requirements, i.e., what the application is supposed to do. Test cases are generally derived from external descriptions of the software, including specifications, requirements and design parameters. Although the tests used are primarily functional in nature, non-functional tests may also be used. The test designer selects both valid and invalid inputs and determines the correct output, often with the help of a test oracle or a previous result that is known to be good, without any knowledge of the test object's internal structure.

Test design techniques Typical black-box test design techniques include: Decision table testing All-pairs testing Equivalence partitioning Boundary value analysis Cause–effect graph Error guessing State transition testing Use case testing User story testing Domain analysis Syntax testing Combining technique

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 208

Hacking In penetration testing, black-box testing refers to a method where an ethical hacker has no knowledge of the system being attacked. The goal of a black-box penetration test is to simulate an external hacking or cyber warfare attack.

What is Black Box Testing? Black box testing involves testing a system with no prior knowledge of its internal workings. A tester provides an input, and observes the output generated by the system under test. This makes it possible to identify how the system responds to expected and unexpected user actions, its response time, usability issues and reliability issues.

Black box testing is a powerful testing technique because it exercises a system end-to-end. Just like end-users “don’t care” how a system is coded or architected, and expect to receive an appropriate response to their requests, a tester can simulate user activity and see if the system delivers on its promises. Along the way, a black box test evaluates all relevant subsystems, including UI/UX, web server or application server, database, dependencies, and integrated systems.

An example of a security technology that performs black box testing is Dynamic Application Security Testing (DAST), which tests products in staging or production and provides feedback on compliance and security issues.

Black Box Testing Pros and Cons Pros Cons

Testers do not require technical 1. Difficult to automate knowledge, programming or IT skills

Testers do not need to learn Requires prioritization, typically 2. implementation details of the system infeasible to test all user paths

Tests can be executed by crowdsourced or 3. Difficult to calculate test coverage outsourced testers

If a test fails, it can be difficult to 4. Low chance of false positives understand the root cause of the issue

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 209

Tests have lower complexity, since they Tests may be conducted at low scale or 5. simply model common user behaviour on a non-production-like environment

Black Box and White Box Testing Many practitioners combine black box testing with white box testing. White box testing involves testing an application with detailed inside information of its source code, architecture and configuration. It can expose issues like security vulnerabilities, broken paths or data flow issues, which black box testing cannot test comprehensively or at all. By combining black box and white box testing, testers can achieve a comprehensive “inside out” inspection of a software application and increase coverage of quality and security issues.

Grey Box Testing While white box testing assumes the tester has complete knowledge, and black box testing relies on the user’s perspective with no code insight, grey box testing is a compromise. It tests applications and environments with partial knowledge of internal workings. Grey box testing is commonly used for penetration testing, end-to-end system testing, and integration testing.

You can perform grey box testing using Interactive Security Testing (IAST) tools. IAST tools combine DAST and Static Application Security Testing (SAST), which is used in white box testing to evaluate static code. IAST tools enable you to combine the work of testers and developers and increase test coverage efficiently.

For example, you are able to perform more directed tests which focus on areas or user paths that are most likely to contain flaws. By combining these two testing methods you can ensure that tests: Apply knowledge of application structure to identify vulnerabilities and bugs Evaluate the application objectively and uncover UI/UX issues, as a real user would Cover all aspects of an applications functionality

Types Of Black Box Testing Black box testing can be applied to three main types of tests: functional, non-functional, and regression testing.

Functional Testing Black box testing can test specific functions or features of the software under test. For example, checking that it is possible to log in using correct user credentials, and not possible

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 210

to log in using wrong credentials. Functional testing can focus on the most critical aspects of the software (smoke testing/sanity testing), on integration between key components (integration testing), or on the system as a whole (system testing).

Non-Functional Testing Black box testing can check additional aspects of the software, beyond features and functionality. A non-functional test does not check “if” the software can perform a specific action but “how” it performs that action. Black box tests can uncover if software is: Usable and easy to understand for its users Performant under expected or peak loads Compatible with relevant devices, screen sizes, browsers or operating systems Exposed to security vulnerabilities or common security threats

Regression Testing Black box testing can be used to check if a new version of the software exhibits a regression, or degradation in capabilities, from one version to the next. Regression testing can be applied to functional aspects of the software (for example, a specific feature no longer works as expected in the new version), or non-functional aspects (for example, an operation that performed well is very slow in the new version).

Black Box Testing Techniques Equivalence Partitioning Testers can divide possible inputs into groups or “partitions”, and test only one example input from each group. For example, if a system requires a user’s birth date and provides the same response for all users under the age of 18, and a different response for users over 18, it is sufficient for testers to check one birth date in the “under 18” group and one date in the “over 18” group.

Boundary Value Analysis Testers can identify that a system has a special response around a specific boundary value. For example, a specific field may accept only values between 0 and 99. Testers can focus on the boundary values (-1, 0, 99 and 100), to see if the system is accepting and rejecting inputs correctly.

Decision Table Testing

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 211

Many systems provide outputs based on a set of conditions. Testers can then identify “rules” which are a combination of conditions, identify the outcome of each rule, and design a test case for each rule.

For example, a health insurance company may provide different premium based on the age of the insured person (under 40 or over 40) and whether they are a smoker or not. This generates a decision table with four rules and up to four outcomes—below is an example with three possible outcomes.

State Transition Testing In some systems, significant responses are generated when the system transitions from one state to another. A common example is a login mechanism which allows users to authenticate, but after a specific number of login attempts, transition to a different state, locking the account.

If testers identify a state transition mechanism, they can design test cases that probe the system when it transitions states. For example, for a system that locks the account after five failed login attempts, a test case can check what happens at the sixth login attempt

Conditions Rule 1 Rule 2 Rule 3 Rule 4

Under 40 False False True True

Smoker False True False True

OUTCOMES

1: High premium

2: Medium premium

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 212

3: Low premium

In this case four use cases (one for each rule) would be sufficient to fully test the system.

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 213

You are now ready to go through a check list. Be honest with yourself Tick the box with either a √ or an X to indicate your response

 I am able to describe different approaches to problem solving  I am able to use logical operations in descriptions of rules and relationships in problem situations  I am able to simplify Boolean expressions with Boolean Algebra and Karnaugh maps  I am able to describe the basic concepts of error detection

You must think about any point you could not tick. Write this down as a goal. Decide on a plan of action to achieve these goals. Regularly review these goals.

My Goals and Planning: ______

NC: IT: SYSTEMS DEVELOPMENT AUTHOR: LEARNER MANUAL REL DATE: 27/01/2020 REV DATE: 01/01/2023 DOC REF: 48872 LM MOD 3 V-1 PAGE 214