An Introduction To Software Development - Bugs
-
Upload
blue-elephant-consulting -
Category
Education
-
view
90 -
download
1
Transcript of An Introduction To Software Development - Bugs
An Introduction To Software Development
Using Python
Spring Semester, 2015
Class #21:Bugs
Homework #4
• The Lakeland Hospital is doing very well thanks to the software check-in system that you've created for them. However, they are actually doing just a bit too well.
• People are starting to see the full parking lot and are assuming that they are going to have a long wait for service.
• The hospital wants to do something about this and so they've decided to purchase a billboard that can be seen from I-4.
Homework #4
• The fancy new billboard that the hospital has purchased has a single seven segment digit that can display the wait time that an arriving patient can expect.
• Each time a patient arrives at the hospital, this number needs to be incremented by one. Possible values are 0-9.
• You are going to have to create two functions in order to interface with the billboard. The digit 8 looks like this on the billboard:
-----| || | -----| || | -----
Homework #4• The program needs to process the arrival and departure of each patient documented in the
patient data file. While processing each patient, send the following output to an output file:
– Use your two new functions to initially print out a "0".
– As each new patient arrives, print out the name of the patient and the time that they arrive at.
– Update the billboard counter to indicate that the wait time has increased.
– Print out the new billboard seven segment digit value using 7 lines of output.
– Every time a patient checks out of the hospital, print out the name of the patient and the time that they are leaving.
– Update the billboard counter to indicate that the wait time has decreased.
– Print out the new billboard seven segment digit value using 7 lines of output.
• Continue until all of the patients in the input data file have checked out.
An Introduction To Software Development
Using Python
Spring Semester, 2015
Class #21:Bugs
Bugs
• It’s your code
• It’s your responsibility
• It’s your reputation
• Software development bugs are a fact of life and you need a process to fix and avoid them.
Image Credit: thegraphicsfairy.com
If You Inherit Code…
• In the world of software development it is very common to get code dumped on you that may not work correctly.
• When this happens you need to incorporate it into your existing system for handling code:– Update your bug tracking system to handle issues from new code– Organize the code that you got: source, test, docs, & place in dirs– Create a build script that can handle the new code– Place the new source code into your configuration management tool– Turn on continuous integration so new code gets tested as updated– Create more tests for new software– Create bug reports for issues as they are found
Image Credit: www.fotosearch.com
Things You Could Do With New Code, But
Shouldn’t…• Document the code
– Not making changes yet – just want it to work. Treat it like a “black box”
• Get line count of code and estimate how long it will take to fix– Don’t know what’s there and what’s missing. Line count
would be a worthless metric
• Do a security audit– You’ll probably end up changing this code and would have
to repeat this step Image Credit: cliparts101.com
What To Do When Bugs Are Discovered
• Software bugs are going to have an impact on your iteration schedule – they have to be fixed
• Talk with the team – if the bug’s impact is going to be significant (functionality / schedule) then you are going to have to talk with your customer.
• You’ll need to have an estimate as to when you can have this bug fixed.
Image Credit: www.clipartpanda.com
1st Things 1st: Make It So You Can Build Working
Code• Gain control over inherited code:
– Place it in your version control system– Write build scripts– Add continuous integration
• This will not reveal bugs in your inherited code, but it will prevent you from having problems sneak up on you.
• You are now ready to find and tackle bugs.
Image Credit: www.123rf.com
Fixing Code That You Didn’t Write
• Everything is based on customer-oriented functionality.
• You fix code to satisfy user stories.
• You only fix what is broken – where you have test cases that fail
• Tests are your safety net – tell you when you’ve fixed something and not broken anything else.
• If no test for code, then assume it’s broken.
• Functional code trumps beautiful code every time.
Image Credit: cliparts.co
First Steps
• Initially you are going to want to find out what functionality in your inherited code works.
• Do this by creating unit tests that test all of the functionality that your user stories will need.
• You’ll end up with test cases that are failing– You won’t know what it will take to fix the test cases– You won’t know if you are missing needed code
Image Credit: www.fotosearch.com
Spike Testing
• Spike Testing: doing one burst of activity, observing what you accomplish, using that to estimate how much time it will take to get everything done.
• One possible spike testing plan:– Take one week to conduct your spike test– Pick a random sample to fix from the tests that are failing– At the end of the week calculate your bug fix rate:
Bugs Fixed
5
= your daily bug fix rate
Image Credit: states.phillipmartin.info
What Will Your Spike Test Results Reveal?
• Test cases revealed how much of your code was failing. Your spike tests should reveal how long it is going to take you to fix your bugs.
• Example: 4
5
Total # bugs
How long will it take to fix all bugs?
Bug fix rate x # of bugs = # days required to fix all bugs
0.8 x (13-4) = 7 days
Bugs fixed during spike testingImage Credit: www.dreamstime.com
Do We Really Know How Long It Will Take To Fix
Our Bugs?• The answer is “no”.
• When it comes to bug fixing, we really can’t be sure how long it is going to take.
• A spike test simply gives you a more accurate estimate – not 100% accurate, may not be close.
• Spike does give you quantitative data on which to base your estimate. Boosts your confidence.
• Don’t know how bad things may be… Just deal with it.
Image Credit: www.fotosearch.com
Boost Your Bug Estimates With A Confidence Factor
• Your software development team will have a “gut feel” about how good your estimate is.
• Update your estimate with your team’s confidence score:
(Bug fix rate x # of bugs) / confidence value = # days required to fix all bugs
(0.8 x (13-4)) / 0.7 = 10 days
Image Credit: pixgood.com
It’s All About Time
• Once you know how much time it’s going to take to fix your bugs, you then have to create time to do this in your next iteration.
• This may mean that scheduled user stories are going to have to be “bumped” to a later iteration to make way for bug fixing work.
Image Credit: www.clipartpanda.com
The Ugly Truth…
• There may still be bugs in the code that you delivered.
• However, you did deliver code that worked!
• There may be inherited code that is not currently being tested by any test case.
• However, your user stories are covered by test cases.
• Real software success is all about delivering functionality, period.
Image Credit: www.clipartof.com
What We Covered Today
1. Dealing with inherited code.
2. What to do about bugs in your code.
3. Spike testing
4. Estimating bug removal efforts
Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/
What We’ll Be Covering Next Time
1. Software Development In The Real World
Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/