1 Legacy Code From Feathers, Ch 2 Steve Chenoweth, RHIT Right – Your basic Legacy, from Subaru, starting at $ 20,295, 24 city, 32 highway.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

What is Unit Testing? How TDD Works? Tsvyatko Konov Telerik Corporation
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Lecture 19 Page 1 CS 111 Online Protecting Operating Systems Resources How do we use these various tools to protect actual OS resources? Memory? Files?
1 Software Engineering Lecture 11 Software Testing.
(Quickly) Testing the Tester via Path Coverage Alex Groce Oregon State University (formerly NASA/JPL Laboratory for Reliable Software)
1 Software Maintenance and Evolution CSSE 575: Session 6, Part 4 Breaking Dependencies Steve Chenoweth Office Phone: (812) Cell: (937)
1 Steve Chenoweth Tuesday, 10/04/11 Week 5, Day 2 Right – Typical tool for reading out error codes logged by your car’s computer, to help analyze its problems.
EXtreme.NET Dr. Neil Roodyn. eXtreme.NET Who is Dr. Neil? MISSION: To increase the value of your Software Business Working with software for way too long.
16/27/2015 3:38 AM6/27/2015 3:38 AM6/27/2015 3:38 AMTesting and Debugging Testing The process of verifying the software performs to the specifications.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Test Driven Development Derived from Dr. Fawcett’s notes Phil Pratt-Szeliga Fall 2009.
SEG Software Maintenance1 Software Maintenance “The modification of a software product after delivery to correct faults, to improve performance or.
By John Boal  Continuous Integration [CI] ◦ Automating the build process ◦ Build the entire system each time any new.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Test Driven Development TDD. Testing ”Testing can never demonstrate the absence of errors in software, only their presence” Edsger W. Dijkstra (but it.
Chapter 7 Designing Classes. Class Design When we are developing a piece of software, we want to design the software We don’t want to just sit down and.
Testing in Extreme Programming
‘Tirgul’ # 7 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #7.
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Software Construction Lecture 18 Software Testing.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
(1) Unit Testing and Test Planning CS2110: SW Development Methods These slides design for use in lab. They supplement more complete slides used in lecture.
Lecture 14 Page 1 CS 236 Online Race Conditions A common cause of security bugs Usually involve multiprogramming or multithreaded programs Caused by different.
The Software Development Process
Designing Classes. Software changes Software is not like a novel that is written once and then remains unchanged. Software is extended, corrected, maintained,
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Debugging COMP T1.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Lecture 7 Conditional Scripting and Importing/Exporting.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Unit Testing & Code Coverage Please download and install EclEmma (link in resources section…I recommend Option 2) Also snarf the junit code for today’s.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
Tools for Automated Testing Presented by: Žygimantas Mockus.
Why Johnny Can’t Test and Can Test-Driven Development Help: A People-Centered Analysis of Testing Orit Hazzan [Based on an invited talk at IBM, ]
1 Punishment Through Continuous Delivery If it hurts, do it more often…
Unit testing with NUnit Anne Lam & Chris James CMPS 4113 – Software Engineering April 15, 2015.
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
TDD Unit tests from a slightly different point of view Katie Dwyer.
Software Testing Kobla Setriakor Nyomi Faculty Intern (Programming II)
In the Senior Design Center
Component 1.6.
Unit Testing.
Algorithms and Problem Solving
Tracking and Squashing Bugs
How to use a camera.
Engineering and Debugging an App Chapter 15
Some Simple Definitions for Testing
In the Senior Design Center
Johanna Rothman Create Technical Excellence Chapter 9
How to use a camera.
Lecture 09:Software Testing
Continuous Delivery good & bad 4/20/2012
An Introduction to VEX IQ Programming with Modkit
In the Senior Design Center
CSE 303 Concepts and Tools for Software Development
Hold up, wait a minute, let me put some async in it
In the Senior Design Center
CS 240 – Advanced Programming Concepts
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
Test Cases, Test Suites and Test Case management systems
Refactoring Low Level/High Level.
Presentation transcript:

1 Legacy Code From Feathers, Ch 2 Steve Chenoweth, RHIT Right – Your basic Legacy, from Subaru, starting at $ 20,295, 24 city, 32 highway.

2 We’re into Feathers now Below – The new book we’ll be using for the next lectures. Above – Feathers.

3 We ended Fowler with “Big refactorings” This is where we’ll start in Feathers Fowler’s is a book to get started learning about good coding and maintenance practices. Feathers’ book is a “practitioner’s standard” book. – More advanced, “real life” – Covers a lot of special cases Q1

4 Two ways to change systems 1.Edit and proxy: The industry standard – But not good! You carefully plan the changes to make. Make sure you understand the code to change. Start making the changes. When done, run the system to see if the change was enabled. Poke around further to be sure nothing broke. Seems like “working with care,” huh! Q2

5 And… 2.Cover and modify: A better “tool set” for making changes. Work with a safety net. Put a cloak over the code. – That’s tests. – Can make very sure if changes are good or bad. – Bad changes don’t leak out. Q3

6 Need unit tests! Find out fast if things worked. Don’t wait long to see what worked. What’s the ideal “feedback time” for humans? – Ideally, testing works like a slot machine! – Long loops to hear testing results – bad. Q4

7 We want… Testing to detect changes, not Testing to attempt to show correctness. Definition of “regression testing.” Have tests around the areas you’ll be changing: A “software vice” around your changes.

8 Regression testing Needs to be “white box,” too. On everything, not just on GUI / whole app. Can’t be uncertain about what caused a failure. – “What broke the build?” We need to do this at the Unit Test level, for our refactoring. Need to add tests with every change. Q5

9 Remember unit tests from 376 A Unit Test is a piece of code (usually a method) that invokes another piece of code and checks the correctness and assumptions afterward. If the assumptions turn out to be wrong, the unit test has failed.

10 A Method of Testing

11 Why not use the current technique? This is, namely, operating the user interface to see if things still work. Problems with it: – Traceability – Running prior tests – Legacy Code

12 Properties of a good unit test It should be automated and repeatable. It should be easy to implement. Once it’s written, it should remain for future use. Anyone should be able to run it. It should run at the push of a button. It should run quickly. Q6

13 Unit Test – A better definition A unit test is an automated piece of code that invokes the method or class being tested and then checks some assumptions about the logical behavior of that method or class.

14 Adv. Of Unit Testing Frameworks Write Tests easily and in a structured manner. Execute one or all of the unit tests. Review Test Results.

15 Example Frameworks NUnit cppUnit JUnit HUnit

16 Good unit tests… Run fast. – “A unit test that takes 1/10 th of a second to run is a slow unit test.” Help us localize problems.

17 So, where to start, in making changes to legacy code? Have tests around the changes you make. – Cover the code with tests before you change it. – Write tests for the classes these methods reside in. – Some of these could be tough! – Provide dummy info, etc. Q7

18 All the unit testing problems… Are dependency problems! – Dependency is one of the most critical problems in software development. – In legacy code, we need to break dependency problems so that change is easier. Dilemma – “To change the code, you need tests in place. To put those in place, you need to change the code.” Q8

19 Breaking this one… Here’s how we’d break the dependencies in this case: Make up invoice ID’s. Use an interface instead of the IDBConnection.

20 The legacy code change algorithm 1.Identify change points 2.Find test points 3.Break dependencies 4.Write tests 5.Make changes and refactor Q9