|
1
|
- Keith Alcock
- TCS DevSig
- July 2, 2002
|
|
2
|
|
|
3
|
- Software Development of July 2002 in article called “Opening Disaster”
by Robert Martin
- The forthcoming book Principles, Patterns, and Practices of Agile
Software Development (Prentice Hall, 2002)
|
|
4
|
- Who subscribed to the magazine?
- Who has read the article?
- Who looked at the web page?
- Who has seen Smalltalk version of code?
|
|
5
|
- Apprentice: Alphonse
- Journeyman: Jerry
- Master craftsman: Mr. C.
|
|
6
|
|
|
7
|
- Assignment
- Sieve of Eratosthenes
- Unit tests
- Constraints
- Java language
- Due after lunch
- Meets standards of Mr. C.
- Preliminary results
- Complete and under schedule
|
|
8
|
- 5-minute silent code review
- Step-by-step walkthrough
- Preliminary results
- Does not meet Mr. C’s standards
- Long method identified
- Refactoring suggested
|
|
9
|
- Code reviews
- Refactoring
- Unit testing
|
|
10
|
- Overview
- Discussion
- Hands-on
|
|
11
|
|
|
12
|
- Handbook of Walkthroughs, Inspections, and Technical Reviews by Freedman
and Weinberg (Dorset House, 1990)
- Extreme Programming Explained by Kent Beck (Addison Wesley, 2000)
|
|
13
|
- Who has read either book?
- Who has done code reviews?
- Who read the handout from a previous meeting?
- Who does XP or Agile?
|
|
14
|
- “Point out needed improvements in a product of a single person or team.”
- “Confirm those parts of a product in which improvement is either not
desired or not needed.”
- “Achieve technical work of more uniform, or at least more predictable,
quality than can be achieved without reviews, in order to make technical
work more manageable.”
|
|
15
|
- Assure that more than one person has seen each part of the projects and
has a basic understanding of it
- Identify reusable components within a project or across projects
- Provide data on common mistakes that can then be used in testing
- Locate areas where code or function is duplicated
|
|
16
|
- Pretty print code to standard format
- Code should compile and run
- Reviewers must be prepared
- Identify problems and correct them in different steps
- Find good things as well as bad
|
|
17
|
- Program listing
- Checklists for common problems
- Style manuals
- Pattern guides
- Design documents
- Report forms
|
|
18
|
- Review leader
- Recorder
- Reviewers
- Author
|
|
19
|
|
|
20
|
- Refactoring by Martin Fowler (Addison Wesley, 2000)
- www.refactoring.com/
|
|
21
|
- Who has read the book?
- Who has used automated tools?
|
|
22
|
- “Refactoring (noun): a change made to the internal structure of software
to make it easier to understand and cheaper to modify without changing
its observable behavior.”
- “Refactor (verb): to restructure software by applying a series of
refactorings without changing its observable behavior.”
|
|
23
|
- Improves the design
- Simplifies the software
- Helps identify errors
- Prevents decay
|
|
24
|
- When adding functionality
- During debugging
- For code review
- To avoid the third strike
|
|
25
|
- Duplicated code
- Long method
- Long parameter list
- Comments
- Lazy class
|
|
26
|
- Extract method
- Replace magic number with symbolic constant
- Rename variable
- Introduce explanatory variable
|
|
27
|
- Refactoring browser
- Unit testing framework
|
|
28
|
|
|
29
|
- Article “Simple Smalltalk Testing: With Patterns” by Kent Beck
- www.xprogramming.com/software.htm
|
|
30
|
- Who has used SUnit or JUnit?
|
|
31
|
- For purposes of unit testing with object-oriented languages, unit most
often means a class.
- “Classes should contain their own tests.”
|
|
32
|
- Fixture
- Configured instance of class to be tested
- Test case
- Stimulus used for the test
- Check
- Code to check results of the test
- Test suite
|
|
33
|
- Pass
- No failure or error detected
- Failure
- Error
- Condition that wasn’t checked
|
|
34
|
- Write tests based on risk factor
- Tests should be fully automatic
- Tests should check their own results
- Don’t be a completionist
|
|
35
|
|
|
36
|
- A craftsman is a person who makes or manufactures (e.g., software) with
skill and careful attention to detail
- Some of the skills include knowing how to review code, refactor, and
test.
|