Software Design and Development HSC Notes
Software Design and Development HSC Notes
Software Approaches
● Factors of defining approaches
○ Scale of the product
○ Complexity of the product
○ Skills of the personnel developing the product
○ Detail of the requirements
○ Time for project
○ Budget
● Different types:
○ Structured
■ Time-consuming, ordered and controlled
■ Highest level of personnel skill required
■ Product of the highest size and quality
■ Top-down approach (waterfall method)
■ Thoroughly planned, documented and monitored
■ Used for large products in large companies
■ Costs are high and errors can be hard to find and correct
■ Requirements are understood before design and coding occurs
■ Requires high project management
○ Agile
■ Emerged due to the demand for products to be specifically tailored for
individuals
■ Places emphasis on system being developed
■ In depth documentation is not needed
■ Focus on team-work, cooperating, communication skills and efficient work
methods
■ Development team must be able to adapt to the situation
■ Small teams preferred; members are multiskilled
■ Characterised by the speed of getting the product to the user, interaction
between the team and users, responds well to changing circumstances
■ Product in development being continually updated.
○ Prototyping
■ Lies between structured and agile approach
■ Predates the agile approach
■ Repeatedly iterates through development stages to refine user requirements
■ Each prototype includes more functionality
■ Intense user interaction
■ Prototypes are just interactive models of the user interface
■ Favoured over structured approach is the ability to adapt to changing
requirements is required
■ There are five types of prototyping approaches:
● Concept prototyping
● Rapid throwaway prototyping
● Evolutionary prototyping
● Incremental prototyping
● Extreme prototyping
■ Acknowledges that the communication with users is very important and
helps in the defining and understanding of any future products to be
developed.
○ RAD
■ Main purpose of reducing time and money
■ Result of low quality, less usability and less features
■ RAD has only become possible due to 4th generation programming
languages, which enable visual production of interfaces with little coding
taking place in the background
■ Ability to include re-usable code which has been developed
■ Integrate with other software solutions
■ Development team to work very close to each other
■ Continuous feedback with users
■ Only meets most important requirements
■ RAD lacks formal stages to reduce time and cost
■ Removes need for data structures, algorithms
■ Uses existing routines and API of applications
■ RAD is suited when
● Distribution is narrow
● Application runs on small LAN
● Does not need to interface with other systems
■ Advantages of RAD
● Reduced coding of modules where library code is used
● Less errors
● Library code can ensure consistent look and feel
● Shorter development cycle
○ End User
■ Never used in software companies, not made for the purpose of making
money
■ Used to address a specific problem that end users need a solution for
■ Very small budget
■ Does not require knowledge of the workings of a computer, as it uses
Customised off the shift (COTS) software, Wizards or other automated code
generated devices
■ Resulting programs will not be overly complex and may not meet
specifications that the user may have initially wanted
■ Advantages of the End User approach
● The solution can be revised and modified at will, without
consultation with other users.
● No money required
● Less development time required
● A freedom to change requirements at any stage
○ Combinations of Software Development Approaches
■ Does not have to be of one type, or another
■ Combinations of approaches are perfectly viable, as different components of
a program may be developed using different approaches
■ The combination can be used to make the most efficient, low costing, high
quality solution.
■ One example is the use of an Agile approach with Prototyping, with meetings
between the client and developers being used to discuss current prototypes.
● CASE Tools
○ Version Control
■ Helps archive and maintain current/past versions of a program
■ Logs the current version, and changes made to each version
○ Test Data Generation
■ Test correct operation of modules
■ Test and evaluate performance
■ Check error messages
■ Outputs can be compared
○ Production of Code/Documentation
■ Avoid delays in production
■ Data flow diagrams
■ Structure diagrams
■ Flow charts
● Methods of Updating systems
○ Direct
■ Involves the old system being completely dropped and the new system being
installed at the same time
■ Need to make sure the new system is completely functional and operational
■ This conversion method is only used when it is not feasible to operate two
separate systems at the same time
■ Any data conversion and import must be done before installation occurs
■ New data lost if new system fails
■ Implementation occurs over shorter period but may be more time
consuming
○ Parallel
■ Involve the operating of both systems being run for a period of time
■ Allows problems with the new system to be found without loss of data
■ Once new system is up and running, the old system can stop being used
■ Old systems must be used until conversion
○ Phased
■ Gradual introduction of the new and discarding of the old
■ Done by introducing new parts while removing old parts
■ Often used when product is still under development
■ Done over a period of time
○ Pilot
■ The new system is installed for a small number of users
■ These users learn, use, and evaluate the system
■ Once it is seen as satisfactory, it is installed and used by all
■ Allows users to become experts and teachers of the new system
■ Pilot conversion also allows for the testing of the product in an operational
setting
● Trends
○ From 1995 to 2000, there was a large increase in job opportunities in software
development, though this pace has gotten slower
○ Employment based on experience
○ Meet demand for jobs
○ Outsourcing
■ Outsource work to specialists if they do not have expertise of resources
■ Reduces and controls costs
■ Higher quality results from specialists
■ Access to newer tech
■ Faster development times
■ Specialists are able to respond to change easily
○ Changing nature of work
■ Work has shifted from in person - in firms - to remotely working, which can
be done even internationally
○ Changing nature of applications
■ Originally, applications were solely used for computing in the primitive
stages of software development.
■ Now, there exist a wide range of applications for many day-to-day purposes
■ Examples:
● Mobile applications
● Big data processing - data analysts
● Cloud technology - iCloud, DropBox,
● DevOPs software, development operation managers - serve customer
and clients better; cloud management
● User interface developers - consumer focused, intuitive, create
enterprise applications and apps make it user friendly
● Web based software - Google apps, Facebook, Youtube, Instagram
● Learning Objects
● Widgets
● Cloud computing, Microsoft Azure
Design Specifications
● The need of the proposed system
○ A software’s requirements specification is a standard framework for a team to
develop a large, complex software system and includes a complete description of the
behaviour of a system to be developed.
○ Includes a set of use cases that describes all the interactions the users will have with
the software.
○ SRS also contains non-functional requirements, and the methods which will be used
to model the system will also be specified.
● Developer’s perspective
○ Data Types
■ The types of data that are to be used in the software should be specified
beforehand.
■ For example, an inventory management system would most likely use a large
amount of data in the form of strings and integers, and so these data types
should be considered in defining and understanding the problem.
○ Data Structures and Variables
■ Variables represent storage locations of data within the computer system
■ A programmer will look at the data items and determine how they are to be
stored and accessed
■ The data type and an appropriate identifier is then determined
■ Meaningful variable names are considered intrinsic documentation and help
programmers follow the logic of the program
■ Global or Local Variables
○ Algorithms
■ Pseudocode or flow charts
■ Problem is modularised (split into modules)
■ Top down decomposition (more about this later on)
■ Familiar modules, which can be drawn from a library of code (such as
random number generation)
■ This method ensures a minimum of testing is required
● User’s Perspective
○ Interface design
■ Standards for interface design will be specified to ensure continuity of
design across the project’s visuals.
■ The wording of messages, design of icons and the format of any data
presented to the user need to be determined and a set of specifications
created.
■ Ergonomic Issues should also be considered.
○ (Social and Ethical) S & E issues
■ When developing software, S & E issues must also be considered, such as the
use of such software in a work environment, whether it is child-friendly,
whether the nature of the software can be subverted for malicious purposes
etc.
Quality Assurance
● Explicit defined criteria
○ By ensuring that the client/developers have agreed on an explicit criteria for the
software, the problem can be thoroughly defined from the beginning, allowing for
lesser mistakes
○ Furthermore, all the development that is undergone in the SDC can be checked
against the criteria, to ensure that the project is not deviating from its original goal.
● Management process put in place
○ A management process, incorporating a team of a system of individuals that manage
the development process, ensure that the project is upheld in terms of timescale, as
well as understanding the problem, leading to a higher quality product.
○ For example, a manager is able to delegate certain tasks/modules to more junior
workers in this management process, while ensuring that they are completing these
tasks with respect to the criteria.
● Ongoing checking that it’s being met.
○ Similar to the management process that is put into place, ongoing checking of the
software by both the client and senior developers (in reference to previously defined
requests/the explicit defined criteria) ensure that the project constantly refers back
to (and fulfils) the explicitly defined criteria that was first implemented, to assure
the project is at its best quality.
System Documentation
● Different types of documentation are produced throughout the software development cycle
● Many large companies
utilise diagrams that
form part of the UML
(unified modelling
language) which
incorporated a variety
of different modelling
tools that are now
available as part of
many CASE tools and IDE’s (integrated development environments)
● A model of a system is a representation of that system designed to show the structure and
functionality of a system. Many system modelling tools are in the form of diagrams
● The model gives directions and specifications for the developers
● Different types of modelling are applicable to different aspects of the system
● IPO Charts
○ Explain how inputs
are transformed into
outputs by processing
○ Expand on the
processes found in the
data flow diagram and
structure diagram
○ IPO diagram can
either be
diagrammatical, or in
a table form (mainly
in a table form)
● Context Diagrams
○ Used to present an
overview of the
whole system
○ Shown as a single
process, along with
inputs and outputs
○ Visualises data
entering and
information exiting
the system without
detailing the
processing required
in any detail.
○ Does not show data stores nor internal processes
○ Also known as level 0 data flow diagrams
○ Symbols:
■ Rectangle - person or organisation, source or sink that provides or receives
data
■ Arrow - flow of data
■ Circle - process (in this case, the entire system)
● Data Flow Diagrams
○ Represent a
system as
several
processes that, together, form a single system
○ It is a deeper look into the context diagram, showing further detail
○ DFDs identify the source of data, flow between processes, and it’s destination along
with data generated by the system
○ Symbols:
■ Squares - representing external entities, sources or destinations of data
■ Circles - processes, which take data as an input, process it, and output it
■ Arrows - represent the data flow, electronic data or physical items
■ Open-ended rectangles - represent data stores such as databases.
● Storyboards
○ Shows the various interfaces in a
system as well as the links
between them,
○ The representation of each
interface should be detailed
enough for the reader to identify
the purpose, contents and design
elements.
○ Areas used for input, output and
navigation should be clearly
identified and labelled
○ Any links shown between
interfaces should originate from
the navigational element that triggers the link.
● Structure Charts
○ Describes the top-down design and sequencing of a process
○ Represents a system by showing the separate modules or subroutines that
compromise the system and their relationship to each other
○ The chart is read from top to bottom, with component modules or subroutines on
successively lower levels, indicating these modules or subroutines are called by the
module or subroutine above.
○ Modules are read left to right to show the order of execution
○ These modules set the structure for the development of the IPO diagrams and the
development of the algorithm and subsequent coding of each module
○ Structure charts are useful for maintenance
○ Symbols:
■ Open arrow - data movement between modules or subroutines, usually
passes as parameters
■ Closed arrow - indicates a flag or control variable
■ Small diamond at intersection - a decision
■ Undo arrow - repetition
■ Line - call the module
● System Flowcharts
○ Used to represent the logic and movement of data between the system components,
including hardware, software and manual components
○ System flowcharts are a diagrammatic way of representing the system to show the
flow of data, the separate modules comprising the system and the media used
○ Many symbols for system flowcharts have become outdated because of changes in
technology
○ Symbols:
● Data Dictionaries
○ Comprehensive
description of
each data item
in a system
○ Commonly
includes:
■ Variable name
■ Size in bytes
■ Number of characters as displayed on screen
■ Data type
■ Format including decimal points if applicable
■ Description
■ Example of data
● Extended Backus-Naur Form (EBNF)
○ Metalanguage - A way to describe language in a simplified form
○ EBNF is a metalanguage used to define the syntax of any programming language.
The following symbols are used:
Symbol Definition
Terminal symbol There is no need for further definition of this item. It may be
a symbol or a reserved word (such as PRINT, IF…)
Examples Letter = A | B | C
Digit = 0 | 1 | 2 | 3 | 4 | 5
Identifier = <Letter>{<Letter><Digit>}
○ structured walkthrough
■ Similar to the desk checking process above, a structured walkthrough is
usually more formal than peer checks, with an evaluation of code by walking
through each line
■ No attempt is made to correct problems, only feedback is given
■ Made to evaluate design at different levels
○ comparison of actual with expected output
■ The output of initial tests should be compared with expected output that has
been determined in the planning and design stage
■ If the actual and expected output vary, then a logic error has more than likely
occurred
■ All paths in logic should be tested
■ Often in large programs, subroutines or individual modules are tested by
individuals for logic errors
■ Testing software may assist in the testing of logic, particularly in large
software development projects
○ the use of software debugging tools, including:
■ use of breakpoints
● A simple technique which may temporarily or permanently stop
executions
● Used to check variable contents before and after processes occur
● Breakpoints are placed in areas where errors may exist, to locate the
source of error
● Many development environments (IDE’s) allow lines of code to be
marked with a breakpoint
○ For example, Visual Studio Code allows breakpoints to be
placed and the code ran up until/from the breakpoint, to
check for errors.
■ resetting variable contents
● The data stored in a variable can be changed while the program is
running
● The program is usually halted using a breakpoint
● Can be used to check which values are giving errors by changing the
values when execution has stopped
■ program traces
● Allows the programmer to view progress of the program execution in
detail
● The order of line executions is tracked, analysing the flow of the
statements
● Particularly useful for following the progress of the program through
nested loops or complicated section
● A log of transitions from section to section is often created, and this
trace log can be used to identify sources of errors
■ single line stepping
● A variable trace enables the programmer to observe the variable
changing throughout the program
● Single line stepping is the process of halting the executions after each
line or statement
● A keystroke is usually required to step through lines (such as Enter,
or K)
● Usually used to concentrate on a sub routine instead of the whole
program
● Some IDE’s also allow for the stepping back of programs, which allow
programmers to double-check whether certain lines are the ones
causing logic errors
■ Watch expressions
● Expressions whose values are written to a separate watch window
● These watch expressions can be variables present in the code
themselves, as well as calculations separate to the program lines of
code
● This can provide automated desk checking, as watch windows are
automatically updated
● An example of a watch window can be seen below:
● levels of testing
○ Module
■ Tests each module and subroutine functions correctly
■ Each module should be treated like a stand-alone program that doesn’t
require any other parts of the program to function
■ The module is tested with a set of appropriate test data in order to reveal
any faults in processing
○ Program
■ Test that the overall program (including incorporated modules and
subroutines) functions correctly
■ The process of combining the modules in the program is called integration
■ Testing that occurs as part of this process is called integration testing
○ System
■ test that the overall system (including all programs in the suite) functions
correctly, including the interfaces between programs
■ Focuses on four different types of testing:
● Performance testing
○ Used to measure the quality of the software’s performance by
increasing the load on the software until it fails
● Recovery testing
○ Used to check the system’s ability to recover from a fault, and
involves a series of tests that force the system to fail
○ Then measures the system’s ability to recover on its own, or
the time that it takes for humans to recover it
● Security testing
○ Involves trying to breach the security of the system
● Stress testing
○ Involves creating situations that may cause the system to fail,
such as rapid reading/writing to the disk and maximum
usage of memory
○ This would physically “stress” the system
○ These tests will help the developer determine whether the
system will cope or fail in different situations
○ Acceptance testing
■ Carried out by users of custom-built software to determine whether the
requirements have been met, and whether the software can successfully
operate within the system
■ Real data is used during the stage of testing, to ensure the program
completes the processes and procedures it was designed for
■ At this stage, the developer can also see how the user interacts with the
software and detect any problems that might have been missed in early
testing
■ Acceptance testing is also an opportunity to train users in how to operate the
system
● Approaches to the assembly of code
○ Top down approach:
■ A program driver module is tested first with stubs, representing lower
modules
■ When the driver module works properly, modules are then gradually added
one-by-one
■ When an added module has been tested and corrections made and further
tested, then the next module is added so on until the program is complete
■ The advantage of using this method is that errors that are detected will be
from the most recently added module so they will be easier to find and
correct
■ This approach can also be used to build large modules from a number of
smaller sub-modules
○ Bottom up approach:
■ The lower-level modules are tested first, then added together one-by-one
while testing, modifying and then further testing the larger module until it
functions properly without errors
■ The module is built up from smaller modules to a complete functioning
program
■ The driver module is the last one to be added, with a in-place driver being
used beforehand
● the use of live test data to ensure that the testing environment accurately reflects the
expected environment in which the new system will operate
○ large file sizes
■ The use of large files will highlight problems associated with data access
■ Often systems that perform at acceptable speeds with small data files
become unacceptably slow when large files are accessed
■ Particularly the case when data is accessed using networks
○ mix of transaction types
■ Testing needs to include random mixes of translation types
■ If data is altered by another transaction, then problems can occur
■ Software must include mechanisms to deal with such eventualities
○ response times
■ The response time of an application is the time the system takes to respond
to data input
■ Live data will subject the system to real processing requests and therefore
will provide a simulation of a real response time
■ Any processes that are likely to take more than one second should provide
feedback to the user e.g. progress bar
○ volume of data (load testing)
■ Large amounts of data should be entered into the new system to test the
application under extreme load conditions
■ Multi-user products should be tested with a large number of users entering
and processing data simultaneously
■ CASE tools are available that enable the automatic completion of data entry
forms to simulate thousands of users entering data to load test during alpha
testing
○ effect of the new system on the existing systems in the environment into which it
will be installed
■ It is also important to test how well the new system will interact with the
existing system in the environment into which it will be installed, and to
observe any undesirable effects.
○ Interfaces between modules and programs
■ Provides a communication link between system components
■ Interface is usually provided with parameters that are used to pass data to
and from modules
■ Require testing to make sure the connections between modules work
efficiently
○ Comparison with program test data
■ Comparison can highlight any errors or problems
■ The output from live data testing is compared with the output of developer
testing to determine effectiveness
○ Benchmarking
■ Process of evaluating a product using a series of tests; these tests provide
numerical results that are compared with recognised standards
■ Benchmark: A point of reference from which quality or excellence is
measured
■ These results allow users of software products to make informed purchasing
decisions
■ Benchmarking aims to reduce the number of variables and to report results
objectively
■ Compare results to competitors to maintain and improve market penetration
Reporting on the testing process
● Test description including the test requirements
○ States scope of testing
○ States purpose and nature of system
○ Procedure necessary to prepare hardware and software for testing
○ A description of each test including prerequisite conditions, test inputs, expected
test results, evaluation criteria, assumptions and constraints
○ Connection of relationship of the tests to the requirements
● Test data including test data and expected results
○ Scope of testing
○ Overview of system
○ Description of test environment
○ List of modules ot be tested, the tests to be performed and the scheduling of testing
○ Connection or relationship of the tests to the requiremtns
● Test report including results and recommendations
○ Scope of testing
○ Overview of testing outlining deficiencies and impacts on the other parts of the
system
○ Steps that may be taken to overcome deficiencies and impacts
○ Assesses the impact of testing environment
○ Test result details
● CASE tools
○ Test data generator
○ Word processor
○ File comparator
○ WinRunner
○ LoadRunner
○ DataTech
○ UsableNet
Communication of testing
● The nature of the project will determine the audience for the test results
● Large software development companies usually have separately development and testing
personnel, and testers must communicate their findings back to the development team
● Communication with the client
○ Language must be non-technical
○ Address any requirements and design specifications that have not been adequately
fulfilled
○ Rank problems in terms of severity
○ Upfront and honest about the capabilities of the product
○ To assist in the communication, it is common to give a demonstration of the system
to the users
● Communication with the developers
○ Testing departments need to communicate their results back to the development
team
○ Highlight problems in order of severity
○ Recommendations must be backed up with technical justifications
○ Actual test data will help developers correcting or modifying products
Evaluating the software solution
● verifying the requirements have been met appropriately
● quality assurance
○ Functional quality: How well it complies with or conforms to a given design, based
on requirements
○ Structural quality: How it meets non-functional requirements that support the
delivery of the functional requirements such as robustness or maintainability
○ Terms:
○ Clarity - precise and unambiguous instructions
○ Correctness - consistent output from the same input
○ Documentation - accurate without spelling, grammar and process errors
○ Economy - economical use of software and hardware resources
○ Efficiency - ease of completing tasks
○ Flexibility - ability to cope with situations encountered within the operation
of the program
○ Generality - software communicating with existing systems
○ Maintainability - correction of problems and errors
○ Modifiability - ability to change the software
○ Modularity - software parts are easily able to be replaced
○ Portability - ability to be executed within different software and hardware
environments
○ Reliability - a measure of failure rate
○ Resilience - ability to recover from abnormal situations and errors
○ Reusability - modules may be reused within other similar software projects
○ Understandability - how well the design of the software is understood
○ Usability - aspects important to the user, how easy the program is to learn
○ Validity - how the software meets the specifications of the user
Post implementation review
● facilitation of open discussion and evaluation with the client
○ Open discussion with client if the requirements have been met to a standard
○ For a large development, independent review may be performed to remove any
unintended bias
○ Acceptance testing may also occur once again, as a final test of the system
● client sign off process
○ The client will sign off on the project when acceptance testing has been carried out,
and the client is happy with the outcome
Integer Representation
Inquiry Questions
1. Why do we need integer representation in computers?
a. Not every decimal number can be represented using the basic binary system. For
example, values with decimal points, or values which are negative cannot be
represented using only 1’s and 0’s (which is the only thing which computers can
understand).
b. To overcome this, computers use integer representation methods that make use of
conventions to represent these numbers, while still using bytes/nibbles of binary to
do so.
● Sign and Modulus
○ The sign and modulus method is the easiest way to represent negative numbers. An
extra bit is added to the front of the number, with its value indicating whether the
number is positive or negative.
○ 0XXXXXXX means that the number is negative
○ 1XXXXXXX means that the number is positive
○ Example: 00000001 = 1, while 10000001 = -1
○ Using the sign and modulus method, the sign of the number is not an integral part of
the number.
■ This means that calculations done using the sign bit must be considered
separately to the actual number (i.e. doing positive + negative first to see that
the operation is a negative)
○ Pros: Easy for humans to read
○ Cons: Hard for computers, two zeroes (+ and -)
● 1’s Complement
○ As well as 2’s complement, 1’s complement is an integer
representation method where the sign of the number is
innately part of the representation.
○ Using a circular number system, negative integers and
integers larger than 1000 essentially go to the start/end of
the number line between 0-1000, meaning allowing them to
be held with only a byte at max.
○ Example: -2 is represented as 1000 - 2 = 998, 1001 = 1001 -
1000 = 1
○ To make a number negative through the 2’s complement
system, all you do is ‘flip’ each of the digits in the value, as
this makes it go to the negative part of the circular system.
■ E.g. 1 in decimal is 0001, and -1 is 1110 using this
method
○ Called one’s complement, as the swapping of digits is the
same as subtracting it from a string of ones (1110 =
1111-0001)
○ Pros: Easy to read
○ Cons: Less efficient for computers
● 2’s Complement
○ 2’s complement is a
slightly different method,
but achieves the same
result. It is used as it is
more effective than 1’s
complement, which
requires flipping of each
bit.
○ Instead of flipping each bit, the first 1 bit from the right and everything to the right
of it is kept the same, and everything to the left of that bit is flipped.
○ Example: Converting 1 to -1
○ Pros: Only one zero, computers can do maths with it, still easy to see if negative or
positive
○ Cons: Hard to read for humans
Binary Arithmetic
Inquiry Questions
1. Why do we need binary arithmetic?
a. When considering logic, operations are required to simplify logical statements,
making it easier for computers to perform operations. For example, an OR statement
is considered as an addition of two statements, which are written in binary at the
base level. Thus, binary arithmetic is required to simplify this statement for the
computer.
● Addition
○ Addition of binary numbers is done using simple rules, displayed below:
i. 0+0=0
ii. 0+1=1
iii. 1+ 1 = 0 carry 1
iv. 1 + 1 + 1 = 1 carry 1
○ These basic rules will allow you to do any addition
problem required.
○ If it makes it easier, can also split the addition of three
values into two additions of two values.
● Subtraction using 2’s complement representation
○ If you think about it, subtraction is simply the addition of a negative number to
another number.
○ Hence, subtraction can be made easier (instead of reversing the rules above), by
adding the 2’s complement of a number instead of subtracting the original number.
○ E.g. 1111 - 0110 could be written as 1111 + 1010, which is much easier to
understand and perform.
● Multiplication (shift and add)
○ Multiplication is similar to the way we
have learnt multiplication, except for the
fact we are not multiplying.
○ While we are shifting one place every
number we move to the left when
multiplying, we simply just add that
number to the units place, tens place, etc.
until you get to the end, then shifting
values.
○ Once all the values have been added
accordingly, you add to get your end
result.
● Division (shift and subtract)
○ The reverse of multiplication, division, is best done by long
dividing. The same thing is done in multiplication, by shifting
values, except you are subtracting in this case.
Electronic circuits to perform standard software operations
Logic gates
Inquiry Questions
1. Why are logic gates used?
a. When representing data in a computer, only binary can be used at a machine
language level, consisting of 0’s and 1’s. Another way to represent this 0 or 1 status
in computers can be through true or false, as there are only two outcomes. The use
of components that can sort through true or false statements individually, to come to
one conclusion, simplifies arithmetic operations for the computer, which are the
foundation of its entirety. These components are better idealised as logic gates,
which ‘permit’ through only certain values of 0’s and 1’s, and can be placed together
to essentially have a system that performs whatever the user requires through
sorting of boolean data.
● Definition and usage
○ Logic gates are the building blocks for integrated circuits
○ In essence, computers are a collection of logic gates
○ There are six basic logic gates, which can be combined to perform more specific
tasks:
■ AND
● Represents the and case. This means that input 1 and input 2 must
be true/on/1 for the gate to output a 1.
●
■ OR
● Represents the or case. This means that either input 1 or input 2
must be true/on/1 for the gate to output a 1.
●
■ NOT
● Represents the not case. This means that the gate will input not
what it has been input.
● Important to note that this is a one input gate.
●
■ NAND
● Represents the not and case. This means that the gate will output
not what it receives considering the state of input 1 and input 2.
●
■ NOR
● Represents the not or case. This means that the gate will output not
what it receives considering the state of input 1 or input 2.
●
■ XOR
● Represents the exclusive or case. This means that the gate will
output true/on/1 if input 1 or input 2 is true/on/1 exclusively.
Truth tables
Inquiry Questions
1. What is the purpose of truth tables?
a. Truth tables are used as another visual representation of logic in computer circuits,
working well with logic gates. They are also used to simplify the logic of these
circuits, even helping to simplify logic gates.
● Truth tables are used to summarise all the possible inputs and resulting outputs of a
particular circuit.
● They can be used to simplify circuits easier, as some gate’s results may be used for a later
gate, with their noting down of making it easier to calculate later on.
● Example of a truth table:
○ This truth table represents an AND gate (refer to above),
but its concepts can be used for any gate, and any
combination of gates. As we can see, there is an input A
and an input B. These can be expanded into inputs C-Z and
onward, but most logic gates only require two inputs. The
output is the consideration of these two inputs, seeing if
input a AND input b is on, which is only true for the last set
of inputs. Thus, the only 1 output is that of the last set of data, denoted by a 1, while
a true is denoted by 0. (this also applies for the inputs. Inputs can come from other
outputs (i.e. Input A comes from another AND gate, and Input B comes from an or
gate), demonstrating the importance of logic gates in performing more specific and
advanced tasks.
Boolean Algebra
Inquiry Questions
1. What is the purpose of boolean algebra?
● Boolean algebra is a mathematical system that is used to describe logical prepositions
where the outcome is either true or false (representing 1 or 0)
● This system allows for the simplification of circuits to be easily achieved, allowing for the
design of very efficient circuits, containing millions of logic gates.
● Variables
○ Unlike how there are an infinite amount of values for variables in regular algebra,
Boolean algebra has only two values: being that of 0 (false) and 1 (true).
● Operations
○ There are three basic operations in Boolean algebra:
○ NOT: NOT A is represented by Ā, meaning the NOT case of a variable.
■ NOT 1 = 0, NOT 0 = 1
○ AND: A AND B is represented by A⋅B or just AB, meaning the AND case between two
variables.
■ TRUE⋅TRUE = TRUE, FALSE⋅TRUE = 0
○ OR: A OR B is represented by A+B, meaning the OR case between two variables.
■ TRUE+FALSE = TRUE,
FALSE+TRUE = TRUE,
TRUE+TRUE=TRUE
○ There is also one special operation:
○ XOR: XOR is represented by A⊕B,
meaning the EXCLUSIVE OR case
between two variables.
■ TRUE⊕FALSE = TRUE,
TRUE⊕TRUE = TRUE
■ Actually represents (A +
B)NOT(AB)
○ One more important thing to note is that Boolean Algebra can be easily used in
conjunction to truth tables and logic gates. For example A + B is the same thing as an
OR gate, so the two can be easily converted and represented in a truth table.
1 0 1
0 1 1
0 0 0
1 1 1
■ With like seven steps in between, the whole thing could be reduced into one
OR gate.
■ While example is extremely generic, you could split the entire truth table
into multiple gates that are easier to understand than the original
circuit/circuit you are currently designing
○ 4. Resign your circuit in accordance with the most efficient gate system that you
have found from the truth table.
● Boolean Algebra Method
○ 1. Write out each gate in Boolean algebra form (such as an OR gate being A + B) in
succession, until you have the full equation.
○ 2. Using the laws above, simplify the expression as much as possible. (an example of
this is above)
■ Note: It is very rare that you can end up with something as simple as just AB
or A + B, there’ll most likely be some level of complexity to the end result.
○ 3. Resign your circuit in accordance with the most efficient gate system that you
have found using Boolean algebra.
● Note: You can use these methods in accordance with one another, there’s really
nothing stopping you. In fact, it’d be good to double check using both methods (if
there’s time)
Speciality Circuits
Inquiry Questions
1. Why are specialty circuits important?
a. There are a number of circuits that are in such common usage they are available
packaged, and are an integral part of modern CPUs, which is why they must be
understood to be commonly implemented.
● Binary Adders
○ Virtually almost every software product requires the
addition of binary numbers somewhere, which is why
adders are a standard circuit.
○ Adders can be first considered through the form of a truth table, which needs A, B,
carry and sum columns, as these are the variables used when performing binary
addition.
■ By considering the truth table for 2 bit addition, we can extend it to 8 bits.
○ Half Adders:
■ The carry column in the truth table is identical to an AND
gate for A and B, and the sum column is identical to a XOR
gate for A and B. Thus, a binary adder would consist of
these two gates, which both take A and B as their inputs.
■ This basic ‘half’ adder is useful if we only wish to add 2
bits, but it does not incorporate any carry from previous
additions, thus being not useful in 8 bit addition. It does
the ‘half’ the job, which is why it is called a ‘half adder’.
○ Full Adders
■ To design a full adder, we need to
consider the carry in, a value which
would come from a previous adder.
■ The use of a truth table is once
again very helpful in doing this, as
shown to the right.
■ Examining this truth table shows
that the entire gate system can be
modelled using two half
conjunctions with an OR gate for
the carry out.
○ 8 bit Adder
■ By combining adders, the end result is a chain of 8 adders that add bit by bit,
which is known as an 8 bit adder.
● Note: There is a half adder at the start as there is no carry in, but a
full adder can also be used.
● Flip-flops (memory stores)
○ Known as bistable circuits (which mean they can maintain two different states), flip
flops are used to store binary digits.
○ Serve as the basis of most temporary memory within the computer, including
registers within the CPU and some types of RAM chips.
○ Have various designs with differing advantages and disadvantages, but all flip flops
have three basic components included within their design, being:
■ Latch components
● A latch is a circuit that is used to store a binary digit, in
the same way a latch locks a gate.
● Used in flip-flops to store the data
● Simple latches are constructed using two NOT gates or
‘inverters’, to constantly hold data.
● In this gate, if Q was 1, then NOT(B) would be zero, which is feeded
back into NOT(A) to maintain the value of 1, holding this value.
● The issue with this NOT based latch is if inputs
are altered, the circuit is not stable enough to
have predictable results.
● To correct this problem, AND and OR logic
gates are used in conjunction with the NOT
gates to ensure that the data is reset and set
correctly, which are what takes names for the
inputs instead of Q and NOT(Q).
● These gates are referred to as RS NOR latches
and RS NAND latches, which have the same
resultant truth table as each other, with an
input into either the reset or set altering the
value held, indefinitely holding it.
● The issue with these gates is that values cannot
be changed periodically; in fact, there is no
control as to when a latch is allowed to change
state.
○ This control is required in order to
synchronise multiple latches, which are
required for storage of values that are
larger than a single bit.
● In order to solve this problem, a clock
component is required.
■ Clock components
● In order to allow the synchronisation of
multiple latches, a clock, which periodically
changes from a 0 state to a 1 state, can be used
in conjunction with AND gates for set and
reset to ensure that latches can only be
changed periodically. A clocked
RS-NAND/RS-NOR latch is the proper term for
these circuits, which means that inputs can
only change if the clock is also at a 1 state.
● As we can see from the circuit diagram to the
right, clocks are usually denoted as CLK.
● The only problems that remain is:
○ What happens when S and R are both 1 when the clock is 1?
○ Is it possible for S and R to change multiple times whilst CLK
is 1?
■ Illegal inputs of 11
● Examining the truth table for a clocked latch, it is evident that an
input of 11 at the same time will break the latch, and is thus
considered an illegal input.
■ Edge trigger component
● Each change of state in a clock (0->1 and vice versa) is named as an
edge, due how the flip-flop is triggered by either an up or positive
edge, or a down or negative edge.
● To ensure that the flip-flop only changes state once every tick
(1/on/true), an edge trigger component is added.
● Edged trigger flip-flops consist of two latch circuits, a master and a
slave. The inverter connecting the clocks is what is essential to the
edge trigger function.
● If the clock input is 0, then data inputs at D will have no effect on the
master latch.
● Thus, there will be no change in the input into the slave latch, hence
making the stored value and output unaltered (which is required
when the clock sends a 0)
● When a clock value rises to a 1 (the positive edge), the input into the
master latch becomes active, and then the data in the master latch is
altered as a result.
● As the clock value falls to 0 (the negative edge), the inverted clock
enters a 1 into the slave latch, also storing what was inputted into the
master latch, meaning that both the master and slave hold the D
(data) that was inputted, with this value being output Q.
● Shift registers
○ Shift registers are used to store binary data in circuits.
■ Just like flip-flops, except they store data not digits as flip flops do.
○ Normally designed to store data in multiple of 4 bits, composed of flip-flops.
■ For this syllabus, D flip-flops are used, but many types can be used.
○ Allow for data to be moved into or out of the registrar.
○ Designs are available to shift data left and/or right; which are required to perform
binary multiplication and division.
■ A shift of one bit to the right devices the contents by the content s by two; a
shift of one bit to the left multiplies by two
○ Serial in - serial out shift register
■ Add image
■ Populated (added data to) one bit at a time.
● To load 4 bits, requires 4 clock ticks.
■ As a bit is input from the left, all other bits are shifted to the right, with the
right hand bit being lost out of the register.
■ To load the register:
● Activate the clear control line by sending a 1 through it.
○ This will set all flip flops to 0
● Input data is supplied through the line 1 bit at a time, entering
flip-flop 3 first.
● As another bit of data is added, the data in flip-flop 3 is shifted to the
right, and so on until it reaches flip-flop 0.
○ Another input of data will cause the bit to leave the register.
○ Parallel in - parallel out shift register
■ Add image here
■ This shift register receives and outputs data into and out of all its flip-flops
simultaneously
■ Requires the same amount of input/output data lines as there are flip-flops.
● Normal structure for a storage register that cannot perform any
processing.
■ Once the clock sends a 1, data is stored in all the flip-flops at the same time.
● This means that only 1 tick is required to fill the register with new
data.
■ The outputs from each flip-flop are available at all times.
■ Not necessary to shift data out via other flip-flops, which was the case in the
serial in - serial out design.
■ However this register cannot alter the nature of its data, with there being no
link between the data lines of each flip-flop.
● Makes it a suitable storage register rather than a processing register,
as data can be clocked in and out more easily.
○ Bi-directional shift register
■ Add image here
■ The most complex of all the registers, the bi-directional shift register can
shift data both right and left, allowing for both multiplication and division to
take place.
● Uses the same basic design as the serial-in and serial-out register,
considering how they are both processing registers.
■ This register contains an extra control line, which is used to indicate the
direction of shifting data.
● 1 = Shift data one position to the right, data input placed into the left
hand flip-flop.
● 0 = Shift data one position to the left, data input placed into the right
hand flip-flop.
■ Evidently, the logic of the flip-flop is quite involved, requiring intensive
examination.
■ If you genuinely care, here is a full examination of a left hand shift:
● The logic of this flip-flop is quite involved and requires intensive
examination to understand completely. Let us examine a left hand
shift using this circuit. Firstly, the left/right control is sent a 0,
indicating a left shift. This input is reversed by the inverter on the
second left/right control line. As a result, each set of 3 NAND gates,
controlling the inputs into each flip-flop, receives a 1 at the top NAND
gate and a 0 at their bottom NAND gate. Consider the bottom NAND
gate preceding each flip-flop, as it has received a 0 then its output
must be a 1 regardless of the value in its other input, effectively these
gates have been disabled. The upper NAND gates, which received a 1
from the left/right control, are enabled. A 1 from their other input
will result in a 0 output and a 0 results in a 1 output. Following the
source of the other input to the upper NAND shows it comes from the
output of the flip-flop to the right, which is correct for a left hand
shift. The third NAND gate preceding each flip-flop input effectively
reverses the input back to its correct state for storage in the
flip-flops. Of course, all this can only occur if the clock has sent a 1 to
each flip-flop. Notice that the right hand flip-flop will gain its new
data from the data input line.