1-1 1) Software Development 2) with TDD at the end By Rick Mercer with help from these sources: Rational Unified Process Computing Fundamentals with C++,

Slides:



Advertisements
Similar presentations
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Advertisements

A little Software Engineering: Agile Software Development C Sc 335 Rick Mercer.
Agile development By Sam Chamberlain. First a bit of history..
Agile Requirements Methods CSSE 371 Software Requirements and Specification Mark Ardis, Rose-Hulman Institute October 26, 2004.
1 Software Testing and Quality Assurance Lecture 23 – JUnit Tutorial.
24-Jun-15 JUnit. 2 Test suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (running whatever tests.
Computer Engineering 203 R Smith Agile Development 1/ Agile Methods What are Agile Methods? – Extreme Programming is the best known example – SCRUM.
1 Lecture 5 Introduction to Software Engineering Overview  What is Software Engineering  Software Engineering Issues  Waterfall Model  Waterfall Model.
Chapter 9: Classes with Instance Variables or Classes=Methods+Variables Asserting Java © Rick Mercer.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
COMP 350: Object Oriented Analysis and Design Lecture 2
An Agile View of Process
Test-Driven Development “Test first, develop later!” –OCUnit.
Test Driven Development Derived from Dr. Fawcett’s notes Phil Pratt-Szeliga Fall 2009.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Chapter 3 – Agile Software Development 1Chapter 3 Agile software development.
Agile Programming Principles.
Chapter 5 Software Process Models. Problems with “Traditional” Processes 1.Focused on and oriented towards “large projects” and lengthy development time.
Object Oriented Analysis and Design Introduction.
Agile and XP Development Dan Fleck 2008 Dan Fleck 2008.
1 Advanced Computer Programming Project Management: Methodologies Copyright © Texas Education Agency, 2013.
Testing in Extreme Programming
Agile Software Development: Practices through Values C Sc 335 Rick Mercer.
Coming up: What is Agile? XP Development Dan Fleck 2010 Dan Fleck 2010.
Course Overview & Topics CSc 335: Object-Oriented Programming and Design © Rick Mercer 1.
Review: Cohesion and Coupling, Mutable, Inheritance Screen Layouts Software methodologies – Extreme Programming Object-Oriented Design – CRC Cards - UML.
Rapid software development 1. Topics covered Agile methods Extreme programming Rapid application development Software prototyping 2.
Extreme Programming (XP). Agile Software Development Paradigm Values individuals and interactions over processes and tools. Values working software over.
1-1 C Sc 335 Course Overview Object-Oriented Programming and Design Rick Mercer.
1 김 수 동 Dept. of Computer Science Soongsil University Tel Fax
First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
1 Software Development By Rick Mercer with help from these sources: Rational Unified Process Computing Fundamentals with C++, Rick Mercer Designing Object.
CS3100 Software Project Management Agile Approaches.
A tool for test-driven development
AP-1 4. Agile Processes. AP-2 Agile Processes Focus on creating a working system Different attitude on measuring progress XP Scrum.
By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development (TDD)
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
JUnit Don Braffitt Updated: 10-Jun-2011.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 1 due tomorrow, 7pm. RAD due next Friday in your Wiki. Presentations week 6. Tomorrow’s lecture.
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
1/2/12 Chapt 2 Iterative Evolutionary Agile. 1/2/12 (Rational) Unified Process A software development process – Flexible and open Other processes – XP.
Extreme Programming. Extreme Programming (XP) Formulated in 1999 by Kent Beck, Ward Cunningham and Ron Jeffries Agile software development methodology.
Agenda: Overview of Agile testing Difference between Agile and traditional Methodology Agile Development Methodologies Extreme Programming Test Driven.
Agile Development Chapter 10 - part 2. Agile Philosophy  A guiding philosophy and set of guidelines for : developing information systems in an unknown,
RATIONAL UNIFIED PROCESS PROCESS FRAMEWORK OVERVIEW.
By Manish Shrotriya CSE MS 4 Point Agile Manifesto 1.Individuals and interactions over processes and tools 2.Working software over comprehensive.
Software Development. The Software Life Cycle Encompasses all activities from initial analysis until obsolescence Analysis of problem or request Analysis.
Coming up: What is Agile? XP Development Dan Fleck 2010 Dan Fleck 2010.
Software Development Life Cycle. The Software Life Cycle  Encompasses all activities from initial analysis until end of work  Formal process for software.
Embedded Systems Software Engineering
Chapter 5 Agile Development Moonzoo Kim KAIST
Software Development.
CompSci 280 S Introduction to Software Development
Software Construction Lab 10 Unit Testing with JUnit
Don Braffitt Updated: 26-Mar-2013
Software & Software Engineering Pertemuan-4 Dosen :Kundang K Juman
About the Presentations
Introduction to Software Engineering
COMP 350: Object Oriented Analysis and Design Lecture 2
Unit testing C# classes
Teaching slides Chapter 1.
Chapt 2 Iterative Evolutionary Agile.
Coming up: What is Agile?
Refactoring.
References: Eddie Burris, Rick Mercer
Agile software development
Chapter 5: New and Emerging Process Methodologies
System Development Methods
SD5953 Successful Project Management AGILE SOFTWARE DEVELOPMENT
Presentation transcript:

1-1 1) Software Development 2) with TDD at the end By Rick Mercer with help from these sources: Rational Unified Process Computing Fundamentals with C++, Rick Mercer Designing Object Oriented Software, Rebbeca Wirfs-Brock, Wilkerson, Wiener Object-Oriented Design Heuristics, Arthur Riel

