Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
COMP61511 (Fall 2017)
Software Engineering Concepts
In PracticeWeek 1
Bijan Parsia & Christos Kotselidis
< ,@manchester.ac.uk>
(bug reports welcome!)
bijan.parsiachristos.kotselidis
1 .1
Topic Overview
Software engineering is the discipline thatattempts to
produce successful software systemsby means of successful softwaredevelopment projects
We look at different topicsThe nature and challenges of complexsystemsSystem construction (coding,debugging, testing, problem definition)Professionalism and professional lifeSocial/ethical/legal issues
(We may adjust the topics as needed or desired)
1 .1
Course Goals
This aims to give students a1. a strong conceptual understanding of
software engineering2. the ability to relate that conceptual
understanding to practical applicationof that understanding
3. familiarity with the software engineeringscientific and practioner literature
sufficient to drive ongoing learning
course unit
1 .1
Course Structure
LecturesActive learning
Labs & CourseworkMake sure you understand the coursework!
ReadingsMost readings available online (in one formor another)Lectures go beyond textsTexts go beyond lecturesYou should aspire to read both books
Though you don't have to just in the 5weeks!
There will be other readings
1.1
Texts
Practitioner's text:
Steve McConnell, Code Complete: A
Practical Handbook of Software
Construction
Physical copies and available as ebook in
Researcher's text:
Andy Oram and Greg Wilson (eds), Making
software what really works, and why we
believe it
Physical copies and as
Online posts and research papers.
Safari Online
ebook
1 .1
Some Issues
The Library's e-versions are rate limitedThere's a limited number of concurrentusers.There are about 10 physical copies
Mitigations:This week == photocopies for you.You can purchase the books (esp eBookseg Kindle)
(£16.99); (£19.89)
Subscriptionservice
10 day free trial£26 a month (and can cancel)
Code Complete Making
Software
Safari Books Online
1 .1
A Note On The Texts
They are very good, but...
...software engineering is not a settled field.
Read critically and look for the most recentevidence.
(The early chapters of Making Software arehelpful for this!)
1 .1
Additional Core Text
Guide to the Software Engineering Body of
Knowledge (SWEBOK Guide)
Free .Not a textbook, but a good touchstoneabout what a pro should knowExtensive coverage and bibilography. Fairlyreadable.But a guide, not an embodiment of theBody of Knowledge
1 .1
Assessment
Coursework (50%)Each week, a mixture (not all every week)
1. MCQ quizzes2. Short essays3. Individual engineering assignments
Precise mark breakdown variesExam (50%)
Taken onlineVery like 1 & 2
1.1
Materials & Blackboard
All course materials are available
We use for
Coursework
Online forum
Use this!
Exam
onlinehttp://syllabus.cs.manchester.ac.uk/pg
Blackboard
1 .1
Variant Circumstances
Disability
Equality act definition: is any condition
which has a significant, adverse and long-
term effect on a person’s ability to carry out
normal day-to-day activities.
Exam & Study support (among other
things!)
Great, helpful people
Help available from &
Disability Advisory and Support
Service
Mitigating circumstances
SSO Counselling
service
Feel free to consult a course instructor about any
of these! We're happy to advise.
1 .1
A Note About Assistance
Early intervention is more effectiveIf you are having challenges of any sort
the sooner they are know by usthe more likely we can find a goodresolution
This is very true for mitigatingcircumstances
If something is interfering, document it!Fill out the form when the interference ishappeningThere is a "too late" here!
Again, when in doubt, ask us.
Late work is handled by the , not us.
MitCircscommittee
1 .1
Expected Conduct
We expect of you (and ourselves)To be fair mindedTo treat each other wellTo avoid academic malpracticeTo take responsibility for course dutiesTo be engaged, curious, and active
If you have a problem or issuePlease raise it with usIf that seems unhelpful, contact yourcourse tutor
1 .1
Preliminaries
1 .1
What Is Software Engineering?
The production of software systemswhether
"standalone"components of larger systems
Most software interacts withvarious forms of hardwareother software systems
directly and indirectlypeople!
Software engineering is increasingly seen as abranch of systems engineering
1 .1
What Is System Engineering?
Systems engineering is a
methodical, disciplined approach
for the design, realization,
technical management,
operations, and retirement of a
system. A “system” is a construct orcollection of different elements thattogether produce results not obtainableby the elements alone. The elements, orparts, can include people, hardware,software, facilities, policies, anddocuments; that is, all things required toproduce systemlevel results. — NASA System EngineeringHandbook
1 .1
What Is System Engineering?
a methodical, disciplined approach for thedesign,realization,technical management,operations, andretirement
of a system.
A “system” is a construct or collection ofdifferent elements that together produce results not obtainable by the elements alone.
— NASA System Engineering Handbook
1 .1
(Complex) Systems
System results are emergent and(metaphorically) nonlinear
1. The problem being tackled iscomplex,amorphous, orevolving
2. Generally there is considerableheterogeneity in the components
and how they interact3. The system design takes into account thewhole lifecycle
4. Thus the design space is very large andcomplex
1.1
One View Of The Design Space
Even if we it:super simplify
1 .1
One View Of The Design Space
It's not so :simple
1 .1
Complex Vs. Complicated
Tendentious but common view: They arediffernet
Complexity is intrinsicA fundamental feature of the problem (orsolution)Irreducible except by sacrificeA complex solution may be as simple aspossible
Complication is extrinsicAn accidental feature of our approach tothe problemLossless reduction of complicationspossibleA complicated system may beovercomplicated
Some complications might be acceptibleGetting as simple possible might not bebest
1 .1
Fred Brooks: No Silver Bullet
The complexity of software is in
essential property, not an accidentalone. Hence descriptions of a software
entity that abstract away its complexity
often abstract away its essence.
Many of the classical problems of
developing software products derived
from this essential complexity and its[super]linear increase[] with size.
1 .1
Fred Brooks: No Silver Bullet
Much of the complexity [the softwareengineer] must master is arbitrarycomplexity, forced without rhyme orreason by the many human institutionsand systems to which his interfaces mustconfirm. These differ from interface tointerface, and from time to time, notbecause of necessity but onlybecause they were designed bydifferent people
1 .1
Question Time!!
The Boeing Dreamliner requires about1. 700,000 lines of code.2. 1.7 million lines of code.3. 5.7 million lines of code.4. 6.5 million lines of code.
1 .1
Software Creep (Planes!)
Software !takes over
The avionics system in the F22 Raptor,the current U.S. Air Force frontline jetfighter, consists of about 1.7 millionlines of software code. The F35 JointStrike Fighter, scheduled to becomeoperational in 2010, will require about5.7 million lines of code to operate itsonboard systems. And Boeing’s new 787Dreamliner, scheduled to be delivered tocustomers in 2010, requires about 6.5million lines of software code tooperate its avionics and onboardsupport systems.
1 .1
Question Time!!
A premium-class automobile probablycontains
1. 100,000 lines of code.2. 1 million lines of code.3. 10 million lines of code.4. 100 million lines of code.
1 .1
Software Creep (Cars!)
Software !takes over
These are impressive amounts ofsoftware, yet if you bought a premiumclass automobile recently, ”it probablycontains close to 100 million lines ofsoftware code,” says Manfred Broy, aprofessor of informatics at TechnicalUniversity, Munich, and a leading experton software in cars. All that softwareexecutes on 70 to 100 microprocessorbased electronic control units (ECUs)networked throughout the body of yourcar.
1 .1
Software Creep (Future Cars!)
Software !takes over
Late last year, the business research firmFrost & Sullivan estimated that cars willrequire 200 million to 300 millionlines of software code in the nearfuture.
Broy estimates that more than 80percent of car innovations comefrom computer systems and thatsoftware has become the majorcontributor of value (as well as stickerprice) in cars.
1 .1
Question Time!!
Software creep occurs because1. the cost of hardware grows faster than the
cost of software.2. the capabilities of mechanical systems
grows slower than the cost of software.3. the capabilities of mechanical systems is
hard to improve relative to the capabilitiesof software.
4. software can be updated easily.
1 .1
Millions Of Lines Of Code!
Let's look at some code base sizes!
A
A
A
visualisationspreadsheetdiscussion
(Can we believe these estimates?)
(How do we interpret them?)
(Was Brooks wrong?)
(Were these slides wrong?)
1 .1
Why Software Creep (Robots!)
A suggestion why software !takes over
This linear growth of mechanics,coupled with the exponential growthof processing power [Moore's law],has led to the inevitable—the ability to
overcome poor mechanical performance
with complex but cheap (!) processing.
Instead of spending significantly more
money for better control, you invest ina better processor and morecomplex processing [i.e., software]. James Hendler, Robots for the Restof Us
1 .1
Less Complex Systems?
A(n abstract) manufacturing challenge:Producing a standardized part with
1mm tolerancesdefect rate of 1 per 10,000 items
Baking a cakeBaking hundreds of cakes?
Painting a house exteriorMailing a letter
Contrast with delivering a letter
Less complex doesn't mean easy
1 .1
Non Complex Software Systems?
Averaging problem: Write a programthat will read in integers and outputtheir average. Stop reading when thevalue 99999 is input. — Soloway
Is a program that solves the "rainfall problem"1. a complex system?2. part of a complex system?3. complicated?4. a simple system?
1.1
Lab 1
About 1hrWe'll play it a bit by ear
Lab materials are onlineLong URL:
Short URL: http://studentnet.cs.manchester.ac.uk/
bit.ly/wk1lab1
1 .1
Problem Complexity
1 .1
FizzBuzz Buzz
Most good programmers should be ableto write out on paper a program whichdoes this in a under a couple of minutes.
Want to know something scary ? – themajority of comp sci graduatescan’t. I’ve also seen selfproclaimedsenior programmers take more than 1015 minutes to write a solution.
—Imran Ghory
1 .1
FizzBuzz
But I am disturbed and appalled thatany socalled programmer would applyfor a job without being able to write thesimplest of programs. That's a slap inthe face to anyone who writes softwarefor a living.
—Jeff Atwood
Is this a good attitude?
1.1
FizzBuzz Critique
Here's a clue for you: I don't do wellin programming tasks duringinterviews, and I've love someone tocome into my comments and tell me I
can't program based on this event. No,
I've only faked it while working for Nike,
Intel, Boeing, John Hancock, Lawrence
Livermore, and through 14 or so books–
not to mention 6 years of online tech
weblogging.
— Shelley Powers
1 .1
FizzBuzz Critique 2
In fact, you'll find a lot of people whodon't necessarily do well when it comesto programming tasks or other complextesting during job interviews. Why?Because the part of your brain thatmanages complex problem solving tasksis the first that's more or less scrambledin high stress situations. The morestress, the more scrambled. Themore stressed we are, the more ournatural defensive mechanisms take over,and the less energy focused into highercognitive processes.
— Shelley Powers
1 .1
FizzBuzz Complexity
Of the question itself
What constructs does FizzBuzz require?
What kind of errors can (reasonably)
happen?
Of the use of the question
What can we conclude about a FizzBuzz
failure?
Are environmental factors significant?
Does widespread awareness of
FizzBuzz questions invalidate them?
1.1
The Rainfall Problem (Results)
—Do We Know How Difficult the Rainfall
Problem is?
1 .1
Rainfall Complexity
— The Recurring Rainfall Problem
1 .1
Rainfall Solution
def average_rainfall(input_list):
# Here is where your code should go
total = 0
count = 0
for m in input_list:
if m == -999:
break
if m >= 0:
total += m
count += 1
# ignore other negatives
avg = 0 if count == 0 else total / count
return avg
1 .1
Wat Or "Hidden Complexity"
wat
1 .1
Fred Brooks: No Silver Wat
Much of the complexity [the softwareengineer] must master is arbitrarycomplexity, forced without rhyme orreason by the many human institutionsand systems to which his interfaces mustconfirm. These differ from interface tointerface, and from time to time, notbecause of necessity but onlybecause they were designed bydifferent people
1 .1
Wat Is Everywhere!
Keep an eye out for the Wats!
1 .1
Product Qualities
1 .1
Qualities (Or "Properties")
Software has a variety of oraspects
Size, implementation language, license...User base, user satisfaction, market share...Crashingness, bugginess, performance,functions...Usability, prettiness, slickness...
Success is determined bythe success criteria
i.e., the nature and degree of desiredcharacteristics
whether the software fulfils those criteriai.e., possesses the desired characteristicsto the desired degree
characteristics
1 .1
Inducing Success
While success is determined by qualitiesthe determination isn't straightforwardthe determination isn't strict
for example, luck plays a role!it depends on how you specify the criticalsuccess factors
1 .1
Business Level Success
Consider a business goal:To increase marketshare by 25% in 2017
This is quantifiable and measurableSo, we know when we've achieved thisgoalThe goal might have been undesirable!
How do we do that?
Change the productChange the marketingChange the price
1 .1
Software Quality Landscape
20.1. Characteristics of Software Quality,Code Complete
1 .1
External Vs. Internal (Rough Thought)
External qualities:McConnell: those "that a user of thesoftware product is aware of"
Internal qualities:"non-external characterisitcs that adeveloper directly experiences whileworking on that software"
Boundary varies with the kind of user!
1 .1
External Definition
External qualities:McConnell: those "that a user of thesoftware product is aware of"This isn't quite right!
A user might be aware of theimplementation langauge
"characteristics of software that a userdirectly experiences in the normal use ofthat software"?
1.1
Internal Definition
Internal qualities:"non-external characterisitcs that adeveloper directly experiences whileworking on that software"Intuitively, "under the hood"
1.1
External: Functional Vs. Non-Functional
Functional ≈ What the software doesBehaviouralWhat does it accomplish for the userPrimary requirements
Non-functional ≈ How it does itQuality of service
There can be requirements here!Ecological features
1 .1
Key Functional: Correctness
CorrectnessFreedom fromfaults in
spec,design,implementation
Does the jobFulfills all the use cases or user stories
Implementation and design could be perfect, butif there was a spec misunderstanding, ambiguity,or change, the software will not be correct!
1 .1
External: "Qualities Of Service"
Usability — can the user make it goEfficiency — wrt time &spaceReliability — long MTBFIntegrity
Corruption/loss freeAttack resistance/secure
Robustness — behaveswell on strange input
All these contribute to the user experience(UX)!
We're going to focus on efficiency this week!
1 .1
Internal: Testability
A critical property!
Relative to a target qualityA system could be
highly testable for correctensslowly testable for efficiency
Partly determined by test infrastructure
Having great hooks for tests pointless
without testsPractically speaking
Low testability blocks knowing qualities
Test-based evidence is essential
1 .1
Quality Interactions: External
20.1, Code Complete
1 .1
The Unix Philosophy
1 .1
Design Philosophies
Design is the establishment of a plan or setof constraints on the construction of asystem (or object)
Think blueprint for a houseDesigns can occur at different levels ofdetail or abstraction
A Design Philosophy is a set of a constraintson your designs
A "design of designs"Typically the most abstract designTypically independent of any particulardomain problem
1 .1
Unix
Unix is an Operating System, set of tools, aUI/UX, and a philosophy
Developed at AT&T in the 1970sBy Ken Thompson, Dennis Ritchie, anda cast of many
Multitasking and multiuserIt has many descendents, variants, clones,and related systemsClosely related to the C programminglanguage
Historically; they developed togetherLinux, MacOS, and BSD are popular modernversions
1.1
The Unix Philosophy
One formulation by Peter H. Salus:
This is the Unix philosophy: Writeprograms that do one thing and do itwell. Write programs to work together.Write programs to handle text streams,because that is a universal interface.
Simple! (to say; tricky to master)Mostly for programmers and power usersIt got
See the 17 rules!complicated
1 .1
Small, Sharp Tools
Write programs that do one thing anddo it well.
Modularity is a key principlePrograms (should) have a single job orresponsibilityThey should focus on thatWhen you work on (or us) that tool youdon't have to think about other things
Much!Sharp
Focused, pointy...and you can cutyourself
1 .1
Working Together
Write programs to work together. Writeprograms to handle text streams,because that is a universal interface.
The principle: Programs should "worktogether"The mechanism: Consume and produce text
"a universal interface"(We need more than this!)
1 .1
Standard Streams
Unix programs (typically) have three
streams by default:
stdin: STandarD INput
This can be interactive!
stdout: STandarD Output
Printed to the shell by default
Captures the expected output of the
program
stderr: STandarD ERRor
Often printed to the shell, but
sometimes hidden
Captures error messages
Many programs require more streams than
this!
1 .1
Let's Look At Some Tools
1 .1
Word Count (Wc)
wc is a ubiquitous small toolGoes back to at least Still in active use
This will be our go to example for a while!Esp. in the lab!
1971
1 .1
Testing Correctness
Beware of bugs in the above code; Ihave only proved it correct, not triedit. — Don Knuth, Figure 6: page 5 ofclassroom note
1 .1
Really Beware Of Bugs!
—Grace Hopper's Bug Report
1 .1
Developer Testing
We can distinguish betweenTesting done by nonspecialists(McConnell: "Developer testing")
For many projects, the only sort!Testing done by (test) specialists
If you compile and run your codeThen you've done a test! (or maybe two!)
If only a "smoke" test
Testing is inescapable; good testing takeswork
1 .1
Question Time!
If you compile your codeyou have tested it for syntactic correctness.you have tested it for semantic correctness.you have tested it for both.you haven't tested it at all.
1 .1
What Is A Test?
A test case is a repeatable executionsituation of a software system thatproduces recordable outcomes. A test isa particular attempt of a test case
The outcomes may be expected (i.e.,specified in advance)
E.g., we expect passing 1+1 to a calculatorto return 2Generally boolean outcomes (pass or fail)
We might have an error that preventscompletion
The outcomes may be measurement resultsE.g., we want to find the time it takes tocompute 1+1
1 .1
What Is A Test? (2)
A test case is a repeatable executionsituation of a software system thatproduces recordable outcomes. A test isa particular attempt of a test case
The outcomes should testify to some softwarequality
E.g., correctness, but also efficiency,usability, etc.
A (single) test specifies a very particularquality
E.g., correct for a given inputE.g., uses X amount of memory for thisscenario
The fundamental challenge of testing isgeneralisability
1 .1
Generalisability Problem (1)
Testing shows the presence, not theabsence of bugs. —Edsger W. Dijkstra, Nato SoftwareEngineering Conference, pg 161969
1 .1
Terminology Note
Test and test case are often usedinterchangeably
And in other loose waysMost of the time it doesn't matter becauseeasy to distinguish
We often talk about a test suite or test setBut this also might be subordinated to atestFor example,
"We used the following test suite tostress test our application".
1 .1
Anatomy Of A Test (1)
1 .1
Generalisability Threat
A test case (A):Goal: Correctness to the specification
Input: a pair of integers, X and YOutput: the integer that is their sum
Test Input:
X=1 and Y=1Expected output:
2Test result of System S is pass
What can we conclude?
1.1
Question Time!
From the test result Pass test case A, we canconclude that:
1. System S correctly implements thespecification.
2. System S correctly implements thespecification for this input
3. Both 1 and 24. Neither 1 nor 2
1 .1
Question Time!
From the test result Fail test case A, we canconclude that:
1. System S does not correctlyimplement the specification.
2. System S does not correctlyimplement the specification for thisinput
3. Both 1 and 24. Neither 1 nor 2
1 .1
Anatomy Of A Test (2)
1 .1
Environment Matters
The next most significant subset of[Modification Requests (MRs)] werethose that concern testing (the testingenvironment and testing categories)—24.8% of the MRs. ...it is notsurprising that a significant number ofproblems are encountered in testing alarge and complex realtimesystem...First, the testingenvironment itself is a large andcomplex system that must betested. Second, as the realtime systemevolves, so must the laboratory testenvironment evolve. Making Software, pg. 459.
1 .1
A Good Test
A good test case ispart of a suite of test casesunderstandable
i.e., you can relate itto the specto the system behavior
fits in with the test environmentis (given the suite) informative
1 .1
Environment Matters
1 .1
Coursework!
There are four bits of courseworkReadings (see ) and thelab pagesA short Multiple Choice Question (MCQ)Quiz (Q1) related to (some of the) readingsA short Essay (SE1) related to a readingA programming assignment (CW1)
Q1 & SE1 are due at the start of next class(Thurs at 9:00)CW1 is due on Wed at 19:00 <-- The daybefore!!!Total of 30 points
5 for Q1 and 4 for SE120 for CW1
materials page
1 .1
Please Don't Stress!
It's not a lot of workSo if you are learning Python you shouldhave time!
It's partly for diagnosisPartial work countsWe're here to help!Don't leave before being sure you know whatyou're doing
1.1
Please Work Alone!
It's important to figure out what you can doThese are a small number of points andCW1 is fairly simpleWe are aware of differences in experienceand skillWe're here to help!We will adjust things if they seem out ofwackUse the Blackboard forum!
We will monitorDon't share code thereYou can share "high level tips"
1 .1