Advanced Software Development I and II
Advanced Software Development I and II
DEVELOPMENT I & II
CSC3003S
Software Systems Engineering
2|Page
o SW must be acceptable to the type of users for which it is designed
o This means that it must be understandable, usable, and compatible with other
systems that they use
o E.g. will design sw for children differently than for adults
• Software specification, where customers and engineers define the software that is to be
produced and the constraints on its operation
• Software development, where the software is designed and programmed
• Software validation, where the software is checked to ensure that it is what the customer
requires
• Software evolution, where the software is modified to reflect changing customer and market
requirements
• Heterogeneity:
o Increasingly, systems are required to operate as distributed systems across networks
that include different types of computer and mobile devices.
▪ Also have to operate across a range of OSes
o As well as running on general-purpose computers, software may also have to
execute on mobile phones.
3|Page
o You often have to integrate new software with older legacy systems written in
different programming languages.
o The challenge here is to develop techniques for building dependable software that is
flexible enough to cope with this heterogeneity
• Business and social change:
o Business and society are changing incredibly quickly as emerging economies develop
and new technologies become available
o They need to be able to change their existing software and to rapidly develop new
software
o Many traditional software engineering techniques are time-consuming and delivery
of new systems often takes longer than planned
o They need to evolve so that the time required for software to deliver value to its
customers is reduced
• Security and Trust:
o As software is intertwined with all aspects of our lives, it is essential that we can
trust that software
o This is especially true for remote software systems accessed through a web page or
web service interface
o We have to make sure that malicious users cannot attack our software and that
information security is maintained
Process
• Use processes to manage heterogeneity, business and social change, as well as security and
trust
• Use different software engineering techniques for each type of system because the software
has quite different characteristics
• E.g. use different techniques for embedded systems vs entertainment systems
• But, when developing a sw system, one needs to adhere to a specific set of principles
• The following is true for developing any kind of software system:
o Managed and understood development process
o Focus on dependability and performance
o Understand and manage software requirements
o Effective use/ reuse of resources
• This is achieved by Planning, Communication and People, as well as Methods, Tools and
Ethics
4|Page
Methods
Tools
• Case tools – tools that will take you from diagramming to maintenance tools
5|Page
Ethics
Summary
• Take principles of engineering and apply them to sw development to ensure that good
processes are followed in order to deploy quality sw that is maintainable, useable,
dependable, acceptable and ensure clients happiness
6|Page
Project Management
People
• Ensuring software is delivered on time and on schedule and in accordance with the
requirements of the organisations developing and procuring the software
• Needed because software development is always subject to the budget and schedule
constraints that are set by the organisation developing the software
• Systems development is a complex activity that requires careful project management
o Why? Lots of dependencies, people and organising
o Need integration – have different people working on different things
• Inter-dependencies between the artefacts of software development
o Production has to be planned, monitored and co-ordinated
▪ So, software development is efficient, effective and on time
▪ This applies to development, testing and deployment
• Often involve many developers, some with specialized skills, who will be required at
different times
o E.g. may only need a graphic artist much later on in the project
• Activities must follow a particular sequence
o E.g. can only test when have actually developed the components being tested!
o Test scripts and test harnesses may be prepared earlier in the project
• There is no one technique that fixes the inherent complexity of software design and
development
• Difficulties with building software can be divided (Aristotle) into
o Essence: conceptual structure of the software itself
o Accidents: difficulties from aspects of the process of realizing the conceptual
structure in executable form
▪ E.g. a customer forgets to mention a requirement that seems obvious to
them
• Lots of projects start out seemingly innocent and straightforward, and then in the dark of
the moon they turn into monsters (werewolves)!
o Only if at least 9/10 of troubles are accidents can shrinking them to zero give you an
order of magnitude improvement
▪ And they’re not
o Therefore, any silver bullet (anything offering *10 improvement in productivity)
must address the conceptual issues
▪ May mean dealing with the concepts at a different level
Project Scope
• Ideally set from the beginning of the project
• Functions and features that are to be delivered to end-users
• Data that are input and output
7|Page
o i.e. data that is included in or produced by the system
• Content that is presented to users as a consequence of using the software
• The performance, constraints, interfaces and reliability that bound the system
o Includes non-functional requirements
• How quickly does the project need to be done? Which features MUST be implemented and
which are nice‐to‐haves?
Defining Scope
• Scope usually communicated by client – but essential to document it
so that it is clear between your team and the client what is necessary to the system
• Scope defined by either:
o Narrative description of software scope
▪ After communication with stakeholder
o Set of use-cases
▪ Scenario-based description of the user’s interaction with the software from
the user’s point of view
• Performance considerations
o What are the processing and response time requirements?
• Constraints identify limits placed on the software:
o Device limitations for end users or expectations about the number of users or
transactions the system will take
o External hardware, available memory, or other existing systems
Determining Feasibility
• Given the scope, determine the resources required
o Not just about money, but whether the people with the right skills exist, whether
the hardware to do it is available to the team and whether there are existing
resources you might be able to leverage such as open-source software or even
licensed libraries or tools
• Need an answer to the question – do we have the resources we need to build this software?
• Resources are:
o People
o HW and SW tools
o Reusable components
Goals
• Take a step back from features and use cases, and look at overall goals
o Or step even further back and clearly evaluate the perspectives of all the key
stakeholders
• Goals are derived from the needs and expectations of stakeholders
• Stakeholder = someone (in)directly impacted by the project
o Project sponsor;
o Customer for the deliverables;
o Users of the project outputs;
o Project manager and project team
8|Page
o i.e. who are you going to incorporate into the process, and enquire with as you
design the system?
• You may find that stakeholders have conflicting goals – and as a result, differing visions of
scope and priorities.
o This frequently needs to be negotiated as well.
o But just as often – the only stakeholder’s opinion that really matters is the one
paying you (or giving you a mark)
• Find true needs that create real benefits
o Prioritize them i.e. from there you can align features and priorities effectively
Smart Goals
• Create measurable goals:
o S specific, significant, stretching
o M measurable, meaningful, motivational
o A agreed upon, attainable, achievable, acceptable, action-oriented
o R realistic, relevant, reasonable, rewarding, results oriented
o T time-boxed, time-based, time-bound, timely, tangible, trackable
▪ i.e. goals need boundaries, need to be able to track when they’re done, not
done and partially done
Deliverables
• Deliverables: list of items that have to be delivered to meet the goals
o Verifiable and specific
o Can be report/equipment acquisition/an executable code module etc
o Has a stakeholder who needs it
• Say when it is to be delivered
• Give quality standards, for example:
o SW runs
o Document is according to specified format
• Deliverable is finished and there’s a clear expectation between all stakeholders as to what
the deliverable will look like and what quality it’s going to be
Schedule
• The effort required (time-wise)
• The people required (and other resources)
• Update deliverables with this & work schedule out
• If the schedule is unrealistic you can justify some of the following:
o Renegotiate deadline – delay
o Additional resources – more expensive
o Reduce scope – fewer deliverables
• Negotiate a set of must-haves and nice-to-haves with client
o Conservative schedule for must-haves set – have to ensure that those get done
o If must-haves can be done, can rework schedule to try and deliver some nice-to-
haves
9|Page
• Don’t set yourself up for failure
Supporting Plans
• Human Resource Plan
o Name key individuals & organisations: describe roles & responsibilities
▪ i.e. what do we need to be able to achieve this set of deliverables?
o Describe no. and type of people needed
▪ Start dates, estimated duration and how to get them
o What’re the key, required responsibilities and how do they align with the people
already available to you?
• Communications and Management Plan
o Who needs to be kept informed about the project?
o How they will receive the information?
▪ Weekly review meeting
▪ Progress reports
▪ Revised schedule
• Risk Management Plan
o ID as many risks as possible
o Be prepared if something bad happens
People
• A team needs people with different skills
• Range of duties even in a small project
o Project management: Strategist, Leader, Politician, Project Facilitator, Administrator
o Systems analysis: Stakeholder needs, Interaction Designer, Cost estimator
o User interface designer, user stories
o Architect: Application overview, performance
10 | P a g e
▪ Middleware —software layer between the operating system and the
applications on a distributed computer network
o Specialists as required: database, games engine, mobile development, …
o Documentation: e.g. an amanuensis “a literary or artistic assistant, in particular one
who takes dictation or copies manuscripts”
11 | P a g e
c. Evaluates overall system and plan and tries to match it to business domain – checks
that system being developed aligns with the real motivations of the client
11. System Tester: Entrusted with very different tasks, like review of documentation and testing
behaviour
12. Test Manager: Responsibility is to ensure the product quality by devising a plan for internal
quality audits and implementation.
a. Cannot have other roles, particularly with those roles related to the design and
construction
13. User-Interface Designer: The scope of this role in a project varies according to the nature of
the artefacts to be developed
Choosing People
• People you know and have worked with before
• Information from candidates about their background and experience (résumé or CV)
o Best evidence to judge suitability
• Information from interviewing candidates
o Mainly judge communication and social skills
o Subjective judgements thus not reliable
o Can also ask to perform specific exercises
• References and recommendations from people who have worked with them
o Effective when you can rely on the people making the recommendation
Metrics
12 | P a g e
Milestones and Deliverables
• Use tools to help with the estimation of how long different parts of the project will take,
what resources are required, etc
• Activity: task that takes time
o Duration
o Due date
o Precursor – activity which precedes others that depend on it
• Milestone: mark the completion of an activity
o May/may not correspond to deliverables
o Recognisable end-product of a task
▪ Hand over system for testing
o Use them as checkpoints to eval what has been achieved and plan next stages of
project
o Requires a formal, measurable output
• Deliverable: a project result that is delivered (to customer)
Milestone vs Deliverable
• Deliverables = measurable, tangible outcomes of the project
o Releases, Documentation, Reports
o Developed in alignment with the goals of the project
• Milestones = checkpoints throughout the life of the project
o ID when one or multiple groups of activities have been completed a notable point
has been reached in the project
Software metrics
• To plan and manage a software development project
o Need to estimate the resources required for each of its constituent activities
▪ Subjective perceptions of the activity
▪ Based upon measurements of size and complexity
• Activity itself
• Artefact that’s produced
o Software metric measures some aspect of software development
▪ Project level – cost/duration
▪ App lvl – size/complexity
• Metrics also need to follow SMART
13 | P a g e
SMART Metrics
14 | P a g e
• E.g. number of classes in an analysis class diagram
▪ Test plans
▪ Program code, etc
• Code churn = measure that tells you the rate at which your code evolves
• Will only have reliable, stable code base when code churn is much lower
15 | P a g e
Software Metrics Worth
• Useful for prediction and resource estimation
o Otherwise, is rather limited – validity of metrics based on idea that accurate
predictions can be made e.g. on the time it might take to complete something
• Validity of predictor metrics is based on 3 assumptions
o You can measure something useful
o That measure actually predicts something worthwhile
o This relationship is real and can be expressed in a model or a formula
• Size metrics can be used to estimate the resource requirement for a project provided that
appropriate historical data is available to derive and validate the relationship
o E.g. # of lines of code – not necessarily an indicator of code quality
o Interpretation of what metrics mean are limited – unless able to contextualise
predictions and validate then
• Generally, software developers don’t think metrics are important …
o Focused on the delivery of the product on time
o Can be used to monitor the performance of the developers
▪ This is a cause of concern to developers
▪ Ethical issue and a management issue
Project Scheduling
• Split the work in a project into separate tasks
o Minimize task dependencies
o Discrete, achievable tasks
o Clear dependencies where they exist
• Estimate the calendar time needed to complete each task
o Split up if much longer than 1 week (never more than 2 months)
o Make tasks concurrent to make optimal use of workforce
• Estimate the effort required
16 | P a g e
o Who will work on the tasks?
o Resources needed to complete each task
o Estimates can vary be person
• Mostly needs project manager’s intuition and experience
Gantt Charts
17 | P a g e
o Task completion
o Simple dependencies
o Milestones and Deliverables
• Can’t handle complex task dependencies
• Always accompany your gantt chart in your report with an outline summary of phases,
milestones and deliverables
Before Project
18 | P a g e
During Project
• More info added - progress for each task indicated by filling the bars, color coding for
individual team members, and a vertical dotted line for the current date
Kanban Boards
• Often plan overall project with Gantt Chart, then track individual phases. Iterations/sprints
in Kanban board
• Visualize at a glance current project activities
o i.e. useful for visualizing individual phases or sprints rather than the project as a
whole, since the backlog can be more of a pile than a clearly linked set of tasks
• Each task is represented as a single card, usually depicted as a user story
• Cards travel from left to right as they are completed:
o (1) Stories/Backlog – the full list of tasks
o (2) To do – tasks planned for current cycle or phase
o (3) In progress – tasks that have been started
o (4) Testing – tasks that have been completed and are ready to undergo testing
19 | P a g e
o (5) Done – tasks that’re completed
Network Analysis
Critical Path
• Have list of tasks, dependencies and estimates – can systemically identify your critical path
and plan around it
• Related to PERT (Program Evaluation Review Technique) charts
• Min overall duration of the project according to the estimates depends on the critical path(s)
o Critical path – the sequence of stages determining the minimum time needed for an
operation, especially when analysed on a computer for a large organization.
• Critical Path analysis is used to help estimate the minimum overall duration of the project
o Crit path is important – any delay in any task on this path delays the whole project
20 | P a g e
• Start with a list of tasks
• Several columns:
o Task number
o Activity name
o Longer description
o Expected amount of time it will take to complete this (in hours)
o Dependencies referencing previous task numbers
• Activities and subactivities listed
• For high lvl activities – no length and dependency listed because these are listed in the
subtasks
Network Analysis
• Project tasks (activities):
o Are often interdependent
o But need to be done in parallel for teamwork to be effective
• Task networks are graphical depictions of task dependence
• Network analysis is a project planning method that:
o Determines the critical path
o Establishes “most likely” time estimates
o Calculates boundaries to stop project slippage
• Use nw analysis to establish likely time estimates given parallel streams of tasks
o Helps understand how much “extra” time we have for tasks to take longer than
expected
o Fuzziness - – due to how difficult it can be to accurately estimate time for tasks
21 | P a g e
o But the analysis can help us plan better for bad estimates
Terminology
• Earliest Start/Finish
o Earliest a task can begin/end if all preceding tasks are completed in the shortest
time
• Latest Start/Finish
o Latest a task can begin/end without delaying the minimum project completion time
• Crit path
o Chain (of tasks) that determines overall project duration
▪ Delay in any of these tasks delays the overall project
o Can be >=1
• Slack (Float): the amount of surplus time or leeway allowed while still maintaining the critical
path
Tasks
• Each task in a network analysis is represented as a box, and the boxes will be linked in a
nw
o Sequence constraints are lines connecting the boxes
• Start with activity names and the estimated time
22 | P a g e
Analysis – Step 1
Analysis – Step 2
23 | P a g e
Analysis – Step 3
• Start with the final box, the highest “earliest finish” number
• Subtract the time estimate to get the latest start
• That latest start gets filled in to all of the preceding tasks as the latest finish
• If there’s more than one preceding task,
you copy the lowest “latest start” into the preceding task’s “latest finish”
• You should end up with at least one task with a latest start of 0.
• Process:
o Carry out a “backward pass”
o Fill in Latest Start, Latest Finish
o LF (current) = min(LS (next))
o LS (current) = LF – ET
Analysis – Step 4
• Calculate total float, which is the difference between the earliest start and latest start
• Process:
o Fill in Total Float
24 | P a g e
▪ Time by which an activity may be delayed without affecting the final
completion date
o TF (current) = LS (current) – ES (current)
Analysis – Step 5
• Free float: the difference between the earliest start of the next tasks, and the latest finish
of the current one
o Basically, the buffer time for that task
• Process:
o Fill in Free Float
▪ Amount of time an activity can expand without affecting the start or finish of
any other activity
o FF (current) = min (ES (next)) – EF (current)
Analysis – Step 6
• Once CPA is drawn up, it is possible to see the crit path itself – it’s a route
through the CPA, which has no spare time (called ‘FLOAT’ or ‘slack’) in any of the activities
25 | P a g e
oIf there is any delay to any of the activities on the critical path, the whole project
will be delayed unless the firm makes other changes to bring the project back on tra
ck
• Crit path – this path is the manager’s primary concern
26 | P a g e
• Splitting each milestone box for network analysis, you can perform the same forwards and
backwards analysis to determine slack time, earliest and latest completion times
• Milestones with no dependencies have an earliest completion time of zero
• Earliest completion time of the next box is calculated by adding the estimated time to
the max previous earliest completion time
• Latest completion time is calculated backwards the same way
Risk
Managing Risks
• Why?
o Projects have a high level of uncertainty
o Better to anticipate problems
• How?
o Identify -> Analyze -> Rank
o Plan for monitoring, mitigation, management
o Revisit continually during project
27 | P a g e
Boehm’s Risk Items
1. Another risk is someone getting sick; someone leaves and a replacement cannot be found
2. Unrealistic schedules and budgets almost guarantees overrunning then
3. Been given the customer spec and requirements docs – but they were incorrect for the
problem that needs to be solved
4. /
5. Gold planting – e.g. taking slides and working too hard on how they look, rather than their
actual content
6. Scope creep – changing requirements constantly
a. Mitigated by anticipating change and creating architectures that support adding new
features and changing direction
7. Pokemon GO case study – library that routinely crashed
a. Have dependencies on outside sw – if things aren’t up to spec, then this may cause
delays
8. /
9. Performance delays – e.g. machine being used to dev is slow
10. /
11. /
12. E.g. Covid
28 | P a g e
Risk Consequences
Risk Likelihood
• Assess the likelihood of the risk
29 | P a g e
Risk Matrix
30 | P a g e
3M’s
• Mitigation
o How can we avoid or reduce the risk?
▪ Avoid - change requirements
▪ Transfer – e.g. buy insurance
o Or assume the risk and accept and control it
• Monitoring:
o What factors can we track that will enable us to determine if the risk is becoming
more or less likely?
• Management:
o What contingency plans do we have if the risk becomes a reality?
Examples of Risk
31 | P a g e
Planning vs Management
• Planning
o Pre- and post-
o Network analysis, resourcing, risks, schedule
• Management
o During
o Controlling resources and timescales
32 | P a g e
Software Engineering Methods
• Most common problem in software systems is not the construction, but the estimation
o Most frequently, it is discovered too late, or possibly even after the fact, that the
targets are wrong
• Software projects fail to meet cost and schedule, because those targets are wrong
o Costing software = difficult
o The scope might not be correct, or time estimates for development wildly
underestimated
• Know little about accurate estimations so targets are unreasonable
o Made by people least able to make them
▪ e.g., marketers, managers and customers
o Communication is hard when the ideas are abstract or conceptual
• More than 45% of features are never used, while another 19% are used rarely
o Almost 2/3 of the features are never or rarely used
o Stop developing these features and double productivity
• NB the 80/20 rule i.e. 80% of the features are used only 20% of the time
o By first focusing on the 20% of the features used 80% of the time, you use resources
more effectively when they are needed – even when you didn’t expect them to be
needed
• Limit to ROI for what that feature adds i.t.o how much money it’s going to give you
• Amount of work needed to implement feature often > return on product (when it’s a feature
that hasn’t been prioritised)
• Profitable project – returns always outpace costs
34 | P a g e
o
For every unit of cost, time added to producing the sw, there is an equivalent
increase in returns on the project
• However, if continually increase scope of the project, every new feature only adds a small
amount to ROI
o Can lead to negative ROI
• The cost curve under most software processes is exponential – as features increase there’s
increased communication and coordination
o E.g., Customer and developer must understand each other perfectly
• New projects are successful because the cost curve is still flat, but as costs start increasing
the curve quickly overcomes the ROI for new features – the return on investment is linear
(or worse) rather than matching increased costs of production
The Crunch
• Crunch is the side effect of other problems and the cause of burnout
35 | P a g e
2. You try to add a git hook only to discover the library you have is incompatible and therefore
won’t work with your web server.
3. You start to update your web server, but realize that the version you need isn’t supported by
the patch level of your operating system, so you start to update your operating system
4. The operating system upgrade has a known issue with the disk array the machine uses for
backups.
5. You download an experimental patch for the disk array that should get it to work with your
operating system: it works but causes a problem with the video driver. …
Stop: what got you started down this road? Try to figure out what shaving a yak has to do with
generating documentation for Subversion logs.
Ultimately
• Have
o Undefined system
o Fixed resources
o Fixed time
o High quality
• Goal – deliver software product to meet the client’s needs, on time and within budget
• Can we develop quality software under these circumstances?
o If so, how?
Approaches
Code And Fix
• Naïve, first approach
• Little (zero) planning, dive straight into implementation
• Reactive
• End with bugs
o If bugs multiply too fast to fix: “death spiral” → cancelled
o To make it you’ll have “crunch time”
Traditional Methods
36 | P a g e
o User can specify the requirements
o Developers can then do the development
o System is finished
o System is launched
Waterfall Method
• In this approach software development is a series of stages, in which the input from a
previous stage flows into the next
• Linear, sequential
• Teams gather requirements
• Develop the product
• Test it to see if they implemented the spec correctly
• After release they gain insight into what the customer actually desired
• Would be nice if it worked
Versions
• What actually happens – start project, develop and then present to customer
o Customer then decides that isn’t what they want – target changes
• Target has changed
o Given more money you can try again
37 | P a g e
o There a good chance the team learned quite a bit about what their customers
actually desired
▪ Next rocket has a better chance of landing closer to the actual customer
needs
• Customer may change their mind multiple times – but will eventually arrive at what they
want, and the product will be completed
Waterfall Concepts
• Software as an Engineering discipline - “Do it right the first time”
• The more design time reduces risk
o By planning upfront you identify problems early and avoid mistakes
▪ The longer you analyse a system, the more edge cases you’ll discover
▪ Often design elaborate systems for problems that do not really exist
38 | P a g e
• 2 weeks to test it before deployment
• Month to write a patch that fixes a problem after deployment
Iteration
Modern Processes
• More lightweight than waterfall
o Less documentation
o Fewer procedures
• Don’t release only one version at the end.
o Parallel development
o Product of prototypes
• Only do what is required
o No adding in extra requirements
• Design for change
o Change is inevitable – that’s why it’s necessary to produce prototypes to get better,
more accurate requirements
• Start with a set of requirements, then build prototype(s) and then run tests on those
prototypes
o Those tests help inform next set of requirements to prototype and test
o Iterate until reach a prototype that’s close to final product
39 | P a g e
• Expended process to prototyping
• Start with requirements gathering, move into design phase, then develop, deploy and test
o Examine test results, learn and reflect – that provides feedback into the
requirements again
o Will need to reorient as go through cycles to better match what people need
o Refine the design over time
Iterative/Incremental Process
• Plan development
• Undertake development
• Generate a prototype
• Get user feedback
• Develop again
• Iterative software development: a process that reaches the goal in a series of ever improving
delivery cycles
Iterative Process
40 | P a g e
• Eventually reach project success
o Compared to waterfall which took more time and was more all over the place
Benefits
• Favoured by small start-up companies
o Greatly reduce the risk of a project failing
▪ Only one shot at the target, steer your way to success using information
instead of launching blindly into the unknown
o Long term, iterative development delivers more value sooner, with lower overall risk
• Project is intensely focused
o In completing only high priority features, many alternative concepts never get
explored
▪ Good ideas can be lost
41 | P a g e
Examples of Iterative Software Development Methods
• Agile software development (“Agile Manifesto”)
o Mini software projects; face-to-face communication
• Rapid Application Development (RAD — James Martin)
o Voice of customer; Collaborative; rigid schedule
• Extreme Programming (XP — Kent Beck)
o Design on the fly; unit testing of all code, pair programming; refactoring
• Scrum (Takeuchi, Nonaka and, later, Schwaber)
o Facilitated teams scrum down in short iterations (sprints); empirical process
Unified Process
Ideas
• (Rational) Unified Process (RUP or UP) is a process for building high quality object-oriented
systems
• Central Idea: Iterative Development
o The life of a system stretches over a series of cycles, each resulting in a product
release
Iterative Development
42 | P a g e
• Output of an iteration is not an experimental prototype but a production subset of the final
system
• Each iteration tackles new requirements and incrementally extends the system
• An iteration may occasionally revisit existing software and improve it
Phases
Unified Process Phases
• Inception — Define the scope of project
o Feasibility
• Elaboration — Plan project, specify features, baseline architecture
• Construction — Build the product
o Refine vision, implement core, resolution of high risks, identify major requirements
o Several iterations
• Transition — Transfer the product into end user community
o Deployment, release
• Can see increased modelling in the beginning but decreases towards the end
• Also, with each iteration, need to fulfil less and less requirements
43 | P a g e
• Less effort gets put into beginning stages, and more put in towards the end for some phases
o E.g. deployment
Artefacts
• Docs, diagrams, code, etc. that track our progress
o UML, interview plans, etc
o Produce what you need in order to carry out the phase that you’re in
• Everything is optional!
• Best kept electronically on website
• Following can start in inception:
o Use-case model, vision, supplementary specification, glossary, s/w development
plan, development case
Comparison
Process Comparison
44 | P a g e
Process Models
Process Comparison
• Expectation in traditional process is that functionality is fixed but time and resources are
flexible
• Iterative has time and resources fixed, but functionality is flexible
45 | P a g e
Reduce Risk
• Can use method to move us into another Cost/ Scope/ Time regime
o i.e. adjust time/scope/cost more effectively
46 | P a g e
Conclusion
• Consider only iterative technologies
• Agile techniques
o Small time cycles
o Many prototypes
o Meet user requirements
o Timescale is adopted by the development team
47 | P a g e
Prototyping
• What Is A Software Prototype? – Depends
o “Initial, incomplete version of a software system being developed that is used to
learn about the problem, explore designs and solution techniques.”
• Helps to investigate
o Technical issues
o Work-flow, task design
o Screen layouts, information display
▪ e.g. user interface
o Difficult, controversial, critical areas
o Match between engineering and customer specification
• Demonstrate proof of concept
• More concrete than a narrative
Why Prototype?
• Enable evaluation and feedback (central to design methodology)
• Improves communication within a team and outside with clients
o Can help clarify goals, requirements etc
• Testing ideas out – encourages reflection
• Answer questions!
• Explore alternatives
• Slow response, sketchy icons, fake data, limited functionality, limited parameters, etc
Throw-Away Prototypes
• Address high-risk issues
o Uncertainty in requirements
o User interface design
o Alternative implementation strategies
o Technology platform
• Only enough effort to help address specific issues
o Focus only on the issue, ignore all others
o No unit tests
o Too much effort will make you hesitant to throw it away
48 | P a g e
• Great for trying alternative ideas
Evolutionary Prototypes
• Intended to be early, not necessarily release-able version of the actual software…
o … will evolve into the final product
• Quality is important (unit tests are back!)
• Can be put to limited use (e.g. demo, constrained env)
• Implementing and validating well-understood requirements -> providing opportunity for
change and reorienting if necessary
• Potential Weakness – customers/testers may be hesitant to criticize underlying problems in
something that seems heavily invested/developed!
The Demo
• How to beat Murphy:
o Make sure your system works
o Make sure your system works
o Also practice and rehearse the demo
• How To Make Sure The System Works
o No last-minute code changes
o Demo stable version with fewer features rather than an untested version with more
o Rehearse the entire demo!
o No, really resist the temptation to tweak the demo!
o Test any peripherals (e.g. speaker, projector, scanner)
49 | P a g e
Before the Demo
• Arrive early
• Make sure the system works!
50 | P a g e
Software Testing
Unit Testing
• Usually, the first level of testing done
• Develop, then test feature
• Test a single unit/component of code – e.g. a class, method etc
• White Box testing – since can see the code
Integration Testing
51 | P a g e
• Tests how different software modules integrates with each other and makes sure that the
functionality remains the same and correct
• Big bang: integrate all the features and test all at the same time
o Very risky
• Incremental: test in phases
o Bottom up - test the lower level modules such as connecting to the database before
we test the login method that reads from the database
o Top down – higher level modules tested first
▪ First test the login method, and then test if we can connect to the database
o Sandwich approach – choose sections to test together
• Different types work for different implementations
Regression Testing
• Conducted as we add new features to ensure that the addition of these new features did not
break previously developed features
52 | P a g e
Types of Regression Testing
1) Corrective Regression Testing: used when there are no changes introduced in the product’s
specification with existing test cases that we can reuse to conduct the test.
2) Retest-all Regression Testing: very tedious and tends to waste a lot of time.
a. The strategy involves the testing of all aspects of a particular product as well as
reusing all the test cases.
3) Selective Regression Testing: is done to analyse the impact of new code added to the already
existing code of the software.
a. When this type of regression testing is conducted, a subset from the existing test
cases is used, to reduce the effort required for retesting and the cost involved.
4) Progressive Regression Testing: works effectively when there are certain changes done in
the program specifications as well as new test cases are designed.
a. Conducting this testing helps in ensuring that, there are no features that exist in the
previous version that has been compromised in the new and updated version.
5) Complete Regression Testing: best to be used in case there are multiple changes that have
been done to the already existing code.
6) Partial Regression Testing: done to test issues when new codes are added to already existing
code.
a. The idea behind partial regression testing to make sure that a system is performing
as it is supposed to be after addition of new code.
7) Unit Regression Testing is the most important part of unit testing.
a. Mostly conducted in isolation, mainly focused on code unit and all the dependencies
and interactions will be blocked at the 15 time of test
53 | P a g e
• Final phase of testing to ensure that the software is ready for production by:
o Making sure it is what the user wanted
o Is usable and user friendly
• Alpha Testing
o Often conducted in software house or with “super users”
o Software not production ready at this stage
• Beta testing
o Conducted with actual users of the system
o Software production ready
Security Testing
54 | P a g e
Agile Software Processes
Agile Principles
• Agile Software Development
o Put the software being developed first
o Acknowledge that user requirements change
o It is agile because it can respond quickly to the users’ changing and emerging needs
o Advocates frequent and regular, software releases
▪ Users can respond quickly to these releases, changing requirements
• Agile Manifesto
o While there is value in the items on the right, we value the items on the left more
o This clearly distinguishes Agile from more documentation‐focused processes like
rational unified process and waterfall
55 | P a g e
Team Empowerment
• Teams must be empowered
• The agile project team is core to the success of agile
o They must be trusted, feel ownership over the product and customer needs, and be
able to work together effectively
o These teams benefit from individuals that are agile, that can shift between roles as
necessary, and work well together
• The project team must have sole responsibility to deliver the product
• Any interference with the project team is disruptive and reduces their motivation to deliver
• The team must together
o Establish and clarify the requirements
o Prioritise them together
o Agree to the tasks required to deliver them
o Estimate the effort involved
• It ensures the buy-in and commitment from the entire project team from the outset
• When challenges arise, the team feels a real sense of ownership
Bare Requirements
Pareto’s Law
• Typically, 80% of your results may actually come from only 20% of your efforts!
o Try to apply the 80/20 rule, and focus on the important 20% of effort that gets the
majority of the results
• The difficult question is:
o Can you see initially which 20% is the important 20%?
▪ The 20% that will deliver 80% of the results
▪ In very many cases, the answer is NO
56 | P a g e
• Caveat – if you target the 80% population, consider who you are excluding
o Bells and whistles often unnecessarily exclude bandwidth‐constrained communities
Agile Requirements
• Agile requirements are barely sufficient
• Capture requirements at a high level and on a piecemeal basis
o Just-in-time for each feature to be developed
o Barely sufficient – the minimum to enable development and testing
▪ Minimise the time spent on anything not part of product
• Understand enough to determine (and prioritize) the scope and for high level budgetary
estimates
• Captured in collaborative workshops so that all team members understand the
requirements
o Allows everyone to contribute, challenge and understand what’s needed and why
User Stories
57 | P a g e
o Not user friendly
Incremental Design
• Agile does not follow a top-down design method
o Top-down design says time in design is worth it to save cost of reworking the design
many times
• Agile design is always the same size as the system
o “You can’t possibly anticipate the problems and alternatives that will arise once you
start coding”
• If a new feature comes along that requires major changes then that is the trade-off for the
flexibility it allows
o Perhaps this feature was not even known at the beginning anyway
o Or it might have gone away if we knew of it at the start
Fixed Timescale
• In agile we allow the scope to be flexible in order to ensure that the project has a fixed cost
and timescale
• In Agile Development, requirements evolve, but timescales are fixed
• Contrast to traditional development:
o Capture all known requirements
o Changes are subject to change control
o Users are told it’s much more expensive to change or add requirements during or
after the software is built
58 | P a g e
▪ It becomes imperative to include everything they can think of, everything
they ever dreamed of!
• Normally
o Users may actually use only 20% or less of the product
o Many projects start with a bloated scope
▪ No-one is sure at the outset which 20% they will use
o It is impossible to think of everything, things change, and things are understood
differently
• Agile Development assumes that requirements emerge and evolve
o However, much analysis and design you do, you cannot really know what you want
until you see and use the software
o In the time spent analysing and reviewing requirements and designing a solution,
external conditions could change
Fixed Budget
• What does business expect from development teams?
o Deliver the agreed business requirements
o On time and within budget
o To an acceptable quality
▪ In Agile Development, it is the scope that is variable, not the cost and
timescale
• For this to work, it’s imperative to start development with the core, highest priority features
o Delivered in the earliest iterations
• As a result
o Business has a fixed budget,
o Based on affordable resources and
o Can make plans based on a certain launch date
• Fixed timescale, fixed budget means project itself is predictable from budgetary sense, and
that it will meet a minimum requirement to be delivered, with the core features
Working Product
• Key is to have a working product at all times
Frequency
• How frequent is frequent
59 | P a g e
• Competitors won't wait
• Speed-to-market – a significant competitive edge
• The value of first-mover advantage is enormous
o Research shows 80% of first to market end up market leaders
• So how frequent is frequent enough?
• There is no right or wrong answer
o Decide what's appropriate; stick to a regular release cycle
o Allows you to plan
o Allows your infrastructure and ops teams to plan
o Allows your business colleagues to plan
o Allows launch events, marketing campaigns, etc to be planned
• BUT – frequent releases of buggy software can really irritate customers
• Features developed in an iteration, should be 100% complete by the end of the iteration
o Ideally, each iteration results in a release
• In Agile development, “DONE!” means shippable
o In practice a feature may rely on other features being completed before the product
could really be shipped.
o But the feature on its own merit should be shippable
• Completing each feature before moving on to the next ensures the system is not in a state
where multiple features are 90% complete or untested, as in traditional developments
60 | P a g e
The Working Product
61 | P a g e
Prototypes
• Prototype solutions to risky problems helps to increase the chance of having a working
product
• Prototypes: an inexpensive way to try out ideas so that as many issues as possible are
understood before the real implementation
• Two main classes of prototypes
o The true prototype
▪ Test implementation to understand a problem before it is implemented for
real
o Tracer bullets
▪ Prototype that is intended to gradually turn into the final solution
Continuous Integration
• An important discipline is to continuously integrate changes
o Frequent integration helps to ensure that modules will fit together;
o And also that the product continues to work with all the changes
• Developers have the bad habit of checking out a number of files and not checking them in
again until their work is done
o Developers should integrate their work daily.
o This gradual introduction of changes ensures that integration problems or
regressions are caught early
62 | P a g e
Nightly Builds
• Software should be completely rebuilt from scratch daily.
o The result of the build should be an installable product image.
• The build should include as many automated tests as possible to catch integration problems
early
o If the build or tests fail, fix the problems first thing
o Don't let anyone integrate any additional work until after the build succeeds again
o There is a risk of multiple bad changes accumulating that will jeopardize the quality
of the product
Performance
• Don't Neglect Performance
o Some people feel that code clarity is more important and that you should get the
code clarity right first and then optimize the 1% to 3% of code that needs it.
o Others feel that you should code for performance first, because if you don't, your
code will always be slow
Pair Programming
• Programmers work in pairs, sit together to write every line of code
o 2 programmers + 1 computer = atomic unit of XP code development
o One person at the keyboard, other supporting
o Pairs are created dynamically
o Egoless development
Advantages
• Informal review process: each line of code is looked at by at least two people
• Common ownership of code
o Individuals are not held responsible for problems with the code
• Collective responsibility for the system
o Team has collective responsibility for resolving problems
• Spreads knowledge across the team
o Reduces risk if someone leaves
• Motivates refactoring as the whole team will benefit from it.
o Refactoring is effort expended to get to where you started but in a better position
for later
Challenges
• Working on with someone else’s schedule can be exhausting!
63 | P a g e
• Constant communication requires empathy and interpersonal skills
• Different skill levels makes it difficult for pairs to estimate contributions and pace
• Power dynamics (e.g. gender, seniority, race, degree)
• No time for yourself (important for introverts)
• Rotations lead to context switching
64 | P a g e
Agile Testing
Testing in Agile Development
• Testing is integrated throughout the lifecycle;
o Testing the software continuously throughout development
• Agile development does not have a separate test phase
• Developers write automated repeatable unit tests
o Testing done as part of the build
o Ensures all features are working each time a build is produced.
▪ Builds should be regular, at least daily
o Integration is done as you go too
• These actions keep the software in a releasable condition throughout the development,
o Can be shipped whenever appropriate
• For each feature developed, have to follow a tiered module approach:
o E.g. for a login – need to see that data can be pulled from database
▪ Then can client use the business logic that has been coded in to log in
▪ ….etc
65 | P a g e
• In sprint 2 we run sprint 2’s tests, but also sprint 1’s tests, and so on, as you move through
the various sprints
Test-First Development
Involvement
• Role of the customer in testing is to help develop acceptance tests for the stories
implemented in the next release of the system
• All new code is therefore validated to ensure that it is what the customer needs
• Customers have limited time available
o Cannot work full-time with the development team
o May feel that providing requirements was enough of a contribution
o May be reluctant to get involved in the testing process
Test-First Development
66 | P a g e
[Pass]
[Pass,
Development
[Fail] continues]
67 | P a g e
o TDD = TFD + refactoring
• TDD turns traditional development around
o Instead of writing functional code first and then your testing code as an afterthought
o You first write your test code before your functional code
• Also, you do so in very small steps
o One test and a small bit of code at a time
• With TDD a developer refuses to write a new function unless there is a test that fails because
that function isn’t present
o Refuse to add even a single line of code until a test exists for it
• Once the test is in place, do the work required to ensure that the test suite now passes.
• Once your code works, refactor it to ensure that it's remains of high quality
• The diagram shows how you perform test driven development:
Unit Tests
• Implication: developers need to learn how to write effective unit tests
• Experience is that good unit tests:
o Run fast
▪ They have short setups, run times, and break downs
o Run in isolation
▪ You should be able to reorder them
o Use data to make them easy to read and understand
o Use real data when they need to
▪ Copies of production data.
o Represent one step towards your overall goal
68 | P a g e
Refactoring
Technical Debt
• “Technical debt (also known as tech debt or code debt) describes what results when
development teams take actions to expedite the delivery of a piece of functionality or a
project which later needs to be refactored. In other words, it’s the result of prioritizing
speedy delivery over perfect code.”
Code Smells
• “Code smells are not bugs or errors. Instead, these are absolute violations of the
fundamentals of developing software that decrease the quality of code.”
Refactoring
69 | P a g e
• “Refactoring is a systematic process of improving code without creating new functionality
that can transform a mess into clean code and simple design”
o Just fix the code that is currently there
• A change made to the internal structure of software to make it easier to understand and
cheaper to modify without changing its observable behaviour
• Adding functionality does not change existing code, it only adds new capabilities
o Measure progress by adding tests and getting the tests to work
• Refactoring does not add functionality, you only restructure the code
o Don’t even add any tests — only restructure the code
• These software improvements are made before there is an immediate need for them
Advantages
• Improves the design of sw
o Deals with Software rot, decay and loss of structure
o Refactoring is like tidying up the code.
▪ Regular refactoring helps code retain its shape
▪ You refactor code that works but is not ideally structured
o An important aspect of improving design is to eliminate duplicate code
▪ Ensure the code says everything once and only once
▪ Mode code => harder to mod correctly => more code to understand
▪ “Change this bit of code here, but the system doesn't do what is expected
because you didn't change that bit over there that does much the same
thing in a slightly different context.”
o Changes are easier to make because the code is well-structured and clear
• Makes sw easier to understand
o Improve the understandability and readability of the software
▪ Reduces the need for documentation
▪ Good programmers write code understandable by human beings!
o After code is written it has to be maintained
▪ Someone will try to read the code to make changes
▪ It matters if it takes a programmer a week to make a change that would
have taken an hour if she had understood your code
o When you are trying to get the program to work, you are not thinking about that
future developer
▪ It takes a change of rhythm to make changes that make code easier to
understand.
70 | P a g e
▪ Refactoring leads to higher levels of understanding that would otherwise be
missed during development
• Helps find bugs:
o By clarifying the structure of the program, you clarify certain assumptions you’ve
made
▪ To the point at which even you can’t avoid spotting the bugs.
• Helps you program faster
Refactoring Categories
• Composing methods
o These refactorings serve restructurings at the method level
• Moving features between objects
o These refactorings support the moving of methods and fields between classes
• Organizing data
o These refactorings restructure the data organization
• Simplifying conditional expressions
o These refactorings simplify conditional expressions
• Making method calls simpler
o These refactorings simplify method calls
• Dealing with generalization
o These refactorings help to organize inheritance hierarchies
Refactoring to Patterns
• Refactoring to Patterns is the marriage of refactoring with patterns
o Patterns ≡ classic solution to recurring design problems
• Use patterns to improve an existing design
o Better than using patterns early in a new design
71 | P a g e
Scrum and Agile
Agile
• Umbrella term for the mindset behind many kinds of modern iterative software
development methodologies
• Hallmarks include small teams doing small chunks of work, customer-oriented design, and
collaboration among teams
• Agile practices include Scrum, Kanban, etc
• Can only estimate so far with so much accuracy – agile capitalises on this
Customer-Oriented Design
• Learn about your customer so you can think from their perspective (“customer empathy”).
o What does the customer want?
• Keep an open “conversation” with customers (forums, feedback, fix bugs)
• Prioritize work that solves important customer-facing problems
• Limit work that does not impact the customer; fit it in when it fulfills a larger customer-
impacting effort
• Speed and timing matter; perfect architecture / perfect code doesn’t exist
o Always try to ship!
Example
• Large problem—break it down.
o Want to estimate time to solve the whole thing—might take weeks or months if
we’re honest
• Break into high-level features, then into small tasks that can be completed in a week or less
72 | P a g e
• Prioritize important pieces first.
o When one is completed, move on to the next most important piece
• Include some friends (work on a team) to reach the goal sooner.
o Agree on goals for each piece before starting any work, then check on progress daily
• Every couple weeks, talk about how it’s going, demo your progress, and take time to
redistribute the work if necessary.
Scrum
• Scrum: an agile methodology conducted in short periods of work called “sprints,” after each
of which software is expected to be “shippable.”
• Sprint - each lasts a fixed number of weeks (usually 1-4) and is marked by several
ceremonies or rituals
• Helps focus effort and keep out distractions, improving progress toward completing the goal
Scrum Ceremonies
• Once per sprint a Scrum Master facilitates the following meetings:
o Backlog Grooming - POs prioritize and break down items in the backlog
▪ E.g. take an Epic and break it down into subcomponents, user stories and
prioritise them
• E.g. as an HR user, I want to be able to delete employees from
database
73 | P a g e
▪ Assign duration of time that you expect a given user story to take – i.t.o
story points, not days
• E.g. team can do 20 story points this sprint
o Sprint Planning - POs and team members select items from the backlog, agree on
Acceptance Criteria, do task breakdown, and assign tasks
o Retrospective (Retro) - Team members (without POs) discuss successes as well as
areas to improve; formulate plans to enact said improvements
o Demonstration (Demo) - Teams or team members show the results of their work to
POs
74 | P a g e
Fewer/Smaller Scrum Teams
75 | P a g e
o Rather want to operate in a continuous loop of taking on user stories
• It is possible to measure completed work continuously as a velocity (story points
completed/day) instead of tallying this only at the end of a sprint
o Want to keep a velocity under a certain amount for a team
• Measuring velocity tells POs how far through the backlog a team will get by a certain date
Conclusion
• Agile is user-focused and uses Epics/Stories, Points, Acceptance Criteria
• Scrum is one kind of Agile methodology that uses fixed duration sprints
• Scrum has roles, ceremonies, and sprints that aim to keep out distractions
• Other Agile methodologies manage work and progress differently (velocity)
• Goals: Improve quality and predictability – build what the customer wants today, not what
they thought they wanted months or years ago
Scrum Development
Being a Scrum Master
Vertical Features
76 | P a g e
o Different layers built independently
o In a waterfall approach – build storage, then business logic, then presentation
• Scrum uses the mixed approach
o Try and build all the layers in parallel
•
Scrum Artifacts
• Increment: the collection of the Product Backlog Items that meet the team’s Definition of
Done by the end of the Sprint.
o The Product Owner may decide to release the increment or build upon it in future
Sprints.
• Definition of Done: a team’s shared agreement on the criteria that a Product Backlog Item
must meet before it is considered done
o Need to have feature “client-ready”
o Differs from team to team
Scrum Processes
77 | P a g e
o Start from top of backlog and work down
o Team commits to deliver features for product owner
• Sprint backlog – used for period of the sprint
o 1-4, typically 2 weeks
• Have a daily scrum
o Allows one to see interdependencies between the team, as well as any blockers
• At the end of the sprint
o There’s a sprint review – demo working features to product owner
o There’s a retrospective – talk about what worked, what didn’t, what needs to
change
78 | P a g e
Software Quality Attributes
Runtime
Performance
• Focuses on how a system running the system performs under a particular load
• Load testing - checks the application's ability to perform under anticipated user loads.
o The objective is to identify performance bottlenecks before the software application
goes live
79 | P a g e
• Stress testing - involves testing an application under extreme workloads to see how it
handles high traffic or data processing.
o The objective is to identify the breaking point of an application
• Endurance testing - is done to make sure the software can handle the expected load over a
long period of time.
• Spike testing - tests the software's reaction to sudden large spikes in the load generated by
users
• Volume testing - Under Volume Testing large no. of. Data is populated in a database and the
overall software system's behavior is monitored.
o The objective is to check software application's performance under varying database
volumes
• Scalability testing - The objective of scalability testing is to determine the software
application's effectiveness in "scaling up" to support an increase in user load. It helps plan
capacity addition to your software system
• Smoke Testing is a software testing process that determines whether the deployed software
build is stable or not. Smoke testing is a confirmation for QA team to proceed with further
software testing.
o It consists of a minimal set of tests run on each build to test software functionalities.
Smoke testing is also known as "Build Verification Testing" or “Confidence Testing.”
Security
• Vulnerability Scanning: This is done through automated software to scan a system against
known vulnerability signatures.
• Security Scanning: It involves identifying network and system weaknesses, and later provides
solutions for reducing these risks.
o This scanning can be performed for both Manual and Automated scanning
• Penetration testing: This kind of testing simulates an attack from a malicious hacker.
o This testing involves analysis of a particular system to check for potential
vulnerabilities to an external hacking attempt
• Risk Assessment: This testing involves analysis of security risks observed in the organization.
Risks are classified as Low, Medium and High.
o This testing recommends controls and measures to reduce the risk
• Security Auditing: This is an internal inspection of Applications and Operating systems for
security flaws.
o An audit can also be done via line by line inspection of code
80 | P a g e
• Ethical hacking: It's hacking an organization’s own software systems.
o Unlike malicious hackers, who steal for their own gains, the intent is to expose
security flaws in the system
• Posture Assessment: This combines Security scanning, Ethical Hacking and Risk Assessments
to show an overall security posture of an organization
Availability
• The probability that the system is operating properly when it is requested for use.
o In other words, availability is the probability that a system is not failed or
undergoing a repair action when it needs to be used
• Dream is 5 9’s
Measuring Up-time
• MTBF (mean time between failures): the average time between repairable failures of a
technology product.
o The metric is used to track both the availability and reliability of a product.
o The higher the time between failure, the more reliable the system.
• MTTR (mean time to repair): the average time it takes to repair a system (usually technical
or mechanical).
o It includes both the repair time and any testing time.
o The clock doesn’t stop on this metric until the system is fully functional again
• MTTD (mean time to diagnose): once the system is down, how long it takes to diagnose
what is wrong
81 | P a g e
• MTTR (mean time to recovery or mean time to restore) is the average time it takes to
recover from a product or system failure.
o This includes the full time of the outage—from the time the system or product fails
to the time that it becomes fully operational again.
• MTTF (mean time to failure) is the average time between non-repairable failures of a
technology product
o For example, if Brand X’s car engines average 500,000 hours before they fail
completely and have to be replaced, 500,000 would be the engines’ MTTF
Functionality
Usability
• Want to have good apps with good ux, that it fits its user-base
Non-Runtime
82 | P a g e
Modifiability/Maintainability
• A quality attribute of the software architecture that relates to “the cost of change and refers
to the ease with which a software system can accommodate changes”
• E.g. good sw is such that can easily switch to two-factor authentication without having to
refactor the whole code case
83 | P a g e
Portability
Reusability
84 | P a g e
Interoperability/Integrability
• Interoperability: the real-time data exchange between different systems that speak directly
to one another in the same language
• Integration: the process of combining multiple applications to function together as one
uninterrupted system, often involving the use of middleware
Testability
• Software needs to be written in such a way that it is easy to run any type test (unit,
integration UAT) against the software
• Use principles of test-driven development to ensure that have highly testable sw
85 | P a g e
Code Reviews
Advantages
• 1. Consistent design and implementation
o Code peer review can enforce a consistent coding style throughout a project,
thereby making source code readable by anyone who might be introduced to the
project at any given time during development
• 2. Minimizing your mistakes and their impact
o This might seem like the most obvious advantage to the code peer review process,
but it’s also one of the most important.
o When you’re working with the real pressures of time and budget, it’s easy to skip
this step.
o Sure, you’re confident in your work, but even the best coders can go crossed-eyed
from looking at their own work too long
• 3. Ensuring project quality and meeting requirements
o The scope of any given software project and its requirements might run through the
hands of several developers.
o The code review process can serve as a check and balance against different
interpretations of that scope and requirements compared to the code that ends up
being delivered.
o The second set of eyes can ensure you don’t fall into the “pit” you created based on
your own understanding
• 4. Improving code performance
o Due to the lack of experience, some younger developers might be unaware of
optimization techniques that could be applied on their code
o The code review process provides an opportunity for these developers to acquire
skills and boost the performance of their code
• 5. Sharing new techniques
86 | P a g e
o During a code review, developers can also share new technologies and techniques
with each other
o Sharing techniques transcends seniority, where every developer is equally able to
share, cooperate and improve their skills
87 | P a g e
• Performance
o Does the software code last during updates?
o Is it performing as it should?
o Why isn’t it performing in load, stress, or response testing?
o Do users enjoy it?
• Test failures
o Automated and manually, what tests are failing?
o Was a test working and now it is failing?
o What is your failure balance?
o How can testability be improved with technologies
88 | P a g e
SOLID Design Principles
OOP
https://www.freecodecamp.org/news/solid-principles-explained-in-plain-english/
Single Responsibilities
• The concept is of a Class doing one specific thing (responsibility) and not trying to do more
than it should
o aka High Cohesion
• Only one potential change (database logic, logging logic, and so on) in the software’s
specification should be able to affect the specification of the class
o Eg. If a class is a data container, like a Book class or a Student class, and it has some
fields regarding that entity, it should change only when we change the data model
• Classes don’t often start with low cohesion, but typically after several releases and different
developers adding onto them, the class may be become a monster/god class
o Class should be refactored
• The single responsibility principles is a programming principles that states that every
module, class or function should have responsibility over a single part of the functionality
provided by the sw, and that responsibility should be entirely encapsulated by the class
• It is necessary because:
o Many many different teams can work on the same project and edit the same class
for different reasons, this could lead to incompatible modules
o It makes version control easier
89 | P a g e
S.O.L.I.D
Example
Open Closed
• Open/closed principle states that “sw entities (classes, modules, functions, etc) should be
open for extension but closed for modification”
o That is, such an entity can allow its behaviour to be extended without modifying its
src code
• Basically - write your code so that you will be able to add new functionality without changing
the existing code
• Most “important” principle of OO-design
90 | P a g e
Liskov’s substitution
• E.g. A penguin “is a” bird – so Penguin class should inherit from the Bird class
• The “is a” technique of determining the inheritance relationships is simple and useful – but
occasionally results in bad use of inheritance
• Liskov Substitution Principle is a way of ensuring that inheritance is used correctly
Example
• Bird class has setAltitude method – but not all birds fly
• End up with empty method signatures for all classes that inherit from the parent Bird class
o Leads to messy code
• Try to avoid creating this situation
• If want to make a parent class and put methods in that class – need to be sure that every
class that ever in the app’s lifetime will use every single method in that class
o Otherwise, don’t put the method in
o Parent abstract class should be very lean – done to prevent forcing an inheriting
class to implement something it can’t use
91 | P a g e
Interface Segregation
Interfaces and their Implementation
Interface Use
• Capturing similarities among unrelated classes without artificially forcing a class relationship
• Declaring methods that one or more classes are expected to implement
• Revealing an object's programming interface without revealing its class
92 | P a g e
• Modelling multiple inheritance, a feature that some object-oriented languages support that
allows a class to have more than one superclass
• Enabling polymorphic behavior
• NB Java does not support multiple inheritance – things get too complicated too quickly
Interface Segregation
93 | P a g e
• Interface Segregation Principle (ISP) states that clients shouldn’t be forced to depend on
methods they don’t use
• Interfaces should belong to clients, not to libs/hierarchies
• App devs should favour thin, focused interfaces to “fat” interfaces that offer more
functionality than a particular class/method needs
• Basically – if this interface has a method that not all classes that implements this interface is
going to use, that method belongs in a new interface
Dependency Inversion
94 | P a g e
• Diagram above shows how we model sw
• Higher level modules at the top, lwr towards the bottom
• Data Layer – persist layer in dtb
o Move to business logic layer – then pull data out of dtb and manipulate it in order to
present to user in presentation layer
• When sw built badly, a dependency between the data and business layer is created
95 | P a g e
• Result is above figure – have repo interface with a dtb
o These dtbs are hidden from app – business logic class then talks to repo, rather than
SOLID Summary
• SRP – a class has only one job
o Single Responsibility
• OCP – extend classes, don’t change them
o Open/Closed Principle
• LSP – use abstraction correctly
o Liskov’s Substitution Principle
• ISP – create “thin” specific interfaces
o Interface Segregation
• DIP – Decouple lower logic from higher up, more complex logic
o Dependency Inversion
96 | P a g e
Gang Of Four Design Patterns
• Design patterns represent the best practices used by experienced object-oriented software
developers.
o Design patterns are solutions to general problems that software developers faced
during software development.
o These solutions were obtained by trial and error by numerous software developers
over quite a substantial period.
Creational Patterns
97 | P a g e
Structural Patterns
Behavioural Patterns
98 | P a g e
Singleton Design Pattern
• Restricts initialisation of a class to ensure that only one instance of the class can be created
o Not always good practice
• Can be used in the wrong place and then violate rules of SOLID by having tight coupling in
your application
• When then is singleton used?
99 | P a g e
o E.g. dtb connection – only want one connection to the dtb; also when writing log
files
▪ Don’t want multiple instances of a class writing entries to your log file – just
want one instance of a class to write logs for your app
o Also used when coding fragments in Android Development
• Derived Exception = Sealed keyword
o https://www.oracle.com/technical-resources/articles/java/singleton.html
• The Factory pattern is one of the most used design patterns in Java
o This type of design pattern falls under creational patterns as this pattern provides
one of the best ways to create an object
• In the Factory pattern, we create an object without exposing the creation logic to the client
and refer to the newly created object using a common interface
100 | P a g e
Example
• Client is a class which needs to instantiate classes to create burgers – but doesn’t know
which burger it’s going to create or when
o Need to be able to create any burger, any time
• So, client uses which class to instantiate to create chicken/plain burger – client defers
instantiation to the factory.
o Factory contains factory method to decide which burger to create
• Chicken and burger classes use interface to define their behaviour
o i.e. they implement interface and inherit all methods
101 | P a g e
Observer Pattern
102 | P a g e
Composite Pattern
• The Composite Design patterns describe groups of objects that can be treated in the same
way as a single instance of the same object type
• The Composite pattern allows us to "compose" objects into tree structures to represent
part-whole hierarchies
• In addition, the Composite patterns also allow our clients to treat individual objects and
compositions in the same way
• The Composite patterns allow us to have a tree structure for each node that performs a task
• In object-oriented programming, a Composite is an object designed as a composition of one-
or-more similar objects, all exhibiting similar functionality.
o This is known as a “has-a” relationship between objects
103 | P a g e
• Diagram above:
o A leaf has no children – a composite is an obj that can contain leaves
▪ One composite can contain many leaves or many composites
o Component is the final product
104 | P a g e
Architecture
• Think Big, Act Small, Fail Fast, Learn Rapidly
o Slogan from Lean Software Development (another Agile method)
▪ Has the principle of “See the whole” (amongst others)
▪ =/= do the whole design early!
• Rather do just enough design at a high lvl to have a good enough
idea of how the pieces will interlock together
• Seeing the whole when building a single system – this is architectural thinking
o It is the translation from the problem domain to the solution concepts
▪ Concepts at a high lvl
▪ Technology with purpose
• Another idea is development as a cycle of experiments with a test at the end of each cycle.
Architecture
105 | P a g e
• SW architecture: the set of principal design decisions about the system
o The heart software system
• Well-engineered sw ==> good software architecture
o A good set of design decisions
o NB: this is very different from the other meaning of Architecture in CS (hardware
and the associated abstractions)
Definition: Architecture
• Basic idea – it is about the BIG picture; the large scale:
o Motivations
o Constraints
o Organisation
o Patterns
o Responsibilities
o Connections of a system (or a system of systems)
• Architecture is about how all of the code components fit together, how pieces of code talk
to one another, and how the overall system functions at a high level
o Many different design patterns interleaving to support an overall system – and the
pattern choices we make will be governed by lots of factors:
▪ Motivations of the various stakeholders, constraints on the system and the
users, organization of the software as well as physical organizations and
dependencies on other products, design patterns, responsibilities, and the
connections of the system.
• “An architecture is the set of significant decisions about the organization of a software
system, the selection of the structural elements and their interfaces by which the system is
composed, together with their behaviour as specified in the collaborations among those
elements, the composition of these structural and behavioural elements into progressively
larger subsystems, and the architectural style that guides this organization—these elements
and their interfaces, their collaborations, and their composition.”
o Booch, Rumbaugh, and Jacobson, The UML User Guide, 1999
• The software architecture of a program or computing system is the structure or structures of
the system, which comprise software components, the externally visible properties of those
components, and the relationships among them.
o Architecture is concerned with the public side of interfaces; private details of
elements—details having to do solely with internal implementation—are not
architectural
o By “externally visible” properties, we are referring to those assumptions other
components can make of a component, such as its provided services, performance
characteristics, fault handling, shared resource usage, and so on.
o The intent of this definition is that a software architecture must abstract away some
information from the system (otherwise there is no point looking at the
architecture, we are simply viewing the entire system) and yet provide enough
information to be a basis for analysis, decision making, and hence risk reduction.
o Bass, Clements, and Kazman. Software Architecture in Practice, 2003
• Think of a component – when looking at it from a high lvl architectural perspective, it is a
black-box
106 | P a g e
o It doesn’t matter how anything is implemented inside the box – so long as it’s clear
what the inputs and outputs are and how its communicating with the rest of the
system
107 | P a g e
▪ Users of the Standard are free to employ whatever system theory they
choose.
▪ The premise of the Standard is, For a system of interest to you, the Standard
provides guidance for documenting an architecture for that system.
o Environment: Every System inhabits its Environment.
▪ A System acts upon that Environment and vice versa.
▪ A system’s Environment determines the range of influences upon the
system.
▪ In the Standard, Environment is intended in the widest possible sense to
include developmental, operational, technical, political, regulatory, and all
other influences which can affect the architecture.
▪ These influences are categorized as Concerns. Architecture: Systems have
architectures.
▪ In the Standard, the architecture of a system is defined as: “fundamental
concepts or properties of a system in its environment embodied in its
elements, relationships, and in the principles of its design and evolution”.
▪ The definition was chosen (1) to accommodate the broad range of things
listed above under System: the architecture of X is what is fundamental to X
(whether X is an enterprise, system, system of systems, or some other
entity); and (2) to emphasize (via the phrase “concepts or properties”) that a
system can have an architecture even if that architecture is not written
down.
o Architecture Description: An Architecture Description (AD) is an artefact that
expresses an Architecture.
▪ Architects and other system stakeholders use Architecture Descriptions to
understand, analyse and compare Architectures, and often as “blueprints”
for planning and construction. ADs are the primary subject of ISO/IEC/IEEE
42010
108 | P a g e
Core of Architecture Description
• Contents of an AD:
o The relations between content items when applying the Standard
o Produce an AD to express an Architecture for some System of Interest.
• Architecture Description: An Architecture Description is a work product used to express the
Architecture of some System Of Interest.
o The Standard specifies requirements on ADs.
o An AD describes one possible Architecture for a System Of Interest.
o An AD may take the form of a document, a set of models, a model repository, or
some other form (AD format is not defined by the Standard).
• Stakeholder: Stakeholders are individuals, groups or organizations holding Concerns for the
System of Interest.
o Examples of stakeholders: client, owner, user, consumer, supplier, designer,
maintainer, auditor, CEO, certification authority, architect.
• Concern: A Concern is any interest in the system.
o The term derives from the phrase “separation of concerns” as originally coined by
Edsgar Dijkstra.
109 | P a g e
o Examples of concerns: (system) purpose, functionality, structure, behaviour, cost,
supportability, safety, interoperability.
• Architecture Viewpoint: An Architecture Viewpoint is a set of conventions for constructing,
interpreting, using and analysing one type of Architecture View.
o A viewpoint includes Model Kinds, viewpoint languages and notations, modelling
methods and analytic techniques to frame a specific set of Concerns.
o Examples of viewpoints: operational, systems, technical, logical, deployment,
process, information.
• Architecture View: in an AD expresses the Architecture of the System of Interest from the
perspective of one or more Stakeholders to address specific Concerns, using the conventions
established by its viewpoint.
o An Architecture View consists of one or more Architecture Models.
• Architecture Model: A view is comprised of Architecture Models. Each model is constructed
in accordance with the conventions established by its Model Kind, typically defined as part
of its governing viewpoint.
o Models provide a means for sharing details between views and for the use of
multiple notations within a view.
• Model Kind: A Model Kind defines the conventions for one type of Architecture Model.
• AD Elements and Correspondences: Architecture Descriptions are comprised of AD
Elements.
o Correspondences capture relationships between AD Elements.
o Correspondences and Correspondence Rules are used to express and enforce
architecture relations such as composition, refinement, consistency, traceability,
dependency, constraint and obligation within or between ADs.
110 | P a g e
• The fundamental concepts or properties of a system in its environment embodied in its
elements, relationships, and in the principles of its design and evolution
• In the standard an architecture is abstract — not an artefact
o Architecture description – artefacts used to express & document architectures
• What is fundamental to a system may take several forms:
o Elements – the constituents that make up the system
o Relationships – both internal and external to the system
o Principles of its design and evolution
• Different architecture communities place varying emphases
o SW architecture: focused on software components as elements and their
interconnections as a key relationship
o System architecture emphasizes sub-system structures and relationships such as
allocation.
o Enterprise architecture emphasizes principles.
• Generic architecture – what is the one that can be applied to the system
o Could be several architecture patterns that will be incorporated together to meet
several different non-functional requirements
• How components are decomposed – could postpone this until later
o Decompose component just to be able to do the next step
• System distribution across hw – important to know for client-server systems where you will
need to scale (for load-balancing)
• …..etc
111 | P a g e
UML views
• How to use UML to represent architectures
• A logical view, which shows the key abstractions in the system as objects or object classes.
• A process view, which shows how, at run-time, the system is composed of interacting
processes.
• A development view, which shows how the software is decomposed for development.
• A physical view, which shows the system hardware and how software components are
distributed across the processors in the system
o Becomes important if have more than one server and they’ll be interacting – i.e.
which pieces are on which devices
• Related using use cases or scenarios (the +1) – used to provide an overall view of what’s
happening in the system
• Conceptual View is more of a domain level view, initial steps in architectural design.
o This view is an abstract view of the system that can be the basis for decomposing
high-level requirements into more detailed specifications, help engineers make
decisions about components that can be reused, and represent a product line rather
than a single system.
o In practice, conceptual views are almost always developed during the design process
and are used to support architectural decision making.
o They are a way of communicating the essence of a system to different stakeholders.
112 | P a g e
o Integrating of these different views to form the complete architectural
representation
• The logical view is concerned about the output(s) of the system and how it will affect the
end users
• The logical view splits the system into a set of abstractions, or modules
• This decomposition serves two purposes:
o It enables functional analysis
o It helps in identification of common mechanisms and design elements that are
common across the system
• Communication diagrams
• What are the different modules and how are they going to communicate with one another?
• This view describes the static organization of the software in its development environment
• It deals with modules, work allocation, costs and planning.
• It also involves monitoring of project progress, software reuse, and security
• Needed for purposes of project management and organising development of the sw, rather
than organising the sw itself and how they’re communicating with one another
• Component & Package Diagrams
o See how all of the components will be organised into separate packages that will talk
within one another
113 | P a g e
Process View (Component-and-Connector view)
• This view deals with concurrency and distribution, system integrity, and fault tolerance
• It explains which components interact, and how they do so
o And the dynamic connections between different components at runtime
• Activity Diagram (flowchart)
• Emphasis now on runtime – how different things conflict when they’re operating, and how
to ensure they work well together without creating a state/condition that system can’t
recover from
• This view describes how the software maps onto the hardware
• It shows networking and distribution
• It considers system requirements like reliability and performance
• Deals with the elements identified in the previous three views
• Deployment Diagram
Summary
• Need to be able to look at an architecture diagram and assess whether this is a physical
view, logical view, process view, development view
114 | P a g e
o And understand what is the purpose of the diagram – is it intended to help plan the
logical organisation of the system, how development will be managed, hardware
and testing environments, etc?
• Lots of different views together produce a whole to give a broader idea of what that
architecture is
UML Packages
• UML package diagrams are often used to illustrate the logical architecture of a system‐the
layers, subsystems, packages (in the Java sense), etc
o A layer can be modelled as a UML package; for example, the UI layer modelled as a
package named UI
• A UML package diagram provides a way to group elements
o A UML package can group anything: classes, other packages, use cases, and so on
o Nesting packages is very common
o A UML package is a more general concept than simply a Java package or .NET
namespace, though a UML package can represent those and more
• The package name may be placed on the tab if the package shows inner members,
or on the main folder, if not
• It is common to want to show dependency (a coupling) between packages so that
developers can see the large‐scale coupling in the system
o The UML *dependency line* is used for this, a dashed arrowed line with the arrow
pointing towards the depended‐on package
• UML packages:
o Packages group elements
▪ For example, groups of classes in a single namespace
o Drawn as a rectangle with a smaller tab at the upper left
▪ If members are shown within the package, name the tab
o Used to show the high-level organization of a project
o A dashed arrow between packages indicates a dependency
Logical Architecture
• Shows large-scale organization of software classes, grouped by
o Layers (coarse-grained)
o Packages
o Subsystems (finer-grained)
o Together, provide cohesive responsibility for a major aspect of the system
• “Logical” => independent of actual deployment decisions
• Aiming for high cohesion
• Place elements together that:
115 | P a g e
o Are in the same subject area – closely related by concept or purpose
o Are in a class hierarchy together
o Participate in the same use cases
o Are strongly associated
Summaries Editors
Domain
Evaluation
Core
Policies
Services
116 | P a g e
Layers shown with UML Package Diagram
UI
Swing Web
Domain
Technical Services
UI
UI::Swing UI::Web
Swing Web
Domain::Sales
Domain
Sales
117 | P a g e
o If you need to provide *fully‐qualified names*, the UML notation is, for example,
_java::util::Date_ in the case that there was an outer package named "java" with a
nested package named "util" with a _Date_ class.
• The UML provides alternate notations to illustrate outer and inner nested packages
o Sometimes it is awkward to draw an outer package box around inner packages
▪ So can use alternative representations to capture that idea of an outer
package that encloses a lot of inner packages
Package Dependencies
• In a strict layered architecture, a layer only calls upon the services of the layer directly below
it.
o This design is common in network protocol stacks, but not in information systems,
which usually have a relaxed layered architecture, in which a higher layer calls upon
several lower layers.
• Dependency line indicates coupling of packages
o Arrow points to the depended upon package
o Implies change to depended upon package likely impacts dependent package
o Robust architectures minimize dependencies
Ordering Work
• Logical view with packages helps to order work:
o What can we start with?
o What can we do in parallel?
▪ How?
• Developers can work independently on different layers
simultaneously
118 | P a g e
o Note: interface is similar but not the same as an abstract class.
▪ It depends on the language.
▪ In Java an interface is not a class and an abstract class has no code.
▪ In other languages an interface has methods with no code, just the
signature.
▪ An abstract class may then have a few basic methods with code and instance
variables that are specialized by subclasses.
• The «type» stereotype indicates that the class is an interface
o It has no member variables, and all of its member functions are pure virtual
• A shortcut for «type» classes is the “lollipop” notation to represent an interface
o Shape depends on DrawingContext as shown by the dashed arrow (as usual)
o The class WindowsDrawingContext is derived from, or conforms to, the
DrawingContext interface
119 | P a g e
o An interface can be drawn using a class‐ like rectangular setup, with the text
“interface” above the name of the interface.
o Figure above shows an interface named VisitorInterface.
• Realisation – depicts the relationship between an interface and a class that provides the
actual implementation.
o This can be drawn in two ways depending on how the interface is depicted.
▪ 1. Using a closed, hollow arrowhead pointing from the implementing class to
the interface with a dashed line
▪ 2. With a line and a circle, where the circle represents the interface (with the
name of the interface kept near the circle) and the line can be drawn
pointing to the class that implements the interface represented by the
circle.
• Dependency – depicts the relationship between a source and a target component, when
there is a dependency relationship between the two.
o It means, when there is a change in the target, the source element undergoes a
necessary change but not vice versa
120 | P a g e
Components – UML Example
Architecture Diagrams
• The Architecture Diagram provides a graphical view of the major components in the system,
and the relationships between them
• Conceptual architecture diagram communicates with various stakeholders (e.g.,
management, project managers for team/individual work assignments, developers and
customers or users)
o Provides a high-level view useful to non-technical audiences
o Summarizes the entire system for technical audiences
o i.e. Abstract enough that someone non-technical will know what’s going on BUT
also specific enough that can analyse overall arch of the system, plan and have
expectations of what we’re going to implement from a technical standpoint
• Use any appropriate UML subset (even class diagrams)
• Remember the point is capturing and conveying the information; not providing perfect UML
o Make the architecture understood
121 | P a g e
System Stakeholders and Concerns
• The following stakeholders were considered and identified:
o Users of the system
o Operators of the system
o Developers of the system
• The system concerns were considered, and the following concerns were identified for SBSCS:
122 | P a g e
• Overview: This view projects that SBSCS will achieve breakeven after five years of system
operation
• Models:
o Model ID: SCS profit statement; Version: v1.1; Model kind: cash flow statement.
Shown in figure 1
o Model ID: SCS profit statement; Version: v1.1; Model kind: cash flow statement.
Shown in figure 1
• This view shows that a typical user request will be satisfied within 20 seconds
• Model ID: Collection TLD; Version: v2.4; Model kind: Timeline diagram.
123 | P a g e
o e.g., security
o Not concerned with whether something works but rather the quality with which it
works
• Within the context of the functional requirements
o e.g., processing sales
• Examples of issues to be identified and resolved:
o How do reliability and fault-tolerance requirements affect the design?
o How do the licensing costs of purchased subcomponents affect profitability?
o How do the adaptability and configurability requirements affect the design?
124 | P a g e
The Basic Architectural Design Principles
• Low coupling (separate components are not densely linked)
o It is low coupling between applications, subsystems, or process rather than between
small objects
• High cohesion (elements within a given component are strongly related)
• Separation of concerns and localization of impact
o One could design persistence support such that each object also communicated with
a database to save its data
o The concern of persistence is then mixed in with the concern of application logic
o And same with security, etc.
▪ Cohesion drops and coupling rises
o Recommend: factor out persistence, security, …
▪ Object with application logic just has application logic
▪ Persistence subsystem focuses on the concern of persistence
▪ Security subsystem doesn't do persistence
125 | P a g e
Architecture Patterns
Architecture Centred Approach
• Place an emphasis on design
o Design pervades engineering activities
o Important aspect of Computer Science
• An incorrect interpretation of the lean documentation approach of Agile development leads
to inadequate levels of architectural design information
• Architecture Decisions are system-wide Strategic Decisions
o Use Object-Orientation
o Choose overall Architectural pattern
o Choice of API
• In waterfall, much of the design is done up front, and this can lead to brittle systems that
aren’t resilient to changes in requirements.
o It’s tempting, then to think that agile approaches require an abandonment of early
design.
o However, this is incorrect – in agile we want design done early at a high level.
▪ Object-orientation generally ensures clearer code that is easier to refactor if
necessary.
▪ Patterns help us to make systems-wide decisions that account for strategic
needs without a lot of time spent designing solutions from scratch.
▪ Clear APIs will enable developers working on separate components to work
independently.
126 | P a g e
o Software is more conceptual – there’s no clear physical representation of underlying
structures
• Software does stuff (it is active) – it can change the environment around it and even change
itself
Architectural Patterns
• An architectural pattern is a set of architectural design decisions that are applicable to a
recurring design problem, and parameterized to account for different software development
contexts in which that problem appears
• These are incorporated into the model, visualisation and view
• Architecture Model: an artefact documenting some or all of the architectural design
decisions about a system
• Architecture Visualization: a way of depicting some or all of the architectural design
decisions about a system to a stakeholder
• Architecture View: a subset of related architectural design decisions
• Styles vs Patterns
o Many people make a distinction between Patterns and Styles
▪ Styles provide a vocabulary (or language) to discuss a design
▪ Styles require less domain knowledge and have a wider range of applicability
than patterns
o Treat Styles as high-level coarse grained Patterns (this course)
127 | P a g e
Key Patterns
Model-View-Controller Pattern
• Problem: used when there are multiple ways to view and interact with data.
o Also used when the future requirements for interaction and presentation of data are
unknown.
o i.e. have an idea of what the data is but want to be able to represent the data in
different ways – separate the presentation and the interaction from sys data
• Solution: separates presentation and interaction from the system data
o The system is structured into three logical components that interact with each other
o The Model component manages the system data and associated operations on that
data
o The View component defines and manages how the data is presented to the user
o The Controller component manages user interaction (e.g., key presses, mouse clicks,
etc.) and passes these interactions to the View and the Model
• Pro: allows the data to change independently of its representation and vice versa.
o Supports presentation of the same data in different ways with changes made in one
representation shown in all of them
• Con: can involve additional code and code complexity when the data model and interactions
are simple
• View actually can link to controller (when window gets exposed etc)
• One-to-many relationship between Model and Controller, Model and View
o For a given model, can have many possible different views and ways to control that
model
• View and Controller are actually «interfaces» and so in reality need concrete classes to
realize them
128 | P a g e
o A layer provides services to the layer above it (and can receive permission from the
layer below it) so the lowest-level layers represent core services that are likely to be
used throughout the system
• Pro: allows replacement of entire layers so long as the interface is maintained.
o Redundant facilities (e.g., authentication) can be provided in each layer to increase
the dependability of the system
• Con: in practice, providing a clean separation between layers is often difficult and a high-
level layer may have to interact directly with lower-level layers rather than through the layer
immediately below it.
o Performance can be a problem because of multiple levels of interpretation of a
service request as it is processed at each layer
Repository Pattern
• Problem: you should use this pattern when you have a system in which large volumes of
information are generated that has to be stored for a long time.
o You may also use it in data-driven systems where the inclusion of data in the
repository triggers an action or tool.
• Solution: all data in a system is managed in a central repository that is accessible to all
system components.
o Components do not interact directly, only through the repository
• Pro: components can be independent—they do not need to know of the existence of other
components.
o Changes made by one component can be propagated to all components. All data can
be managed consistently (e.g., backups done at the same time) as it is all in one
place.
• Con: the repository is a single point of failure so problems in the repository affect the whole
system.
o May be inefficiencies in organizing all communication through the repository.
129 | P a g e
o Distributing the repository across several computers may be difficult (depending on
the nature of the diagram)
Repository Diagram
• Repo is central – has the sole relationship with that data source
• Clients can interact with repo – can have many clients that are implemented differently
interacting with the central repo
Client-Server Pattern
• Problem: used when data in a shared database has to be accessed from a range of locations.
o Because servers can be replicated, may also be used when the load on a system is
variable.
• Solution: in a client–server architecture, the functionality of the system is organized into
services, with each service delivered from a separate server.
o Clients are users of these services and access servers to make use of them.
• Pro: the principal advantage of this model is that servers can be distributed across a network
and servers can added or upgraded with minimal disruption.
o General functionality (e.g., a printing service) can be available to all clients and does
not need to be implemented by all.
• Con: each service is a single point of failure so susceptible to denial of service attacks or
server failure.
o Performance may be unpredictable because it depends on the network as well as
the system.
o May be management problems if servers are owned by different organizations.
Client-Server Diagram
• For a Film Library
130 | P a g e
Pipe and Filter Pattern
• Problem: commonly used in data processing applications (both batch- and transaction
based) where inputs are processed in separate stages to generate related outputs.
• Solution: the processing of the data in a system is organized so that each processing
component (filter) is discrete and carries out one type of data transformation.
o The data flows (as in a pipe) from one component to another for processing.
• Pro: easy to understand and supports transformation reuse.
o Workflow style matches the structure of many business processes.
o Evolution by adding transformations is straightforward.
o Can be implemented as either a sequential or concurrent system.
• Con: the format for data transfer has to be agreed upon between communicating
transformations.
o Each transformation must parse its input and unparse its output to the agreed form.
o This increases system overhead and may mean that it is impossible to reuse
functional transformations that use incompatible data structures
• Pipe and filters are useful for data processing – have a particular source and you’re going to
run it through filters
Key Aims
131 | P a g e
• Key aim of these patterns for design
• Cohesion - degree to which communication takes place within the module
• Coupling - degree to which communication takes place between modules
• Minimize coupling while maximizing cohesion
Low Coupling
• Coupling: a measure of how strongly one element is connected to, has knowledge of, or
relies upon other elements
• A class with high coupling depends on many other classes (libraries, tools)
• Problems because of a design with high coupling:
o Changes in related classes force local changes.
o Harder to understand in isolation; need to understand other classes
o Harder to reuse because it requires additional presence of other classes
• Problem: How to support low dependency, low change impact and increased reuse?
• Solution: Assign a responsibility so that coupling remains low
Example
• Assume we need to create a Payment instance and associate it with the Sale.
• What class should be responsible for this?
• Register is a candidate.
• Register could then send an addPayment message to Sale, passing along the new
Payment as a parameter.
• The assignment of responsibilities couples the Register class to knowledge of the
Payment class
132 | P a g e
• An alternative solution is to create Payment and associate it with the Sale
• No coupling between Register and Payment.
High Cohesion
• Cohesion: it is a measure of how strongly related and focused the responsibilities of an
element are.
• A class with low cohesion does many unrelated activities or does too much work
• Problems because of a design with low cohesion:
o Hard to understand
o Hard to reuse
o Hard to maintain
o Delicate, affected by change.
• Problem: How to keep complexity manageable?
• Solution: Assign a responsibility so that cohesion remains high.
Example
133 | P a g e
• Assume we need to create a Payment instance and associate it with Sale. What class should
be responsible for this?
• Register is a candidate
o Register may become bloated if it is assigned more and more system operations
• An alternative design delegates the Payment creation responsibility to the Sale, which
supports higher cohesion in the Register.
o This design supports high cohesion and low coupling
Non-Functional Requirements
• Low Coupling and High Cohesion are high-level aims that help us to assess architectural
options.
• But the key influencers of software architecture are the non-functional requirements.
• Performance
o Localize critical operations and minimize communications.
o Use large rather than fine-grain components.
o Allow for concurrency.
• Security
o Use a layered architecture with critical assets in the inner layers.
• Safety
o Localize safety-critical features in a small number of subsystems.
• Availability
o Include redundant components and mechanisms for fault tolerance.
134 | P a g e
o Allow replacement of components without stopping the system.
• Maintainability
o Use fine-grain, replaceable components
o Avoid global/shared data structures.
• Some recommendations will conflict with one another – you want large components for
performance – but fine-grain ones for maintainability
o Some of our decisions entail tradeoffs
Afterwards
• Documenting an architecture that has already been designed
o The aim here is to produce a complete system model that shows the different
components in a system, their interfaces and their connections.
o Easier to understand and evolve system
• If you need it:
o Use a notation with a well-defined semantics, such as UML
o Start with automated documentation for lowlevel components
• Probably not worth it unless you are producing (safety-, mission-) critical systems
Architecture Diagrams
• Simple Block Diagrams:
o Simple, informal block diagrams showing entities and relationships
o Most frequently used method
o Good for communicating at a high level of abstraction
• Diagrams with Rich Semantics
o Do not show the types of relationships between entities
o Do not show visible properties of entities (interfaces)
o Costly to produce
Model-View Controller
135 | P a g e
• Architecture for interactive applications.
o A model (or application) is created independently of the user interface
Subsystems
• Subsystems are classified into 3 different types
o Model subsystem: Responsible for application domain knowledge
o View subsystem: Responsible for displaying application domain objects to the user
o Controller subsystem: Responsible for sequence of interactions with the user and
notifying views of changes in the model.
• MVC is a special case of a repository architecture:
o Model subsystem implements the central data structure, the Controller subsystem
explicitly dictate the control flow
• The forces one to think of the application in terms of these three modules
o Model – the core of the application
▪ This maintains the state and data that the application represents
▪ When significant changes occur in the model, it updates all of its views
o Controller – the user interface presented to the user to manipulate the application
o View – the user interface which displays information about the model to the user
• This application architecture is very similar to a client/server model, except that all the
components are bundled into one application
• Consider file system with a folder (directory) view and an information (properties) view
136 | P a g e
• Sequence of events
• A model in MVC can have several views
o Two examples are the rows and columns view of a spreadsheet and the pie chart
view of some column in the same spreadsheet
Components
Model
• In MVC the model is the code that carries out some task
• It is built with no necessary concern for how it will “look and feel” when presented to the
user
• It has a purely functional interface, meaning that it has a set of public functions that can be
used to achieve all of its functionality
• Some of the functions are query methods that permit a “user” to get information about the
current state of the model
• Others are mutator methods that permit the state to be modified
• However, a model must be able to “register” views and it must be able to “notify” all of its
registered views when any of its functions cause its state to be changed.
• In Java a Model consists of one or more classes that extend the class java.util.Observable
• This superclass will provide the register/notify infrastructure needed to support a set of
views
Views
• A view provides graphical user interface (GUI) components for a model. It gets the values
that it displays by querying the model of which it is a view
• When a user manipulates a view of a model, the view informs a controller of the desired
change
• In Java the views are built of AWT or SWING components
o However, views must implement the java.util.Observer interface
Controller
• Views in MVC are associated with many controllers that update the model as necessary
when a user interacts with an associated view.
• The controller can call mutator methods of the model to get it to update its state
• Of course, then the model will notify ALL registered views that a change has been made and
so they will update what they display to the user as appropriate.
• In Java the controllers are the listeners in the Java event structure
Model Implementation
• First you write a Model that extends java.util.Observable.
• You give the class accessors to get information about its current state
• You write mutators to update the state
• Each mutator should call setChanged() and one or the other of notifyObsvers() after it has
actually changed the state
• notifyObservers will send an update message to each registered observer (View)
• There are versions of notifyObservers that let you pass additional information about the
change as well
• Each view must implement the java.util.Observer interface and hence the update method
137 | P a g e
• Second parameter will receive additional information if passed
• View implements the update method by querying the model (Observable t) for the changes
o Then makes appropriate changes to the view itself
• View registers with the Model it observes by sending addObserver
• Model remembers all views so as to notify (update) them later
o Parts of a model can be separately Observable, with own Observers
• The reason that a Model has to extend java.util.Observable is that the Observable class
provides all of the register/notify infrastructure needed by a model, so you don't have to
build any of this and can concentrate on the functionality of your application
o A model can have several views - MVC was created specifically to permit this
o Also, a view can register with several models and get updates from each of them.
• It is not necessary to build a Model so that it is a single Observable.
Simple Example
138 | P a g e
Simple GUI for Model
• We want a simple textual view of the temperature along with two buttons, one to increase
and the other to decrease the temperature by one degree.
• The user can also put a number into the text field and hit the “Enter” key.
• We can actually have two different GUIs with these properties, one for Fahrenheit and the
other for Celsius temperatures.
• It is important to note that these are separate GUIs
o Also, both are connected to the same model
• Since these two GUIs are so similar, they are built as subclasses of a general
TemperatureGUI class
• This has all of the functionality, but has no listeners for its buttons and field
• It is abstract and doesn't implement the required update method of the Observer class
• The view does not hold any information internally about the current temperature in the
model
• This way it is never “out of date”
o It always gets the temperature by querying the model
139 | P a g e
Layered Architecture
• If have multi-tiered layered archs – separate presentation and application logic, and other
areas of concern
o So if want to e.g. change UI layer – can pull it out without changing any of the
application logic
• Logical architecture organised into layers
o Layer: very coarse-grained grouping of classes (or packages or subsystems) with
cohesive responsibility for a major aspect of the system.
• Relationship between layers:
o “Higher” layers call services of “lower” layers
o Strict Layered Architecture – layer uses only layer directly below
o Relaxed – can use several lower layers
▪ Potential problems with coupling – if change the lwr layer, then could
change all the other layers interfacing with it
• Typical layers in an OO system:
o UI
o App Logic and Domain Objects
o Technical Services
▪ Application-independent, reusable across systems
140 | P a g e
Layering Scheme
Example
141 | P a g e
• Consider an “application coordination layer” whose objects represent use cases.
o Use cases will integrate with domain
o They may also hold session state
142 | P a g e
o Replacing RDBMS without major code re-write in application logic
o RDMS=Relational Database management system
o E.g. want to switch out MySQL for another dtb
• Lower layers contain more reusable functionality
Reference Architectures
• Idealized way of discussing and comparing domain-specific architectures
• They do not represent actual real systems
• Reference architecture features make them easier to describe and understand
o A reference model provides a vocabulary for comparison
o It acts as a base against which systems can be evaluated
TCP/IP Model
143 | P a g e
Harms of Layering
• Networking layering => functions of each layer are carried out completely before protocol
data unit is passed to the next layer
o Optimization of each layer has to be done separately
o Hides information that lower layers may need to optimize performance
o Layered model (TCP/IP & ISO OSI) causes conflict:
▪ Layer N may duplicate lower-level functionality (hop-h
▪ Layers may need the same information (time stamp)
▪ Layer N may need layer N-2 information (lower layer packet sizes)
• Increased layering increased complexity (via inter-layer dependencies)
o “It is always possible to agglutinate multiple separate problems into a single
complex interdependent solution. In most cases this is a bad idea.”
• Conclusion: horizontal separation may be more cost-effective and reliable than vertical
144 | P a g e
Architecture Patterns II
Client Server
145 | P a g e
Case Study – Web Requests
146 | P a g e
Repository
147 | P a g e
o Should be able to swop out any element in the data access layer – doesn’t matter to
Business Logic layer
▪ Logic layer “speaks” to interface that handles CRUD for it
• A pipeline consists of a chain of processing elements arranged so that the output of each
element is the input of the next element
• Architecture pattern often used for video streaming
• Pipe and Filter is very reusable
148 | P a g e
• E.g. have a green object – goes through a series of filters and becomes blue
o Could not become orange if it wasn’t green before, nor blue if it wasn’t orange
before
Example
149 | P a g e
What, Where and How - Example
MVC Architecture
150 | P a g e
• Have to look at pros and cons of system and see if it meets non-functional requirements
• Software architecture focuses on developing the skeleton and high-level infrastructure of
software
o Big-picture design
o Non-functional requirements exist in architecture and help make the decision for
which architecture to use
• Software design, on the other hand, concentrates on the code level design
o Class, features designed to be highly maintainable, reusable and reliable
Example
• Reliability == NNB to the client and evs
• With MVC pattern, if one view/model breaks – the others will still work
o => more robust, reliable system
• Tradeoff with complexity (for reliability)
151 | P a g e
Application Architecture Patterns
152 | P a g e
Uses
Types
153 | P a g e
Data Processing Systems
• Process user requests for information from a database or requests to update the database
• From a user perspective a transaction is: any coherent sequence of operations that satisfies
a goal
o For example - find the times of flights from London to Paris
• Users make asynchronous requests for service which are then processed by a transaction
manager
o E.g. book and pay for flights
154 | P a g e
• ATMs use this pattern
155 | P a g e
• Screen waits – there’s an event
o Processes the event
o Interprets the cmd
o Once interpreted – the output is edited and displayed
o The screen is refreshed
156 | P a g e
Example
157 | P a g e
• When an input string (source code or a program in some language) is given to a compiler,
the compiler processes it in several phases, starting from lexical analysis (scans the input and
divides it into tokens) to target code generation
• Lexical Analysis is the first phase of the compiler also known as a scanner.
o It converts the High level input program into a sequence of Tokens
• The output is a sequence of tokens that is sent to the parser for syntax analysis
• The output is a sequence of tokens that is sent to the parser for syntax analysis
• The lexical analyzer errors with the help of the automation machine and the grammar of the
given language on which it is based like C, C++, and gives row number and column number of
the error
158 | P a g e
159 | P a g e
Service Oriented Architecture
• Monolithic Architectures are coded as single apps – this gives a single Point of Failure
o Complexity of applications didn’t work well or serve industries as they grew
• Take a monolithic architecture and break it down into self-contained, smaller apps called
services
• Monolithic Architecture had server(s) with clients that connected to the servers
• Simple architectures could no longer scale large complex applications
o Distributed computing was born – break app up and put onto different services
o Web services allowed for this
o Web services (Cloud) such as REST and SOAP led to SOA
• Service Oriented Architecture: an approach for designing, developing, deploying and
maintaining software systems that are based on distributed resources (Services)
o Gives Scalability, Flexibility over time
• NB: These services can be controlled by a single owner.. OR NOT… You can make use of
predeveloped marketed paid for services as well (centralized or distributed ownership)
160 | P a g e
• SOA as an architectural pattern focusses on the building of software systems based on
loosely coupled service components that can represent business/operational procedures
Example
161 | P a g e
• Services need to be able to talk to each other
o E.g. PayPayl needs to tell delivery that payment was successfully made
o All of this is largely handled by e.g. Enterprise service bus
• Client needs to be able to connect to multiple services – thus an API gateway is necessary
o E.g. client needs to log-on to Burger-API gateway
▪ Gateway knows on the app that log-in has been clicked
o Check that you’re authenticated – sends yes to Build Burger Service
o And so the process continues until you receive your burger
Services
162 | P a g e
• Services are abstract – consumer of the service never sees the services logics
• Well defined end point – whole apps by themselves
• E.g. if create a good burger service, could then be used by multiple burger vendors
• Atomic services – just does one thing
• Composite – take burger service and have smaller services combined to deliver services
o Combo of atomic services – need to be able to talk to each other through a msging
queue
163 | P a g e
Enterprise Service Bus
• Assists in making the services interoperable and allows them to talk to each other
o Ensures that msg sent from one service is readable by another service – if data is
sent with that msg, ensures data is sent in the correct form
SOA Principles
164 | P a g e
o Services are often delivered as APIS – services need an endpoint
▪ E.g. www.cheeseburger.com/wrapburger - bold is an endpoint
• i.e. where you end up with that service and are able to accomplish
what is needed
• Interoperability: Share information across services
o Use Enterprise Service Bus and msging queues
• Composability: services combined complex
o Atomic and composite services
• Abstraction: do not compose technical details
o E.g. client only sees the whole app – not all the complexity
o One service doesn’t know what the other does – just passes the msg onto it
• Discoverability: Found and called
• Statelessness: don’t remember stuff
• Advantages:
o Reusability + Agility:
▪ E.g. can easily add another service
o Easy to maintain
o Scalability and availability
▪ Can grow app
▪ E.g. if burger site goes down, can still order drinks, etc
o Platform independence
o Platform Responsiveness to business needs
o Time to market
• Limitations:
o Complexity
o Can be hard to manage
165 | P a g e
o Performance (RTSS)
o Large upfront investments
o Single point of failure / made of utility
Microservices Architecture
REST
• REST API call – client app connects to REST API
o Does so by sending HTTP request which could be GET, POST, PUT, DELETE
o REST API talks to rest server and will return whatever info client wants – returned as
JSON usually, sometimes XML
MicroServices
• Above diagram shows tight coupling and if one layer breaks, everything breaks – not good
for scalability
• Microservices are not good for high performance systems
• With microservices one consider the app and breaks it down
166 | P a g e
• Take layered architecture and break it up
o Have presentation layer and services – services are more scaled down than SOA
because the single responsibility principle is applied
167 | P a g e
REST App API Based Technology
• Larger systems
• Corse grained single action services
• Thick user interface layer
168 | P a g e
Principles
• Advantages:
o Scalability
o Extensibility
o Service scaling
▪ E.g. if the Bun service is not getting used but the Patty Service is being used
more – can give more resources to the patty service (only – don’t have to
give more resources to all services)
o Future proofing – can add services as they’re needed
o Deployability and testability
o Reusability* - not what the aim of microservices is though
o Prominent for cloud
o Fault tolerance
• Limitations:
o Additional developer workload (service contract)
▪ E.g. takes longer to setup
o Higher Latency and slower request handing (not for speed)
▪ Don’t use if performance is an important factor
169 | P a g e
o Monitoring and Transaction can be difficult to manage
o Testing at application -level integration testing
170 | P a g e
Software Maintenance
• Software maintenance is the process of changing, modifying, and updating software to keep
up with customer needs
• Software maintenance takes place after the product has launched for several reasons
including improving the software overall, correcting issues or bugs, to boost performance
• Software maintenance is a crucial part of remaining competitive and relevant
• Preventative software maintenance is looking into the future so that your software can keep
working as desired for as long as possible
o This includes making necessary changes, upgrades, adaptations and more
• Corrective software maintenance is the typical, classic form
o Maintenance is necessary when something goes wrong in a piece of software
including faults and errors
171 | P a g e
• As with any product on the market, once the software is released to the public, new issues
and ideas come to the surface
o Users may see the need for new features or requirements that they would like to
see in the software to make it the best tool available for their needs
• Adaptive software maintenance has to do with the changing technologies as well as policies
and rules regarding your software
o These include operating system changes, cloud storage, hardware, etc
172 | P a g e
Continuous Integration / Continuous Deployment
• The Plan phase often combines practices from Scrum and Agile to enable frequent micro-
incremental releases.
• The Code phase focuses on core development tasks from within IDEs and appropriate
sandboxing and frameworks
• The Build phase rapidly and incrementally merges code commits with some testing and
security validation
• The Test phase focuses on automated verification of enhancements, often incorporating
test-driven deployment practices
• The Release phase is centered around repository commits and adequate documentation of
the changes
• The Deploy phase is the actual update to the codebase, with special thought given to issue
and error avoidance
• The Operate phase occurs once the code is made live, and consists of monitoring and
orchestration
• The Monitor & Optimize(Measure) phase takes place parallel to the Operate phase and
consists of data collection, analysis, and feedback to the start of the pipeline and to other
phases as needed
173 | P a g e
DevOps
174 | P a g e
175 | P a g e
Software Security
Secure Software Development Lifecycle
176 | P a g e
• Risk Assessment – identifying risks from requirements
o E.g. Login = access to only allowed data
• Threat Modelling and Design Review – functional requirements state what should happen,
thread modelling state what should NOT happen
• Static Analysis – static security testing is done on the application – checks for secure coding
guidelines
• Security Testing and Code Review – automated Security testing
• Security Asessment and Secure Configuration – continuously patching code and looking for
zero days
Defensive Development
10 Best Coding Practices
• Defensive programming is when a programmer anticipates problems and writes code to deal
with them.
• Validate input: Validate input from all untrusted data sources
• Heed compiler warnings: Compile code using the highest warning level available for your
compiler and eliminate warnings by modifying the code
• Architect and design for security policies: Create a software architecture and design your
software to implement and enforce security policies.
o For example, if your system requires different privileges at different times, consider
dividing the system into distinct intercommunicating subsystems
• Keep it simple: Keep the design as simple and small as possible
o Complex designs increase the likelihood that errors will be made in their
implementation, configuration, and use.
• Default deny: Base access decisions on permission rather than exclusion.
o This means that, by default, access is denied
• Adhere to the principle of least privilege: Every process should execute with the least set of
privileges necessary to complete the job.
o Any elevated permission should only be accessed for the least amount of time
required to complete the privileged task
• Sanitize data sent to other systems: Sanitize all data passed to complex subsystems such as
command shells, relational databases, and commercial off-the-shelf (COTS) components
177 | P a g e
• Practice defense in depth: Manage risk with multiple defensive strategies, so that if one
layer of defense turns out to be inadequate, another layer of defense can prevent a security
flaw from becoming an exploitable vulnerability
• Use effective quality assurance techniques: Good quality assurance techniques can be
effective in identifying and eliminating vulnerabilities.
o Fuzz testing, penetration testing, and source code audits should all be incorporated
as part of an effective quality assurance program
• Adopt a secure coding standard: Develop and/or apply a secure coding standard for your
target development language and platform
OWASP
Threat Modelling
178 | P a g e
• Threat modeling is a structured process with these objectives: identify security
requirements, pinpoint security threats and potential vulnerabilities, quantify threat and
vulnerability criticality, and prioritize remediation methods
• Threat modeling methods create these artifacts:
o An abstraction of the system
o Profiles of potential attackers, including their goals and methods
o A catalog of threats that could arise
179 | P a g e
Example of Stride Model
• The Common Vulnerability Scoring System (CVSS) captures the principal characteristics of a
vulnerability and produces a numerical severity score.
• CVSS was developed by NIST and is maintained by the Forum of Incident Response and
Security Teams (FIRST) with support and contributions from the CVSS Special Interest Group.
180 | P a g e
• The CVSS provides users a common and standardized scoring system within different cyber
and cyber-physical platforms
181 | P a g e
Open Source
• Advantages
o Speed of development & time savings
o More people fixing bugs & security flaws
o Open Standards & Standard Interfaces
▪ Enables the use of different solutions
▪ Less likely to have vendor lock
Open-Source Basics
• Basic open-source project components
o Community of software developers
o A software license
o Tools for hosting the project and communicating
o A governance model
• Open-Source Foundations
o Goal – help software developers establish opensource projects
o Have different approaches and objectives
o E.g. Apache Foundation, Linux Foundation, Mozilla foundation
182 | P a g e
Open-Source Culture
• Every good work of software starts by scratching a developer’s personal itch
• Good programmers know what to write.
o Great ones know what to rewrite (and reuse)
• Plan to throw one [version] away; you will, anyhow
• If you have the right attitude, interesting problems will find you
• When you lose interest in a program, your last duty to it is to hand it off to a competent
successor
• Treating your users as co‐developers is your least‐hassle route to rapid code improvement
and effective debugging
• Release early. Release often. And listen to your customers.
• Given a large enough beta‐tester and co‐developer base, almost every problem will be
characterized quickly and the fix obvious to someone.
• Smart data structures and dumb code works a lot better than the other way around
• If you treat your beta‐testers as if they’re your most valuable resource, they will respond by
becoming your most valuable resource
• The next best thing to having good ideas is recognizing good ideas from your users.
o Sometimes the latter is better
• Often, the most striking and innovative solutions come from realizing that your concept of
the problem was wrong.
• Perfection (in design) is achieved not when there is nothing more to add, but rather when
there is nothing more to take away.
• Any tool should be useful in the expected way, but a truly great tool lends itself to uses you
never expected
• When writing gateway software of any kind, take pains to disturb the data stream as little as
possible — and never throw away information unless the recipient forces you to!
• When your language is nowhere near Turing‐complete, syntactic sugar can be your friend
• A security system is only as secure as its secret. Beware of pseudo‐secrets
• To solve an interesting problem, start by finding a problem that is interesting to you.
• Provided the development coordinator has a communications medium at least as good as
the Internet, and knows how to lead without coercion, many heads are inevitably better
than one
Open-Source Issues
• Unrealistic expectations about the benefits of open source
o Too few active developers who volunteer their time to your project
183 | P a g e
o Open code has to be made comprehensible to strangers
o Needs a development web site and communication tools
• Barriers to entry for new developers and new users due to poor presentation and packaging.
o Need developer and user documentation
• Fallacy that little or no project management is required in open source
o Management practices used for in-house development do not work
• Management in an open source project isn't always very visible
o Active, often informal, subtle, and low-key
o Coercive techniques don't work
184 | P a g e
Open-Source Projects
What A Project Needs
• Web site
o One-way information from the project out to the public
o Interface for other project tools
• Mailing lists
o Usually most active communications forum in the project
o “medium of record”
• Real-time chat
o Quick, lightweight discussions; question/answer exchanges
• Version control
o Enables developers to manage code changes conveniently
o Enables everyone to watch what's happening to the code
• Bug tracking
o Enables developers to keep track of what they're working on, coordinate with each
other, and plan releases.
Home Page
• Project Name
• Then – a Clear Mission Statement
o Prominent short description so people can decide if they are interested in learning
more.
• State that the Project is Free and what the licensing is
Communication
• Communications Channels to humans involved with the software
o Mailing lists
185 | P a g e
o Chat rooms
o IRC channels
o Other forums for interaction with developers
• Developer Guidelines
o Social rather than technical – explain how the developers interact with each other
and with the users
o Instructions on how to report bugs and submit patches
o Some indication of how development is usually done
▪ Project is a benevolent dictatorship, a democracy, or something else (project
leadership)
o
Distribution
• Downloads
o Source code in standard formats
o Executables will come later
• The distribution mechanism should be as convenient, standard, and lowoverhead as possible
186 | P a g e
• Important to standardize build and installation procedures
o Otherwise, you discourage developers who might otherwise have contributed to the
code
o Someone visits a web site, downloads the software, tries to build it, fails, gives up
and goes away
Announcing
• Tell the world!
187 | P a g e
• Ongoing debate in the free software world about whether it is necessary to begin with
running code, or whether a project can benefit from being opened even during the
design/discussion stage.
o But: Running code is still the best foundation for success
Open-Source Practices
Dynamics Of A New Project
• Choosing a mailing list address is easy; ensuring that the list's conversations remain on-topic
and productive is another matter entirely
• Stability in a project does not come from formal policies, but from a shared, hard-to-pin-
down collective wisdom that develops over time
• This effort is aided by the fact that people generally show up expecting and looking for social
norms
Version Control
• Addresses the key area that needs managing in Open Source: coordination of developers, in
virtually every aspect of running a project:
o Inter-developer communications
o Release management
o Bug management
o Attribution and authorization of changes by particular developers
o Code stability
o Experimental development efforts
188 | P a g e
• A version control system (or revision control system) is a combination of technologies and
practices for tracking and controlling changes to a project's files:
o Source code
o Documentation
o Web pages
• People won't take the project seriously if it doesn't use version control with at least minimal
competence
• Nightly source snapshots are not fine-grained enough for development
• People need real-time access to the latest sources
o Allows team members work simultaneously on a project's source code without
stepping on each other's toes, or crunching each other's code
o Shows both users and developers that this project is making an effort to give people
what they need to participate
189 | P a g e
▪ (3) Convenience with which those users can register new bugs.
o Of these, 2 & 3 are more significant than 1.
Conclusion: FOSS4Dev
• Creating Free and Open-Source Software for Development requires the methods and skills
that we advocate.
• FOSS depends on access to source-code
o Need local Software Engineering skills to use and modify code appropriately
• Significant lock-in to proprietary software in the developing world due to a lack of skills in
exploiting FOSS
o Bridges.org: “Specific software applications that could make computers more useful
to local communities — such as putting ICT to work to improve healthcare and
education, and designed with cultural factors in mind — are still missing”
• We must address such issues and take ownership of FOSS4DEV
190 | P a g e