HSC NOTES Software Design and Development Alan Yeung
Alan Yeung | SDD HSC
Social and Ethical Issues Software developers’ rights and responsibilities
authorship
reliability
quality
response to problems code of conduct
Software piracy and copyright Concepts:
intellectual property
plagiarism
shareware
public domain
ownership versus licensing
copyright laws
reverse/backwards engineering
decompilation
licence conditions
network use
Page 2 of 18
Alan Yeung | SDD HSC
Defining and Understanding the Problem Defining the problem Identifying the problem.
Needs
A need is an instance in which some necessity or want exists. Some form of solution must be developed to meet this need. The needs of the client and the needs of the developer may vary. For example: Client
Job done professionally o Done within a timeframe o Charged an acceptable fee o Meet their purpose Developer o Make a profit o Fulfil client‟s needs o Contact clients quickly o
There almost always requires for there to be a need before the product is developed.
Objectives
Objectives are what you are aiming to achieve. The objectives of the system give direction to the project. Throughout the design and development of a system the objectives should continually be examined to ensure their fulfilment. Objectives are developed from the needs, and are more clear-cut; they provide a definite set of working conditions that need to be fulfilled for the project to be successful.
Boundaries
Boundaries define the limits of a system; anything outside of the system is part of t he environment . An interface is required for communication between the system and its environment.
Feasibility
Is it worth solving?
Constraints
Budgetary
Operational Page 3 of 18
Alan Yeung | SDD HSC
Technical
Scheduling
Possible alternatives
Social and ethical considerations
Design specifications The developer‟s perspective Data types Algorithms Variables Software design approach Modelling the system Documentation
The developer‟s perspective mainly concerns the development, programming and internal operation of the software product.
The user‟s perspective Screen design and UI design Ergonomic issues Social and ethical issues
The user‟s perspective is much more superficial; it concerns the external operation of the program.
Modelling
IPO Charts
Storyboards
Data flow diagrams
System flowcharts
Screen Designs
A limited prototype
Flowcharts Flowcharts describe the logic and the flow of data in a system. Interactions between inputs, processes, outputs and storage are included.
Page 4 of 18
Alan Yeung | SDD HSC
Storyboard A storyboard is used to describe how the screens interact with each other in a project. It is a collection of screen designs with links in between. There are linear, hierarchical, and hybrid storyboard layouts.
Data dictionary A data dictionary documents the variables and identifiers within a coded project. This includes their: Data type Scope of usage Length Purpose or description
IPO charts Input-Process-Output charts are used to describe the lower level processes that occur under context/data flow diagrams.
Communication issues
The need to empower the user
The need to acknowledge the user‟s perspective
Enabling and accepting feedback
Communication methods include: Meetings Questionnaires Memos Interviews Phone calls and emails (correspondence)
Page 5 of 18
Alan Yeung | SDD HSC
Planning and Designing Top-down design Top down design is a methodology of breaking down a large, complicated algorithm into more manageable, self-contained modules. Benefits include:
Easier to apply changes
No need to recompile whole program
Multiple programmers can work on separate modules simultaneously
Assists documentation, in that each module is responsible for one logical task only.
Function and procedures
Functions send values as parameters, but there is a returned value from the function call. Procedures pass values between calling and called subroutines. They do not return any values. o E.g. in C, functions mimic procedures by having „void‟ parameters.
Standard algorithms for searching and sorting These are “Standard algorithms”
Min and max values
Processing strings
File processing / sentinel value
Linear search
Bubble sort
Insertion sort
Selection sort
Custom-designed logic used in software solutions
Identification of inputs, processes and outputs
Representation as an algorithm
Definition of required data structures
Use of data structures including multi-dimensional arrays
Use of random numbers
Thorough testing
Data structures include:
Page 6 of 18
Alan Yeung | SDD HSC Multi-dimensional arrays: These are essentially nested arrays. A 2D array can be
visualised as a table; a 3D array can be visualised as a prism. Arrays of records: Records are contained within each array index, the same as in a database Methods of storing these: Sequential files and Random access files
Standard modules/library routines
Identification of appropriate modules
Consideration of local and global variables
Appropriate use of parameters
Appropriate testing through drivers
Thorough documentation
Customisation of existing software solutions
Identification of relevant products
Customisation
Cost effectiveness
Documentation of overall software solution
Algorithm descriptions
System flowcharts
Structure diagrams / charts
Data flow diagrams
Data dictionary
Selection of language Event driven software
Driven by the user
Program logic
Sequential approach
Defined by the programmer
Relevant language features Hardware ramifications Graphical user interface Page 7 of 18
Alan Yeung | SDD HSC
Implementing Interface “Identification of data required” – GUI elements commonly used are:
Menus
Check boxes
Command buttons
Radio buttons
Tool bars
Scroll bars
Text boxes
Grids
List boxes
Labels
Combination boxes
Pictures and image boxes
Current trends in GUIs: Internet solutions that will be executed on a large and unknown select on systems – these will require multi-platform compatible interfaces. Software for dedicated devices – mobile phones, video recorders, etc. will require enhanced and customised GUIs Better computer technologies enable better resolution and depth of displays. GUIs are able to increase in detail.
Help
Context help: The screen elements provide help text such as tooltips in web browsers.
Procedural help: Manuals can provide an in-depth guide as a procedure to learning.
Conceptual help: Aims to explain what and why, rather than how; the user is left to their own devices to administer a solution, given a better understanding of the task at hand. Tours, tutorials and wizards: These are an easy, concise, and comprehensive help solution which gives a user practical, guided steps towards completing a task.
Consistency in approach The following should be kept consistent throughout a GUI: Names of commands such as Cut, Copy and Paste, which are universal User of icons – such as a floppy disk for „Save‟ Placement of screen elements, such as the positioning of command buttons. The provision of feedback over longer tasks Forgiveness – providing warnings and alert messages to users, and allowing users to
undo actions. Page 8 of 18
Alan Yeung | SDD HSC
Language syntax Metalanguage descriptions of programming languages
Page 9 of 18
Alan Yeung | SDD HSC
Page 10 of 18
Alan Yeung | SDD HSC
Page 11 of 18
Alan Yeung | SDD HSC
Software developer s view of hardware ’
Representation of data within computer Character Representation
ASCII
Hexadecimal
Characters must be represented using binary code if they are to be stored and processed by computers. Characters are split into printable and non-printable. ASCII, the American Standard Code for Information Interchange, is a standard character set containing 128 characters.
Integer representation
Sign and modulus
One‟s complement
Two‟s complement
Sign and modulus: The 8 bits are divided into 1 bit for the sign and 7 bits for the modulus (signed integer). Or, there is no sign and 8 bits represent the modulus (unsigned integer). One’s complement: Creates a finite positive integer system, which can be represented as a „number circle‟. In an n-bit one’s complement numeral system, every integer in the range of N-1 N-1 −2 -1 to +2 -1 can be represented. E.g. An 8-bit system can represent -127 to + 127.
Negative numbers can be expressed as their positive complement in t he system. Since both positive and negative numbers are represented as positive numbers, the ALU is able to perform addition operations on the numbers. In an 8-bit system,
The complement is simply obtained by swapping the 1‟s and 0‟s.
Two’s complement: In an n- bit two‟s complement numeral system, every integer in the N-1 N-1 range of −2 to +2 -1 can be represented.
The difference between one‟s and two‟s complement is that one‟s has two values for representing zero whereas two‟s only has one value. Therefore two‟s is able to accommodate one extra integer in its system, and the range of an 8-bit system is -128 to +127. In an 8-bit system,
The complement (inverted sign) of a number can be obtained by inverting the digits in the binary number, then adding 1.
Page 12 of 18
Alan Yeung | SDD HSC o
E.g. 710 = 000111112 By inverting the digits we get 11111000 2 = -810 Adding 1 gives 11111001 2 = -710 which is the correct complement.
Alternatively, we can „scan‟ the binary number from the RHS, and after ignoring the first „1‟ digit, we invert every single digit after that. o E.g. 1210 = 00001100 2 After ignoring the 1 third from right, we swap the rest of the digits Giving us 11110100 2 = -1210
Two‟s complement is the most widely used method of integer representation.
Fraction and real number representation
Fixed point
Floating point
Fixed point: Bits are allocated to represent both the integer and decimal parts of the number. It is a „fixed point‟ number because the fraction is only accurate to a certain amount of decimal places that are specified.
E.g. A fixed-bit number consisting of 16 bits may have 8 bits allocated to representing the whole number and 8 bits to the fraction. Hence the smallest fraction able to be represented in this system is 0.00000001 2.
Floating point (FLOP): The byte is split into a sign, and exponent, and a mantissa. This makes it possible to represent fractions up to a very large negative power, much like a number in scientific form is expressed as „+ 2.345678 × 106‟.
There is an IEEE standard (IEEE 754) for two formats of floating point representation: single precision (32 bits) and double precision (64 bits). The FPU in the processor is a dedicated unit that processes floating point numbers.
Single precision: 1 bit sign, 8 bit exponent, 23 bit mantissa
Double precision: 1 bit sign, 11 bit exponent, 52 bit mantissa
Special cases o Infinity: o Negative Infinity: o Zero: o Negative Zero: o NaN:
0 11111111 00000000000000000000000 1 11111111 00000000000000000000000 0 00000000 00000000000000000000000 1 00000000 00000000000000000000000 x 11111111 xxxxxxxxxxxxxxxxxxxxxxx
Page 13 of 18
Alan Yeung | SDD HSC
Binary Arithmetic Addition 01011111 + 00001100 01101011
01110101 + 00110110 10101011 Yes, there is an error if indeed this is a two's complement addition > overflow.
11010000 + 01100011 00110011
Subtraction using two‟s complement representation
It is, as suggested, the addition of two‟s complement numbers, to obtain a result. In this, the value to be subtracted is converted into its t wo‟s complement, then this negative number is added to the other value, resulting in a subtraction operation.
Multiplication, shift and add; division, shift and subtract
Multiplication consists of many additions, with each subsequent addition shifter left, as with multiplication by hand. Same with division.
Page 14 of 18
Alan Yeung | SDD HSC
Electronic circuits to perform standard software operations Logic Gates
AND
OR
NOT
NAND
NOR
XOR
Symbology
Page 15 of 18
Alan Yeung | SDD HSC Circuit design steps
Identify inputs and outputs
Identify required components
Check solution with a truth table
Evaluate the circuit design
Specialty Circuits
Half Adders
Full Adders
Flip Flops
Half Adder: Is good for adding two bits together, but impractical for any more than two bits, since it does not take into account carried values. Full adder: This circuit adds two bits, takes into account any carried values, and produces the added result and a carried result. Flip Flop: A flip flop is a memory store. The circuit is „bistable‟, able to remember two different states. There are three flip flop components: Latch component – This is a circuit which is capable of storing a binary digit. Clocking component – Used to synchronise the changing of latches, so that ALL the
latches are changed at the same time. Edge trigger component – Ensures that there is only one change per clock tick; the change of clock state is called an edge. A common type of flip flop, RS, receives a Reset and Set signal. Here is a truth table for an RS NOR and RS NAND latch: -1
S
R
Q
Q
0
0
Retains last Q
Retains -1 last Q
0
1
0
1
1
0
1
0
1
1
Illegal
Illegal
Clock component
Latch component Page 16 of 18
Alan Yeung | SDD HSC
Programming of hardware devices Input Data Stream from sensor and other devices
Header information
Data characters
Trailer information
Control characters Hardware specifications
Documentation
Format: The format of a data stream consists of data wrapped around a header and trailer file. The header and trailer information ensure that the data is transmitted correctly.
Header information: Often, this is just a single start bit to inform the receiving device of an incoming data packet Data characters: Data to be used by the receiving device. o Will often contain control characters which active certain sequences or internal functions. Trailer information: Includes error checking and stop bits.
Documentation: Because hardware devices are manufacture from a wide range of sources, manufacturers include documentation and specifications with their products. Example – PS2 Mouse
A PS2 mechanical (ball) mouse contains simple switches which determine movement in the X and Y directions. Using a PS2 port, the mouse sends data to the computer as synchronous transmissions. [Note we‟re talking about the two button ball mouses here] When a mouse sends information, it sends three consecutive data packets. These packets contain information about the state of each button and the movement that has occurred in both X and Y directions since the last transmission. The first packet contains data about the direction, button states and overflow. The next two packets respectively are X and Y bit displacement values. Since the mouse is a synchronously connected device, there is no need for header or trailer information.
Processing of the data stream
The need to recognise and strip control characters
Counting the data characters
Extracting the data
The software used to perform the processing of the data stream (a driver) needs to be able to understand the precise format of the data stream.
Page 17 of 18
Alan Yeung | SDD HSC
Generating Output to an Appropriate Output Device
Required header information
Required control characters
Data
Required trailer information
Control Systems
Responding to sensor information
Specifying motor operations
Open control system: Is unable to react with its environment, i.e. there is no feedback loop. Example: Hotel door locks are unable to provide further feedback. Closed control system: Sensors provide feedback so that the controller causes actuators to react to changes. Example: ABS braking systems detect the changes caused by actuators, in feedback loops.
Printer operation
Control characters for features, including page throw, font change, line spacing
Why doesn‟t the textbook cover this…
Page 18 of 18