3. INDIVIDUALS and INTERACTIONS
over PROCESSES and TOOLS
WORKING SOFTWARE
over COMPREHENSIVE DOCUMENTATION
RESPONDING to CHANGE
over FOLLOWING a PLAN
CUSTOMER COLLABORATION
over CONTRACT NEGOTIATION
9. public class Person {
public String m_name;
public String m_street;
public String m_zip;
public String m_city;
public String m_province;
public String m_country;
public Person(String name, String country) { ... }
public Person(String name, String town, String country) { ... }
public Person(String name, String s, String z, String c, String p,
String country) { ... }
public void add(Person person) { ... }
public final List getFriends() { ... }
public double between(Person person) { ... }
public Person closestFriend() { ... }
}
Working as a team
10. public class Person {
public String m_name;
public String m_street;
public String m_zip;
public String m_city;
public String m_province;
public String m_country;
public Person(String name, String country) { ... }
public Person(String name, String town, String country) { ... }
public Person(String name, String s, String z, String c, String p,
String country) { ... }
public void add(Person person) { ... }
public final List getFriends() { ... }
public double between(Person person) { ... }
public Person closestFriend() { ... }
}
Working as a team
11. public class Person {
public String m_name;
public String m_street;
public String m_zip;
public String m_city;
public String m_province;
public String m_country;
public Person(String name, String country) { ... }
public Person(String name, String town, String country) { ... }
public Person(String name, String s, String z, String c, String p,
String country) { ... }
public void add(Person person) { ... }
public final List getFriends() { ... }
public double between(Person person) { ... }
public Person closestFriend() { ... }
}
Working as a team
12. public class Person {
public String m_name;
public String m_street;
public String m_zip;
public String m_city;
public String m_province;
public String m_country;
public Person(String name, String country) { ... }
public Person(String name, String town, String country) { ... }
public Person(String name, String s, String z, String c, String p,
String country) { ... }
public void add(Person person) { ... }
public final List getFriends() { ... }
public double between(Person person) { ... }
public Person closestFriend() { ... }
}
Working as a team
14. public class Person {
public String name;
public Address address;
public Person(String name, Address address) { ... }
public void addFriend(Person person) { ... }
public List<Person> getFriends() { ... }
/**
* Find the friend who lives closest.
*
* @return the friend who lives closest
* @throws NoSuchElementException in case this person has no friends
*/
public Person getNearestFriend() { ... }
}
Working as a team
15. public class Person {
public String name;
public Address address;
public Person(String name, Address address) { ... }
public void addFriend(Person person) { ... }
public List<Person> getFriends() { ... }
/**
* Find the friend who lives closest.
*
* @return the friend who lives closest
* @throws NoSuchElementException in case this person has no friends
*/
public Person getNearestFriend() { ... }
}
Working as a team
16. public class Person {
public String name;
public Address address;
public Person(String name, Address address) { ... }
public void addFriend(Person person) { ... }
public List<Person> getFriends() { ... }
/**
* Find the friend who lives closest.
*
* @return the friend who lives closest
* @throws NoSuchElementException in case this person has no friends
*/
public Person getNearestFriend() { ... }
}
Working as a team
18. public class Address {
public Address(String country) { ... }
public Address(String city, String country) { ... }
public Address(String street, String zipCode, String city, String state,
String country) { ... }
public String getStreet() { ... }
public String getZip() { ... }
public String getCity() { ... }
public String getState() { ... }
public String getCountry() { ... }
!
public Point getGeographicalLocation() { ... }
!
/**
* Calculate the distance in kilometers to another address.
*
* @param anotherAddress the other address to calculate the distance to
* @return the distance in kilometers between this address and the other
* address
* @throws IllegalArgumentException when location of either address is
* unknown
*/
public double distanceTo(Address anotherAddress) { ... }
}
Building the right thing
19. public class Address {
public Address(String country) { ... }
public Address(String city, String country) { ... }
public Address(String street, String zipCode, String city, String state,
String country) { ... }
public String getStreet() { ... }
public String getZip() { ... }
public String getCity() { ... }
public String getState() { ... }
public String getCountry() { ... }
!
public Point getGeographicalLocation() { ... }
!
/**
* Calculate the distance in kilometers to another address.
*
* @param anotherAddress the other address to calculate the distance to
* @return the distance in kilometers between this address and the other
* address
* @throws IllegalArgumentException when location of either address is
* unknown
*/
public double distanceTo(Address anotherAddress) { ... }
}
Building the right thing
20. public class Address {
public Address(String country) { ... }
public Address(String city, String country) { ... }
public Address(String street, String zipCode, String city, String state,
String country) { ... }
public String getStreet() { ... }
public String getZip() { ... }
public String getCity() { ... }
public String getState() { ... }
public String getCountry() { ... }
!
public Point getGeographicalLocation() { ... }
!
/**
* Calculate the distance in kilometers to another address.
*
* @param anotherAddress the other address to calculate the distance to
* @return the distance in kilometers between this address and the other
* address
* @throws IllegalArgumentException when location of either address is
* unknown
*/
public double distanceTo(Address anotherAddress) { ... }
}
Building the right thing
21. public class Address {
public Address(String country) { ... }
public Address(String city, String country) { ... }
public Address(String street, String zipCode, String city, String state,
String country) { ... }
public String getStreet() { ... }
public String getZip() { ... }
public String getCity() { ... }
public String getState() { ... }
public String getCountry() { ... }
!
public Point getGeographicalLocation() { ... }
!
/**
* Calculate the distance in kilometers to another address.
*
* @param anotherAddress the other address to calculate the distance to
* @return the distance in kilometers between this address and the other
* address
* @throws IllegalArgumentException when location of either address is
* unknown
*/
public double distanceTo(Address anotherAddress) { ... }
}
Building the right thing
23. public class Address {
...
public static void setAddressLocator(AddressLocator locator) { ... }
...
}
!
!
public class AddressTest {
public AddressLocator createMockLocatorWithPolandCentreOfTheUniverse() {
... }
!
@Test
public void testDistanceTo() {
Address.setAddressLocator(
createMockLocatorWithPolandCentreOfTheUniverse());
Address polishAddress = new Address("Poland");
assertEquals(1000, polishAddress.distanceTo(new Address("Canada")));
}
}
Building the right thing
24. Working as a team
Building the right thing
Building it right