Workflow and .NET

What is a workflow?

A worklfow is a sequence of steps or activities. It depicts interation between humans and the systems. The flow is often depicted using a document that is passed from one step to another.


Elements in a workflow
  • Steps: These include steps such as Start,Fail,Suspend,Decision,Custom etc.
  • Document: Contains the details that are passed across various steps.
  • Document Fields: These are details contained in a document.
  • Sequence of steps: Indicates which is next step for a specific step
  • Users and Roles: Users and their roles within the workflow
  • Condition: Conditions that trigger the steps.
  • Handlers: Handle specific events

Workflow Technology in .NET

Windows Workflow Foundation is one of the important additions to the .NET 3.0 technologies. It looks promising and worth an evaluation. It is in-process, has a decent designer integrated with Visual Studio and a service interface. However, the key factors for me are Persistence mechanism, Performance and scalability, Clean interaction mechanism with web applications.

Here is the link that describes this technolgy in more details: http://msdn.microsoft.com/library/dd851337.aspx



Test Driven Development (TDD)


What is TDD?

Test Driven Development (TDD) is a software technique that relies on testing (in an automated fashion) the unit of work before implementing it.

It is based on the principle “Red-Green-Refactor

  • Red implies fail
  • Green implies pass
  • Refactor the code still ensuring that the test passes.

TDD has its roots in extreme programming. In TDD the software developer first writes a test that fails. The developer then writes the code to make the failing test pass. Finally, the code is refactored and the test is verified to ensure that it still passes.

There are quite a number of tools available for TDD. A combination of Nunit (for writing unit tests), NMock (a mocking framework) and Cruise Control.Net (for continuous integration) works well for .NET developers. The test contains assertion indicating the success or failure of the test.


Few Dos and the Don’ts for TDD

  • Write unit test only for the intended target
  • Choose a test name to clearly indicate the intention of the test
  • Write the test as fail first and not pass first i.e. write test to fail and not pass in all cases.
  • Write separate unit tests to test separate functionalities rather than reuse the existing ones.
  • Do not write unit tests that run incredibly slow. Use mocks instead of slow interfaces.
  • Avoid excessive code in setup to set the data for testing the target.
  • Avoid God Objects (overdependence on functionality that are center of the implementation)
  • Avoid over use of mock objects
  • Do not compromise on encapsulation and data hiding to achieve 100% code coverage
  • Do not use one unit test to generate data for another unit test
  • Do not make environment specific assumption.
  • Do not use logging or tracing if the test passes.


Few Useful links

http://weblogs.asp.net/scottdockendorf/archive/2004/10/06/238811.aspx

http://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspx

http://codebetter.com/blogs/darrell.norton/articles/50337.aspx

http://martinfowler.com/articles/mocksArentStubs.html

Effective software development using SCRUM


What is SCRUM?
SCRUM is an iterative incremental framework and is a perfect fit for small self organizing software teams. It is rapidly being adopted by the developer community. Below I have put a quick brief of the process based on my experience of participating in the same.

Who is involved ...
The key roles in SCRUM are:
  • Scrum Master: person responsible for maintaining the processes
  • Product Owner: person who represents the stake holders
  • The Team: typically 5-9 cross-functional persons
The stakeholders interact with the Product Owner while the team focuses on the deliverables.

The Artifacts ...
The list of all the product features (typically written in form of User Stories) are prioritized by the Product Owner and listed in the Product Backlog. During each iteration called a Sprint (of 2-4 weeks duration) a potentially shippable set of user stories from the product backlog is included in the Sprint Backlog. The selection is purely based on priority computed using business value and effort needed to implement.

A user story included in the sprint backlog is further divided into more manageable tasks. Typically a task spans 12-15 hours and a day consists of 6 hours. A publicly displayed Burndown Chart daily tracks the progress of the team during a sprint.

The Meetings ..
There are a bunch of ceremonies the team needs to participate in.
  • Sprint Planning : 6-8 hours begining of each sprint for planning and estimation
  • Sprint Review : 3-5 hours end of each sprint to review and demo the sprint deliverable
  • Sprint Retrospective : 3-5 hours end of each sprint to reflect on the completed sprint and brainstorm over the scope for improvements
  • Daily Scrum : Not more than 15 mins. during which each team member answers 3 Qs:

Q1 - What did I do yesterday?

Q2 -What will I do today?

Q3 -Is there anything in my way?

During the sprint planning meeting, the team collectively estimates the tasks using techniques such as Planning Poker. Each team member voluntarily picks up a task based on his velocity.

The Advantages ..
Significant advantages of adopting SCRUM:
  • Focuses on business value, stakeholder participation and collective ownership of the product by the team
  • Fits very well with agile practices such as pair programming, continuous integration, test driven development.
  • Effective in adapting to changing business needs.
  • The team is small, more focused and productive.
  • Stakeholders can see working software more frequently