1-2 Software Challenges  Specification may be incomplete  Software product is expected to be used for for a long time  Ever more complex systems, high expectations  Requirements change  We don't know what the customer wants  The customers don't know what they want

1-3 One Approach: Waterfall  Software go through several stages called the life cycle  Waterfall model: popular way to organize activities

1-4 Waterfall Model

1-5 Waterfall Model (con.)  Waterfall has some severe problems. — The team has to be almost clairvoyant little room for error — places the high risk and difficult elements towards the end  Craig Larman's book[1] provides proof that waterfall has proved to be a terrible way to develop software.[1] — In one study, 87% of all projects failed — The waterfall process was the "single largest contributing factor for failure, being cited in 82% of the projects as the number one problem." Rick will now attempt to tell a joke [1] Agile and Iterative Development: a Manager's Guide, Addison-Wesley Professional, 2003 [1]

1-6 Iterative Software Development  An iteration deals with a small part of the system

1-7 Rational Unified Process  Practices of RUP — Develop iteratively — Manage changing requirements — Use components such as Java classes — Visually Model with UML — Continuously test  RUP allows you to select from many processes

1-8 A Process we'll use  Agile Manifesto See  Started with Scrum and XP, around 1995  Teams often choose from a set of practices  Use these Agile practices for the next project — Planning game: stories and estimation — Test Driven Development (TDD) — Short Releases — Sustainable Pace (two iterations) — Coding Style (use default preferences)

1-9 Analysis Tools we'll use or are in this ppt file  Nouns (objects) Verbs (operations)  Scenarios — what happens when…  Role Play — team members become objects and do scenarios  Candidate Object / Responsibility / Collaborator (CRC) cards — document candidate objects, assign responsibilities, consider associations between objects

1-10 Design Tool #1 we'll use Responsibility Driven Design 1. Identify candidate objects that model a system as a sensible set of abstractions 2. Determine the responsibility of each object — what an instance of the class must be able to do, — and what each instance must know about itself less important at first 3. Understand the system through role play — To help complete its responsibility, an object often needs help from other objects

1-11 Design Tool #2 we'll use Test Driven Development  TDD turns traditional development around — Write test code before the methods — Do so in very small steps — Refuse to add any code until a test exists for it  You can run the test anytime — And you should do so quite often  Design consists of writing the class, the methods, and the code

1-12 By Rick Mercer with help from Kent Beck and Scott Ambler Test Driven Development

1-13  What is TDD?  Tests as documentation  Tests as a way to verify your code works Outline

