Beruflich Dokumente
Kultur Dokumente
Software Quality
A definition in Steve McConnell's Code Complete divides software into two pieces: internal and external quality characteristics. External quality characteristics are those parts of a product that face its users, where internal quality characteristics are those that do not.
It is the users view of the quality of the software product when it is used in a specific environment and a specific Context-Of-Use.
TDD in summary
A. First we write a test. A. Then we write code to make the test pass. A. Then we find the best possible design for what we have - refactoring (Relying on the
existing tests to keep us from breaking things while we are at it)
TDD goals
TDD is a technique for improving the softwares internal quality
Well-written code Good design A balanced division of responsibilities Without duplication (clones) Smooth evolution Maintainability
ATDD goals
Acceptance TDD helps us keep our products external quality on track by giving it the correct features and functionality. the system should meet what the customer actually need.
Then, we need to learn how to build the thing right - TDD. Also, we need to learn how to build the right thing - ATDD.
Close relationship
TDD and acceptance TDD often go hand in hand. On the system level, we run our development process with acceptance TDD; and inside the implementation step of each feature; we employ TDD.
Benefits?
No more long debugging sessions
Each test case corresponds to a feature of the system Test cases support refactoring
Benefits?
Feeling confident with my work
The better your test suite is, the better the quality of your code and the more confident you can be about any changes you make. The more confident you are about the changes you make, the more changes you dare to make. The more changes you make, the better your internal quality becomes, the easier it is to write tests for your code, and so on. (a virtuous cycle)
The term refactoring is used to better communicate that the last step is about transforming the current design toward a better design.
Refactoring Example
Replace Inheritance with Delegation
Motivation: A subclass uses only part of a superclass interface or does not want to inherit data Summary: Create a field for the superclass, adjust methods to delegate to the superclass, and remove the subclassing.
Refactoring Example
Refactoring Example
Mechanics 1. Create a field in the subclass that refers to an instance of the superclass. Initialize it to this. 2. Change each method defined in the subclass to use the delegate field. 3. Compile and test after changing each method.
Refactoring Example
Mechanics 1. Remove the subclass declaration and replace the delegate assignment with an assignment to a new object. 2. For each superclass method used by a client, add a simple delegating method. 3. Compile and test.
Low-level refactorings are the fundamental building blocks to achieving larger refactorings
Moving the responsibilities around in your code Introducing or removing an inheritance hierarchy
Acceptance TDD
Acceptance tests are indicators of the completion of a requirement or feature. When all acceptance tests for a requirement or feature are passing, you know youre done.
Advantages of ATDD
Close collaboration
Seeing concrete, working software Building trust and confidence Customer in control Evolving a shared language
FitNesse
FitNesse is a lightweight, open-source framework that makes it easy for software teams to:
Collaboratively define Acceptance tests -- web pages containing simple tables of inputs and expected outputs. Run those tests and see the results
http://fitnesse.org/