Monday, February 14, 2011

Extreme Programming Ch 13-15 and Design of Future Things Ch 5

Extreme Programming
By: Ron Jeffries; Ann Anderson; Chet Hendrickson
Publisher: Addison-Wesley Professional
Pub. Date: October 16, 2000

Chapter 13 : Unit Tests

A major component of XP methodology is unit testing. XP claims that tests are needed for every class and for everything that could possibly break as prescribed by the programming pair's judgment. Furthermore, tests integrated must test out at 100% for every run. The author mentions that unit testing brings the benefits of reassurance and confidence for the programmer as well as making the development process both more complete and more correct simultaneously thereby reducing the chances of regression with the submission of new code. Another subpoint made was that the test methods name should have a connection to the code it tests.
The chapter also lists a summary of the testing steps in XP:

1) Create a test class.
2) Code a setup method to create a "scrutinizer" object.
3) Write a test.
4) Run the test.
5) Modify the model code and repeat 4-5 until the test runs successfully.
6) Release the model code and the test case. (The test cases are a permanent part of the software in XP)

The chapter ends by answering a few frequently asked questions where it was emphasized that unit testing should be quick, within reason, and simple.
Test stubs are encouraged for database related software.
Separation of processing code and GUI code is also encouraged.

Chapter 14 : Test First, by Intention

This chapter was a running example in smalltalk where a programming pair wrote some code from scratch with unit tests made alongside it. The point of the chapter was to show to code by intention rather than by lower level implementation.
Coding by intention is meant to make the code and the understanding of the code clearer by expressing what you want rather than how to get it.

Chapter 15 : Releasing Changes

Since XP tenets ascribe to collective code ownership and frequent submissions, managing release changes is addressed in this chapter. First, the author mentions that code evolves through three phases:
1) Local - Begin work
2) Release Candidate - Task finished
3) Released to Repository - 100% of tests work

To make sure that code across all teams are synchronized and development proceeds smoothly, the programming pair should use this release process:
1) Always start with all the released code.
2) Write tests that correspond to your task.
3) Run all the unit tests.
4) Fix any unit tests that are broken.
5) When all the unit tests run at 100%, make the local changes become release candidates.
6) Release candidate changes with the released code on a separate integration machine and reload the released code and check for conflicting edits.
7) Identify changes made by other programming pairs and integrate those changes with yours.
8) Run the tests on the integrated machine and get them to run at 100%
9) Release the code on the integration machine as the official version.

XP also advocates the use of code management tools to do the following:
1) Identify local changes
2) Differentiate between local changes and released code.
3) Identify who released a change, and when they released it.
4) Merge changes and the released code.
5) Revert to previously released code.

The author warns the reader to avoid trying to work on different parts of the coding project and says to just let the code's needs dictate code assignments and changes primarily because the author claims that this will slow development.

To avoid lost changes, XP recommends that to always start with all the released code and always release changes frequently. The author also mentions that unit tests that are part of the system will usually identify portions of missing code that were lost.
XP makes a final recommendation of backing up source code early and often.



The Design of Future Things

Design of Future Things
By: Donald Norman
Publisher: New York Basic Book
Pub. Date: November 2007

Chapter 5 : The Role of Automation

In this chapter,

Norman cites several needs or reasons for automation: To eliminate the dull, the dangerous, and the dirty; to simplify complex tasks, to reduce the work force, to entertain, to shift the time that the work must be done, or "just because it can be done."
Norman also cites a few examples of automation in autonomous systems and discusses their drawbacks and benefits; namely, that autonomous intelligent machines tend only to work well in well defined environments and task problems where the domain is thoroughly understood and observable. Another major drawback is that autonomous automation is unable to infer the intentions of the users or the actual state of the environment and may act incorrectly. These incorrect actions can potentially be quite pernicious and are at best, annoying, despite the availability of training or learning correction algorithms. Automation in intelligent or adaptive systems can even have the effect of training their user as much as the user can train their system. For example, the owner of the smart home found himself coming home from work earlier than usual since the home was heating up the house in preparation for his arrival.

From there, Norman introduces the reader to the alternative of intelligent machines that are designed to augment current trends and complement human behavioral patterns.
Augmentative intelligent technologies have the benefit of not being intrusive and their being entirely voluntary. Norman fails to list the drawbacks of the augmentative systems.

Discussion:

Extreme Programming:

Testing is an indispensable process for any software development process and I think XP hits the nail on the head with its recommendations, although I myself am likely to ignore their suggestions in practice mostly because most tests when written during development feel like a waste of time because they're so obvious.
Putting aside my reservations, the frequent testing I know has been proven to reduce both the time spent on a project and to improve it's quality especially in terms of the bugs reduction.

The chapter on coding by intention was wasted time and effort on their part, I think. The example was weak and their goal was relatively vague.

XPs submission and integration sounds quite thorough and probably pays in spades on large projects with many different teams. XP recommendations on specific unit testing tools was out of place given that their book is to inform on methodology rather than on technology.

Their adherence to frequent unit testing at 100 percent is very powerful in that makes the software resilient from regressive submissions to the final code and XPs recommendation to make the tests a permanent part of the system is particularly interesting from an integration testing standpoint. I'm sure that XP developed code is a joy to revisit given the presence of those tests.

Design of Future Things:

Given the array of problems that Norman has discussed in autonomous agents and his lack of criticism for augmented intelligent agents, that he much prefers less intrusive technologies, and to an extent, I'm inclined to agree.

There is a tendency with technology enthusiasts to promote autonomous intelligence and an assumption that such intelligence is naturally being more "helpful." While autonomous agents are potentially much more powerful than mere augmented intelligence, they are much less likely to cause cognitive friction with the users which is an invaluable property of good technology. After all, technology is designed to solve problems and reduce strain, psychologically or physiologically, for the users of the technology. Autonomous technology, however, tends to insert its own will or ideas into the user's awareness which can potentially be disruptive. Meanwhile augmented technology is like a good waiter: not to be seen or heard, but still serving your needs when you will it.

We already have enough conflict of will with other people and introducing computational will onto the scene won't promote peaceful society, in my mind.

No comments:

Post a Comment