1-14 Test Driven Development (TDD) "TDD is emerging as one of the most successful developer productivity enhancing techniques to be recently discovered. The three-step: write test, write code, refactor – is a dance many of us are enjoying" — Eric Vautier, David Vydra "TDD is the Gem of Extreme Programming" — Kent Beck

1-15 TDD: What is it?  TDD turns traditional development around — Write test code before the methods — Do so in very small steps — Refuse to add any code until a test exists for it Have a failing test (red bar) before writing the code to make the test pass  You can run tests anytime — And you should do so quite often

1-16 Simple, yet hard to do  When you first try TDD, it requires great discipline because it is easy to “slip” and write methods without first writing a new test

1-17 Comments, Documentation?  Most programmers don’t read documentation — instead they prefer to work with the code.  Programmers often look for sample code that sends messages to instances of a class — Well-written unit tests can provide such a working specification of your code more docs are necessary — Unit tests effectively become a significant portion of your technical documentation

1-18 Testing Framework  An underlying assumption of TDD is that you have a unit-testing framework  Agile software developers often use the xUnit family of open source tools, such or JUnit  Without a unit-testing framework, TDD is virtually impossible.

1-19 TDD Helps Design  TDD makes you think about what you want or need before you write the code — pick class and method names — decide the needed arguments — choose return types — write the class, constructors, instance variables, and methods to make what you want work

1-20 Benefits of TDD  Benefits include — Rapid feedback — Have the interface (method name) before the algorithm — Know when you’re finished — Encapsulate learning — Change your code with confidence

1-21 Principles of TDD  You maintain an exhaustive suite of Programmer Tests  No code goes into production unless it has  associated tests  You write the tests first  The tests determine what code you need to write

1-22 Write a test plan first  Consider what needs to be tested in general  Derive specific examples — in a natural language like English rather than a formal language like Java  Think of easy cases  Think of hard cases  Try to think of crazy cases

1-23 Put it all together with an Example  An Example: Five Card Draw  Using a spec Rick has not seen before — Find the objects — Assign responsibilities — Consider a small part of the system

1-24 Candidate Objects

1-25 Poker Hand  Hopefully we found Poker Hand  What are it's responsibilities?

1-26 Collaborative Activity  Form teams of 3 (neighbors will do)  Introduce yourselves — Name, where you are from, and something interesting about where you are from  Develop at least 10 things that should be tested in a Poker hand besides those on the next slide

1-27 A few cases  Two hands have high card that are different  Two hands have high card that are same  A hand with a pair beats a high card hand  Two hands have one pair each that differ  Two hands have the same pair each where the pair is equal (compare highest cards outside pair)

1-28 Consider JUnit  A problem and JUnit will be reviewed in section this week  The next few slides have examples of JUnit assertions

1-29 A unit test with 2 test methods import static org.junit.Assert.*; import org.junit.Test; public class BankAccountTest public void testDeposit() { BankAccount anAcct = new BankAccount("Zac", ); assertEquals( , anAcct.getBalance(), 1e-12); anAcct.deposit(0.52); assertEquals( , anAcct.getBalance(), 1e-12); public void testWithdraw() { BankAccount anAcct = new BankAccount("Zac", ); assertEquals( , anAcct.getBalance(), 1e-12); anAcct.withdraw(10.52); assertEquals(990.00, anAcct.getBalance(), 1e-12); }

1-30 Annotations  Useful annotations marks a test method marks a method that executes before every test methup marks a method that executes exactly once before the test methods exextute

1-31 Assertions  Useful assertions that go into test methods public static void assertTrue(boolean condition) Asserts that a condition is true. If it isn't it throws an AssertionFailedError. public static void assertTrue(java.lang.String message, boolean condition) Asserts a condition is true. If not throw an AssertionFailedError with the message. public static void assertEquals(String message, Object expected, Object actual) Asserts that two objects are equal. If they are not an AssertionFailedError is thrown with the given message.  All other assertions of the Assert Class can be found at

1-32 If time permits: Code Demo  The Movie concept from Test-Driven Development: A Practical Guide by David Astels — "We have a Movie class which now needs to accept multiple ratings (e.g., 3 as in “3 stars out of 5”) and give access to the average"  Code to be linked on our Code Demo page