• Save
Agile Open 2009   Tdd And Architecture Influences
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Agile Open 2009 Tdd And Architecture Influences

on

  • 1,696 views

This material was presented at Buenos Aires Agile Open 2009

This material was presented at Buenos Aires Agile Open 2009

Statistics

Views

Total Views
1,696
Views on SlideShare
1,694
Embed Views
2

Actions

Likes
3
Downloads
0
Comments
0

2 Embeds 2

http://www.slideshare.net 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Agile Open 2009 Tdd And Architecture Influences Presentation Transcript

  • 1. TDD and Architectural influences
      • Ing. Gustavo A. Brey
  • 2. Agenda
      • Audience and Goal
      • TDD Introduction
      • Non Functional Requirements Impact
      • Architectural Decisions
      • Why People complain about TDD?
      • Feedback
  • 3. Audience and Goal
    • This presentation is intended for IT Application Architects that are on one of the following situation:
      • Already implemented TDD on their projects but it is still difficult to have enough code coverage or the productivity had decrease because the Architecture is not supporting TDD correctly.
      • Architecture is being designed, during first iterations or plan phase and you want to make sure that TDD will be supported by the Architecture and it will help to address some non runtime NFR.
    • IT Architects have to enable NFR, but it is not the only responsible to achieve them.
  • 4. TDD Introduction
    • Some facts before start regarding TDD:
    • TDD involves:
      • Unit Test
      • Test Automation
      • Test First
      • Iterative approach along with refactoring
    • TDD is a Detailed Design and Code technique and it is mainly targeted for Application Developers/IT Specialist
    • TDD increases code quality , therefore it facilitates software changes
    • TDD reduces defects and allows constant regression testing
    • Dependency Management is the hardest part of TDD
  • 5. Non Functional Requirements Impacted
    • Qualities
        • Maintainability
        • Extensibility / Modifiability
        • Reliability
    • Constrains
        • Geographic (including Localization)‏
        • Time
  • 6. Architectural Decisions
    • Specific Tactics and Architectural Design Principles
      • Principles are fundamental to make decisions related to the design and construction of the architected system.
      • Tactics aim to achieve one or more NFT
    • Architectural Styles
      • An architectural pattern in software, also known as an architectural style, is analogous to an architectural style in buildings, such as Gothic or Greek Revival or Queen Anne. It consists of a few key features and rules for combining them so that architectural integrity is preserved
  • 7. Specific Tactics and Architectural Design Principles
    • Separation of concerns
      • This principle is also propagated to TDD Code, handle better the complexity
      • Allows code reuse between test and is key helping defining the behavior of Mock and Fake Objects
    • Separation of interface and implementation
      • Allows works in parallel letting you implement your own Mock and Fake objects from different Modules/Components giving a Test environment to test functional code (SUT).
    • Design by contract
      • There is some sort of overlap here, but depending on the platform or language that the application is being written. However, from an architectural point of view both techniques are complementary.
    • Information hiding
      • As well as SoC, it gives a better environment to work with module dependencies.
    • Prevent Ripple Effects
      • Restrict communication paths and Use an intermediary
  • 8. Architectural Styles and Strategic Design
    • Inversion of Control and Dependency Injection
    • Hierarchical Layers
    • Transaction Scripts or Service Oriented
    • Domain Driven Design
  • 9. Inversion of Control (IoC) and Dependency Injection (DI)‏
    • Few words about IoC and DI:
      • It is a simple and smart way of handling dependencies , it has been replacing de facto Singleton Service Locator (Anti Pattern)‏
      • A third party entity (i.e. container) inject all objects/module dependencies base on an input that can be a DSL like XML Config File, Annotations or simple Java Code (or groovy)‏
      • It relies on Separation of Concerns and Separation of interface and implementation design principles.
    • Ok with IoC and DI, but what about TDD integration?
    • You can wire all object/service dependencies for the test case that you want to run, injecting Mocks and Fakes Objects without calling real dependencies and having all the coverage needed.
    • Other architectural advantages by using IoC/DI:
    • Object Life Cycle Management
    • Support for Cross Cutting Concerns (Aspect Oriented Programming)‏
    • Less and Clean Code
  • 10. Hierarchical Layers
    • It is a well known architectural style, most Enterprise Application use this style.
    • Each layer gives services to one upper layer.
    • It is a simple Module Dependency scenario and each layer (module) can be fully tested “Mocking” only one layer.
    • There are some concerns regarding the use of Layers:
    • It is not always easy to find the correct abstraction and allocate the correct responsibility on each layer
    • The usage of layers use to cause less object oriented models
    • There are certain cases when a small change would cause a change all around the layers
    UI Business Data
  • 11. Transaction Scripts and Domain Driven Design
    • Transaction Scripts
    • The application is a set of Services with a clear interface which can be called
    • It is and works ok with parallel programming. Simple!
    • Each service is Stateless
    • It is difficult to reuse and scale in terms of functionalities (like structured programming/call & return)‏
    • While building a Service, it can be isolated (using DI) from other Services, so with all dependencies mocked TDD is easy.
    • Domain Driven Design
    • The focus of this Methodology & Architectural Style is on the Domain
    • Architecture should not be intrusive
    • Extreme the usage of Object Oriented (stateful) or Business Modeling, so it is easy and simple to reuse and scale in functionality.
    • DDD fits perfect with TDD, Agile and Iterative Methodologies, maximizing the use of Objects, DI and Refactoring. Definitively for complex domains
  • 12. Why People complain about TDD?
    • Project Managers
      • It takes too much time to write the tests. Impacts productivity.
      • I feel guilty about putting testers and QA staff out of work
    • Architects
      • I don’t care about TDD, it is just low level stuff and it doesn’t impact the architecture
      • There’s no need to test drive the code, because the design handed to me by the architect covers every possibility
    • Application Developers
      • It takes too long to run the tests
      • It's not my job to test my code
      • I don't really know how the code is supposed to behave so I can't test it
      • But it compiles!
      • I'm being paid to write code, not to write tests
      • Dependency is complex to handle
  • 13. Conclusion
    • “ Every copy of a program should include some small test cases that can be routinely used to reassure the user that he has a faithful copy, accurately loaded into the machine. Then one needs more thorough test cases, which are normally run only after a program is modified. These fall into three parts of the input data domain:
      • Mainline cases that test the program's chief functions for common encountered data.
      • Barely legitimate cases that probe the edge of the input data domain, ensuring that largest possible values, smallest possible values, and all kinds of valid exceptions work.
      • Barely illegitimate cases that probe the domain boundary from the other side, ensuring that invalid inputs raise proper diagnostic messages.”
    • Fred Brooks, The Mythical Man Month, 1975
  • 14. Resources
    • Pragmatic Unit Testing in Java with JUnit
      • By Andy Hunt and Dave Thomas. Publisher : The Pragmatic Bookshelf. Pub Date : September 2003. ISBN : 0-9745140-1-2
    • Test-Driven Development: A Practical Guide
      • By David Astels. Publisher : Prentice Hall PTR. Pub Date : July 02, 2003. ISBN : 0-13-101649-0
    • Working Effectively with Legacy Code
      • By Michael C. Feathers. Publisher : Prentice Hall PTR. Pub Date : September 22, 2004. ISBN : 0-13-117705-2
    • Software Architecture in Practice, Second Edition
      • By Len Bass, Paul Clements, Rick Kazman. Addison Wesley, 2003, ISBN 0-321-15495-9.
    • Patterns of Enterprise Application Architecture.
      • By Martin Fowler, David Rice, Matthew Foemmel, Edward Hieatt, Robert Mee, Randy Stafford. Addison Wesley, 2002, ISBN 0-321-12742-0.