Comparative Development Methodologies


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Comparative Development Methodologies

  1. 1. Comparative Development Methodologies Lecture 7 XP (Tools) For the BSc IS&M Programme Dell Zhang Birkbeck , University of London
  2. 2. From Teach Yourself Extreme Programming In 24 Hours .
  3. 3. Something New <ul><li>Version Control </li></ul><ul><ul><li>Subversion ( http:// / ) </li></ul></ul><ul><ul><ul><li>TortoiseSVN ( http:// / ) </li></ul></ul></ul><ul><ul><li>Git ( http:// / ) </li></ul></ul><ul><li>Testing </li></ul><ul><ul><li>xUnit, e.g., JUnit ( http:// / ): client </li></ul></ul><ul><ul><li>Cactus ( ): server </li></ul></ul>
  4. 4. Something New <ul><li>Automated Build & Project Management </li></ul><ul><ul><li>Apache Ant ( http:// / ) </li></ul></ul><ul><ul><li>Apache Maven ( ) </li></ul></ul><ul><li>Bug-Tracking & Project Management </li></ul><ul><ul><li>Trac ( http:// / ) </li></ul></ul>
  5. 5. Something New <ul><li>Code Generation </li></ul><ul><ul><li>XDoclet ( http:// / ) </li></ul></ul><ul><li>Collaboration </li></ul><ul><ul><li>Wiki ( http:// /wiki/Wiki ) </li></ul></ul><ul><li>Development Environment </li></ul><ul><ul><li>Eclipse ( ) </li></ul></ul><ul><ul><li>jEdit ( http:// / ) </li></ul></ul>
  6. 6. Version Control <ul><li>Do you work in a team? </li></ul><ul><li>Has it ever happened that you were working on a file, and someone else was working on the same file at the same time? Did you lose your changes to that file because of that? </li></ul><ul><li>Have you ever saved a file, and then wanted to revert the changes you made? Have you ever wished you could see what a file looked like some time ago? </li></ul><ul><li>Have you ever found a bug in your project and wanted to know when that bug got into your files? </li></ul>
  7. 7. Version Control
  8. 14. <ul><li>Features </li></ul><ul><ul><li>Directory versioning </li></ul></ul><ul><ul><li>Atomic commits </li></ul></ul><ul><ul><li>Versioned metadata </li></ul></ul><ul><ul><li>Choice of network layers </li></ul></ul><ul><ul><li>Consistent data handling </li></ul></ul><ul><ul><li>Efficient branching and tagging </li></ul></ul><ul><ul><li>Hackability </li></ul></ul>
  9. 18. xUnit <ul><li>The xUnit testing framework is a simple, easy-to-use unit testing tool. </li></ul><ul><li>T here are many versions of the framework, depending on language . </li></ul><ul><ul><li>JUnit for Java, </li></ul></ul><ul><ul><li>CppUnit for C++ </li></ul></ul><ul><ul><li>PyUnit for Python </li></ul></ul><ul><ul><li>VBUnit for Visual Basic </li></ul></ul><ul><ul><li>…… </li></ul></ul>
  10. 19. Recall: Test Driven Development <ul><li>If it's worth building, it's worth testing. </li></ul>TDD lifecycle
  11. 20. JUnit <ul><li>Architecture </li></ul>
  12. 21. JUnit <ul><li>Packages </li></ul><ul><ul><li>import org.junit.Test </li></ul></ul><ul><ul><li>import static org.junit.Assert.* </li></ul></ul><ul><ul><li>…… </li></ul></ul>
  13. 22. JUnit <ul><li>Simple Test Case </li></ul><ul><ul><li>Annotate a method with @Test </li></ul></ul><ul><ul><li>C heck values with assertions </li></ul></ul><ul><ul><ul><li>assertEquals </li></ul></ul></ul><ul><ul><ul><li>assertTrue ; assertFalse </li></ul></ul></ul><ul><ul><ul><li>assertSame; assertNotSame </li></ul></ul></ul><ul><ul><ul><li>assertNull; assertNotNull </li></ul></ul></ul><ul><ul><ul><li>fail; … </li></ul></ul></ul>http://
  14. 24. JUnit <ul><li>Fixture </li></ul><ul><ul><li>Tests need to run against the background of a known set of objects which is called a test fixture. </li></ul></ul><ul><ul><li>Often, you will be able to use the same fixture for several different tests. </li></ul></ul><ul><ul><li>Each case will send slightly different messages or parameters to the fixture and will check for different results. </li></ul></ul>
  15. 25. JUnit <ul><li>Initialization/Releasing for Common Fixture </li></ul><ul><ul><li>Run before and after each test </li></ul></ul><ul><ul><ul><li>@Before </li></ul></ul></ul><ul><ul><ul><li>@After </li></ul></ul></ul><ul><ul><li>Run before and after all tests </li></ul></ul><ul><ul><ul><li>@BeforeClass </li></ul></ul></ul><ul><ul><ul><li>@AfterClass </li></ul></ul></ul>
  16. 26. JUnit <ul><li>New Testing Methods in JUnit4 </li></ul><ul><ul><li>Test for exceptions </li></ul></ul><ul><ul><ul><li>@Test(expected = Exception.class) </li></ul></ul></ul><ul><ul><li>Test for performance </li></ul></ul><ul><ul><ul><li>@Test(timeout = 500) </li></ul></ul></ul>
  17. 28. JUnit <ul><li>Test Runners </li></ul><ul><ul><li>The test runner will use reflection to ascertain test names at runtime, and then execute your tests. </li></ul></ul><ul><ul><li>JUnit4 only comes with a textual TestRunner. </li></ul></ul><ul><ul><ul><li>, ...);  </li></ul></ul></ul><ul><ul><li>For graphical interface, </li></ul></ul><ul><ul><ul><li>Use an IDE that supports JUnit4. </li></ul></ul></ul>
  18. 29. JUnit Plugin for Eclipse
  19. 30. JUnit <ul><li>Failure vs. Errors </li></ul><ul><ul><li>F ailure s are anticipated and checked for with assertions . </li></ul></ul><ul><ul><li>Errors are unanticipated problems . </li></ul></ul>
  20. 31. Ant <ul><li>Ant is a n automated build tool </li></ul><ul><ul><li>Java-based </li></ul></ul><ul><ul><li>Open Source </li></ul></ul><ul><ul><li>An Apache project </li></ul></ul><ul><ul><li>Driven by an XML format build file </li></ul></ul><ul><ul><li>L ike make , but without make 's wrinkles </li></ul></ul><ul><ul><li>Comes with Eclipse </li></ul></ul>
  21. 32. Ant <ul><li>Build Process </li></ul><ul><ul><li>Get latest source code </li></ul></ul><ul><ul><li>Clean target folders </li></ul></ul><ul><ul><li>Create new target folders </li></ul></ul><ul><ul><li>Compile and link source </li></ul></ul><ul><ul><li>Run unit tests </li></ul></ul><ul><ul><li>Deploy to staging </li></ul></ul>
  22. 33. Ant <ul><li>Build File – Layout </li></ul>
  23. 34. Ant <ul><li>Build File – Tags </li></ul><ul><ul><li>Project </li></ul></ul><ul><ul><ul><li>The top-level tag in the build file that describes the project itself. </li></ul></ul></ul><ul><ul><li>Target </li></ul></ul><ul><ul><ul><li>A target defines a collection of Ant tasks. </li></ul></ul></ul><ul><ul><ul><li>A target can depend on other targets. </li></ul></ul></ul><ul><ul><ul><li>A target also has the capability to perform its execution if (or unless) a property has been set. </li></ul></ul></ul>
  24. 35. Ant <ul><li>Build File – Tags </li></ul><ul><ul><li>Task </li></ul></ul><ul><ul><ul><li>A task is a piece of code that can be executed. </li></ul></ul></ul><ul><ul><ul><li>A task can have multiple attributes or arguments. </li></ul></ul></ul><ul><ul><ul><ul><li>The value of an attribute might contain references to a property. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>These references will be resolved before the task is executed. </li></ul></ul></ul></ul><ul><ul><ul><li>There is a set of built-in tasks, along with a number of optional tasks; it's also very easy to write your own. </li></ul></ul></ul>
  25. 36. Ant <ul><li>Build File – Tags </li></ul><ul><ul><li>Task ( ) </li></ul></ul><ul><ul><ul><li>Archive; Audit/Coverage; Compile; Deployment; Documentation; EJB; Execution; File; Java2 Extensions; Logging; Mail; Miscellaneous; .NET; Pre-process; Property; Remote; SCM; Testing; Visual Age for Java … </li></ul></ul></ul>
  26. 37. Ant <ul><li>Build File – Tags </li></ul><ul><ul><li>Property </li></ul></ul><ul><ul><ul><li>A project can have a set of properties. </li></ul></ul></ul><ul><ul><ul><li>A property has a name and a value. </li></ul></ul></ul><ul><ul><ul><li>Properties can be used in the value of tag attributes. </li></ul></ul></ul><ul><ul><ul><ul><li>This is done by placing the property name between &quot;${&quot; and &quot;}&quot; in the attribute value, e.g. ${builddir}. </li></ul></ul></ul></ul><ul><ul><ul><li>In addition to properties defined in the build file, Ant also provides access to all system properties and some built-in properties. </li></ul></ul></ul>
  27. 38. Ant <ul><li>Build File – Example </li></ul>
  28. 39. Ant
  29. 40. Ant <ul><li>Integrating Unit Tests and Build </li></ul><ul><ul><li>Setting u p the Test Data with Ant </li></ul></ul><ul><ul><ul><li>Ant can be used to directly execute SQL commands onto any database that supports ODBC (via JDBC ) . </li></ul></ul></ul><ul><ul><li>Running JUnit Test s from Ant </li></ul></ul><ul><ul><li>Using Ant to Email Test Reports </li></ul></ul>
  30. 42. Take Home Messages <ul><li>Subversion </li></ul><ul><ul><li>Version Control Tool </li></ul></ul><ul><ul><li>http:// / </li></ul></ul><ul><li>JUnit </li></ul><ul><ul><li>Unit Testing Tool </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>Ant </li></ul><ul><ul><li>Automated Build Tool (and Much More) </li></ul></ul><ul><ul><li> </li></ul></ul>