Professional Documents
Culture Documents
Software-as-a-Service
Junfeng Yang
2
Ranking Top 200 Jobs (2012)
4
Poor President Obama…
95.1%
42.9%
6
Software as a Service (SaaS) and
Service-Oriented Architecture (SOA)
7
What do they have in common?
8
Shrink-wrapped software
(SWS)
• client-specific binary,
frequent upgrades
– Must work w/many versions
of HW, OS, Libraries, …
– Hard to maintain
– Extensive compatibility testing per release
• Alternative: server-centric app, thin client
(SaaS)
– Search, email, commerce, social nets, video…
– Now also productivity (Google Docs/Office 365),
finance (TurboTax Online), IDEs (Codenvy)… 9
Why is SaaS > SWS?
1. No install worries about HW capability, OS
2. Data stored safely, persistently on servers
3. Easy for groups to interact with same data
4. If data is large or changed frequently,
simpler to keep 1 copy at central site
5. 1 copy of SW, single HW/OS environment
=> no compatibility hassles for developers
=> beta test new features on 1% of users
6. 1 copy => simplifies upgrades for
developers and no user upgrade requests 10
Smartphone Native Apps
(Android, iOS, …)?
+ Use HW features unavailable in HTML5
+ May be faster…or not
• Many just HTML5 apps in native “container”
+ Your brand is on user’s home screen
• Though can get this with bookmarks too
– Harder to maintain
– Upgrades now once again user’s problem
11
Software Architecture
• Can you design software so that you can
recombine independent modules to offer
many different apps without a lot of
programming?
• “[Amazon CEO Jeff Bezos] realized long
before the vast majority of Amazonians that
Amazon needs to be a platform.”
Steve Yegge, Googler, former Amazonian,
in a 2011 blog post
12
2002: Amazon shall use SOA!
1. “All teams will henceforth expose their data and
functionality through service interfaces.”
2. “Teams must communicate with each other
through these interfaces.”
3. “There will be no other form of interprocess
communication allowed: no direct linking, no
direct reads of another team's data store, no
shared-memory model, no back-doors
whatsoever. The only communication allowed is
via service interface calls over the network.”
13
CEO: Amazon shall use SOA!
4. “It doesn't matter what [API protocol] technology
you use.”
5. “Service interfaces, without exception, must be
designed from the ground up to be
externalizable. That is to say, the team must plan
and design to be able to expose the interface to
developers in the outside world. No exceptions.”
6. “Anyone who doesn't do this will be fired.”
7. “Thank you; have a nice day!”
14
Bookstore: Silo
• Internal subsystems
can share data reviews users orders
directly
– Review access user Review User Profile Buying
Subsystem Service Subsystem
profile
• All subsystems
inside single API Bookstore Service
(“Bookstore”)
• Subsystems user
reviews
editor
reviews
users orders
independent,
as if in separate Review
Service
User Profile
Service
Buying
Service
datacenters
– Review Service
access User Bookstore Service
Service API
• Can recombine Favorite Books
Service
to make new users
service (“Favorite
Books”) Social
Network
Service
(Figure 1.3, Engineering Software as a
Service by Armando Fox and David
Patterson, 2nd Beta edition, 2013.)
16
Cloud Computing
17
What is ideal HW for SaaS?
• Amazon, Google, Microsoft … developed
hardware systems to run SaaS
• What did they use: Mainframes?
Supercomputers?
• How can independent SW developers build
SaaS apps and compete without similar HW
investments to Amazon, Google, Microsoft?
18
Ideal hardware infrastructure
for SaaS?
• SaaS’s 3 demands on infrastructure
1. Communication
Allow customers to interact with service
2. Scalability
Fluctuations in demand during
+ new services to add users rapidly
3. Dependability
Service & communication available 24x7
19
Services on Clusters
• Clusters: Commodity computers connected
by commodity Ethernet switches
1. More scalable than conventional servers
2. Much cheaper than conventional servers
– 20X for equivalent vs. largest servers
3. Dependability via extensive redundancy
4. Few operators for 1000s servers
– Careful selection of identical HW/SW
– Virtual Machine Monitors/Containers simplify
operation 20
Warehouse Scale Computers
• Clusters grew from 1000 servers to 100,000
based on customer demand for SaaS apps
• Economies of scale pushed down cost of
largest datacenter by factors 3X to 8X
– Purchase, house, operate 100K v. 1K computers
• Traditional datacenters utilized 10% - 20%
• Earn $ offering pay-as-you-go use at less
than customer’s costs for as many
computers as customer needs
21
Utility Computing /
Public Cloud Computing
• Offers computing, storage, communication
at pennies per hour
• No premium to scale:
1000 computers @ 1 hour
= 1 computer @ 1000 hours
• Illusion of infinite scalability to cloud user
– As many computers as you can afford
• Leading examples: Amazon Web Services,
Google Cloud Platform, Microsoft Azure
– Amazon runs its own e-commerce on AWS! 22
2013 AWS Instances & Prices
Per $ Ratio Virtual Compute Memory
Instance Type Hour to small Cores Units (GiB) Storage (GB)
m1.small 1.0 1 1.0 1.7 1 x 160
$0.06
m1.medium 2.0 1 2.0 3.8 1 x 410
$0.12
m1.large 4.0 2 4.0 7.5 2 x 420
$0.24
m1.xlarge 8.0 4 8.0 15.0 4 x 420
$0.48
m3.xlarge 8.3 4 13.0 15.0 EBS
$0.50
m3.2xlarge 16.7 8 26.0 30.0 EBS
$1.00
c1.medium 2.5 2 5.0 1.7 1 x 350
$0.15
c1.xlarge 9.7 8 20.0 7.0 4 x 420
$0.58
cc2.8xlarge 40.0 32 88.0 60.5 4 x 840
$2.40
m2.xlarge 6.8 2 6.5 17.1 1 x 420 23
$0.41
Utility Computing
• 72ndin top 500 supercomputers 2012: @
~$1300 per hour
– 532 Eight Extra Large (@ $2.40/hour), 17000
cores = 240 TeraFLOPS
• FarmVille on AWS
– Prior biggest online game 5M users
– 4 days =1M; 2 months = 10M; 9 months = 75M
• IBM Watson: 90 IBM Power 750 servers
– 3.5 GHz 8 cores/server
– 90 @~$2.40/hour = ~$200/hour 24
Legacy SW vs. Beautiful SW
and Software Quality
28
Source: Government Accountability Office (GAO) report GAO-16-696T
Software Quality
• Product quality (in general): “fitness for use”
– Business value for customer and manufacturer
– Quality Assurance : processes/standards
=> high quality products & to improve quality
• Software quality:
1. Satisfies customers’ needs—easy to use, gets
correct answers, does not crash, …
2. Be easy for developer to debug and enhance
• Software QA: ensure quality and improve
processes in SW organization
29
Assurance
• Verification: Did you build the thing right?
– Did you meet the specification?
• Validation: Did you build the right thing?
– Is this what the customer wants?
– Is the specification correct?
• Hardware focus generally____________
• Software focus generally___________
• 2 options: Testing and Formal Methods
30
Assurance
• Verification: Did you build the thing right?
– Did you meet the specification?
• Validation: Did you build the right thing?
– Is this what the customer wants?
– Is the specification correct?
• Hardware focus generally Verification
• Software focus generally Validation
• Testing to Assure Software Quality
31
Exhaustive testing is infeasible
• Divide and conquer: perform different tests at
different phases of SW development
– Upper level doesn’t redo tests of lower level
• Coverage: various measurements of what % of
system is “exercised” by test suite
System or acceptance test: integrated program
meets its specifications
Integration test: interfaces between units have
consistent assumptions, communicate correctly
Module or functional test: across individual units
Unit test: single method does what was expected32
Productivity: Conciseness,
Synthesis, Reuse, and Tools
33
Productivity
• 50 years of Moore’s Law => 2X /1.5 years
HW designs get bigger
Faster processors and bigger memories
SW designs get bigger
Had to improve SW productivity
• 4 techniques
1. Clarity via conciseness
2. Synthesis
3. Reuse
4. Automation and Tools 34
Clarity via conciseness
1. Syntax: shorter and easier to read
assert_greater_than_or_equal_to(a,7)
vs. ________________
35
Clarity via conciseness
1. Syntax: shorter and easier to read
assert_greater_than_or_equal_to(a,7)
vs. a.should be ≥ 7
Time.now – 2*60*60
vs. 2.hours.ago
2. Raise the level of abstraction:
– HLL programming languages vs. assembly lang
– Automatic memory management (Java vs. C)
– Reflection, metaprogramming
36
DRY
• “Every piece of knowledge must have a
single, unambiguous, authoritative
representation within a system.”
– Andy Hunt and Dave Thomas, 1999
• Don't Repeat Yourself (DRY)
– vs. apply same repair in many places manually
• How: Refactor code to extract commonality
38
Synthesis:
Code that writes code
• Software synthesis
– BitBlt: generate code to fit situation & remove
conditional test
• Commonly used today: templating and code
generators (many examples
in Rails)
• Programming by example
– e.g. Excel 2013 Flash Fill
• Programming via Generative AI
– e.g. Github Copilot
39
Reuse vs. write new code
1. Procedures and functions
2. Standardized libraries (reuse single task)
3. Object oriented programming: reuse and
manage collections of tasks
4. Design patterns: reuse a general strategy
even if implementation varies
40
Automation and Tools
• Replace tedious manual tasks with
automation to save time, improve accuracy
– New tool can make lives better (e.g., make)
• New tool desiderata: learning curve justifies
productivity gained
• Good software developer must repeatedly
learn how to use new tools: lifetime learning
– Lots of chances in this course:
Cucumber, RSpec, …
41
Plan-and-Document processes:
Waterfall vs. Spiral vs. RUP
43
How to Avoid SW Infamy?
• Can’t we make building software as
predictable in schedule and cost and quality
as building a bridge?
• If so, what kind of development process to
make it predictable?
44
Software Engineering
• Bring engineering discipline to SW
– Term coined ~ 20 years after 1st computer
– Find SW development methods as predictable
in quality, cost, and time as civil engineering
• “Plan-and-Document”
– Before coding, project manager makes plan
– Write detailed documentation all phases of plan
– Progress measured against the plan
– Changes to project must be reflected in
documentation and possibly to plan
45
1st Development Process:
Waterfall (1970)
• 5 phases of Waterfall “lifecycle”
1.Requirements analysis
& specification
2. Architectural design
3. Implementation & Integration
4. Verification
5. Operation & Maintenance
• Complete one phase before start next one
– Why? Earlier catch bug, cheaper it is
– Extensive documentation/phase for new people 46
How well does Waterfall work?
• And the users exclaimed with a laugh and a
taunt: “It’s just what we asked for, but not
what we want.”
– Anonymous
• Often when customer sees it, wants
changes to SW product
50
Spiral
Good & Bad
• Iterations 6 to 24
• Iterations involve the
months long
customer before the
– time for customers to
product is completed change their minds!
– Reduces chances of
misunderstandings
• Lots of documentation
per iteration
• Risk management
part of lifecycle • Lots of rules to follow,
hard for whole project
• Project monitoring
easy • Cost of process is high
• Schedule & cost more • Hard to meet budget
realistic over time and schedule targets
51
Rational Unified Process (RUP)
Lifecycle (2003)
52
RUP Phases
4 Phases (can iterate) 3. Construction: codes
1. Inception: business and tests the
product, 1 st release.
case, set schedule
and budget, risk 4. Transition: move to
assessment real environment,
2. Elaboration: use get customer
cases, SW archi- acceptance
tecture, prototype
53
RUP Engineering Disciplines
6 disciplines of people over lifetime of project
1. Business Modeling
2. Requirements
3. Analysis and Design
4. Implementation
5. Test
6. Deployment
54
RUP
Good & Bad
• Tools are expensive
• Business practices
(not open source)
tied to development
process • So many options to
tailor RUP to a
• Lots of tools from
company, so not use
Rational (now IBM)
all the tools
• Tools support gradual
• Only good for medium
improvement of
to large-scale projects
project
• Manager’s call size of
iterations to make
manageable
55
P&D Project Manager
• P&D depends on Project Managers
– Write contract to win the project
– Recruit development team
– Evaluate software engineers'
performance, which sets salary
– Estimate costs, maintain schedule,
evaluate risks & overcomes them
– Document project management plan
– Gets credit for success or blamed if
projects are late or over budget
56
P&D Team Size
“Adding manpower to a late software project
makes it later.”
Fred Brooks, Jr.,
The Mythical Man-Month
• It takes time for new
people to learn project
• Communication time grows
with size, leaving less time for work
• Groups 4 to 9 people, but hierarchically
composed for larger projects 57
Development processes:
Agile
58
Alternative Process?
• How well can Plan-and-document hit the
cost, schedule, & quality target?
• P&D requires extensive documentation and
planning and depends on an experienced
manager
– Can we build software effectively without careful
planning and documentation?
– How to avoid “just hacking”?
59
How Well do Plan-and-
Document Processes Work?
• IEEE Spectrum “Software Wall of Shame”
– 31 projects lost $17B
3/~500 new
development
projects on time
and budget
60
Peres’s Law
(Figure 1.5, Engineering Long Lasting Deploy to Cloud (Ch. 12 and Ap. A)
Software by Armando Fox and David
Patterson, Beta edition, 2012.)
65
Agile Then and Now
• Controversial in 2001
– “… yet another attempt to undermine the
discipline of software engineering… nothing
more than an attempt to legitimize hacker
behavior.”
– Steven Ratkin, “Manifesto Elicits Cynicism,”
IEEE Computer, 2001
• Accepted in 2013
– 2012 study of 66 projects found majority using
Agile, even for distributed teams
66
Yes: Plan-and-Document
No: Agile (Sommerville, 2010)
1. Is specification required?
2. Are customers unavailable?
3. Is the system to be built large?
4. Is the system to be built complex (e.g., real time)?
5. Will it have a long product lifetime?*
6. Are you using poor software tools?
7. Is the project team geographically distributed?*
8. Is team part of a documentation-oriented culture?
9. Does the team have poor programming skills?
10. Is the system to be built subject to regulation?
67
Fallacies and Pitfalls, and
Chapter 1 Summary
68
Fallacies and Pitfalls
• Fallacy: The Agile lifecycle is best for
software development
– Good match for some SW, especially SaaS
– But not for NASA, code subject to regulations
• Per topic, will practice Agile way to learn but
will also see Plan & Document perspective
– Note: you will see new lifecycles in response to
new opportunities in your career, so expect to
learn new ones
69
Summary: Engineering SW is
More Than Programming