Move UserStoryMotivational to the motivational example file

Update the scrum state pattern example with description about some pitfalls of classsic implementation
This commit is contained in:
Petrutiu Mihai
2016-07-21 11:49:27 +03:00
parent 462ee43283
commit 8ced7d951b
4 changed files with 37 additions and 21 deletions

View File

@@ -24,6 +24,12 @@ namespace StatePattern.ScrumExample
}
}
public class UserStoryMotivational
{
public string Name { get; set; }
public UserStoryState State { get; set; }
}
/// <summary>
/// User story states: New, Active, Resolved, Closed, Removed
/// Actions on user stories:

View File

@@ -9,6 +9,7 @@ namespace StatePattern.ScrumExample
{
public static void Run()
{
UserStory userStory = new UserStory();
userStory.RemoveFromBacklog();
userStory.MoveToBacklog();
@@ -18,6 +19,13 @@ namespace StatePattern.ScrumExample
userStory.AcceptanceTestsPassed();
userStory.StartImplementation();
//This is the first example where a state may not execute all transitions
//There is an active debate if this violates liskov substitution principle or not -> https://en.wikipedia.org/wiki/Liskov_substitution_principle
//but leaving that asside, assuming we will have to add another transition availalable that can be executed only from one state
//we will have to modify all the existing states, just to throw the exception.
}
}
@@ -98,26 +106,31 @@ namespace StatePattern.ScrumExample
public void AcceptanceTestsFail()
{
//throw the exception
Console.WriteLine("Implementation did not start yet, probably that's why the tests are failing");
}
public void AcceptanceTestsPassed()
{
//throw the exception
Console.WriteLine("Development didn't even started, you should check your tests");
}
public void CodeFinishedAnUnitTestsPassed()
{
//throw the exception
Console.WriteLine("Before you can finish the code, you should have started implementation");
}
public void MoveToBacklog()
{
//throw the exception
Console.WriteLine("Already in backlog");
}
public void RemoveFromBacklog()
{
//throw the exception
Console.WriteLine("User story removed");
}
@@ -139,11 +152,13 @@ namespace StatePattern.ScrumExample
public void AcceptanceTestsFail()
{
//throw the exception
Console.WriteLine("Implementation is not done yet, probably that's why tests are failing");
}
public void AcceptanceTestsPassed()
{
//throw the exception
Console.WriteLine("Development is not yet done");
}
@@ -155,17 +170,19 @@ namespace StatePattern.ScrumExample
public void MoveToBacklog()
{
//throw the exception
Console.WriteLine("Moved userstory to backlog");
}
public void RemoveFromBacklog()
{
//throw the exception
Console.WriteLine("You must first move the item to backlog");
}
public void StartImplementation()
{
//throw the exception
Console.WriteLine("You can start work only on user stories that are new, current user story state is: {0}", userStory.State);
}
}
@@ -193,21 +210,25 @@ namespace StatePattern.ScrumExample
public void CodeFinishedAnUnitTestsPassed()
{
//throw the exception
Console.WriteLine("The item was already resolved");
}
public void MoveToBacklog()
{
//throw the exception
Console.WriteLine("Item was already resolved, it can be moved to backlog, only if the acceptance tests failed");
}
public void RemoveFromBacklog()
{
//throw the exception
Console.WriteLine(@"The item was already resolved, it can be deleted only if the acceptance tests failed and moved to backlog");
}
public void StartImplementation()
{
//throw the exception
Console.WriteLine("You can start work only on user stories that are new, current user story state is: {0}", userStory.State);
}
}
@@ -223,16 +244,19 @@ namespace StatePattern.ScrumExample
public void AcceptanceTestsFail()
{
//throw the exception
Console.WriteLine("User story is already closed");
}
public void AcceptanceTestsPassed()
{
//throw the exception
Console.WriteLine("User story is already closed");
}
public void CodeFinishedAnUnitTestsPassed()
{
//throw the exception
Console.WriteLine("Item was already closed");
}
@@ -243,11 +267,13 @@ namespace StatePattern.ScrumExample
public void RemoveFromBacklog()
{
//throw the exception
Console.WriteLine("Once a User Story is Closed, it cannot be removed");
}
public void StartImplementation()
{
//throw the exception
Console.WriteLine("You can start work only on user stories that are new, current user story state is: {0}", userStory.State);
}
}
@@ -263,11 +289,13 @@ namespace StatePattern.ScrumExample
public void AcceptanceTestsFail()
{
//throw the exception
Console.WriteLine("Item was removed, you can only move it to backlog again");
}
public void AcceptanceTestsPassed()
{
//throw the exception
Console.WriteLine("Item was removed, you can only move it to backlog again");
}
@@ -284,11 +312,13 @@ namespace StatePattern.ScrumExample
public void RemoveFromBacklog()
{
//throw the exception
Console.WriteLine("Once a User Story is Closed, it cannot be removed");
}
public void StartImplementation()
{
//throw the exception
Console.WriteLine("You can start work only on user stories that are new, current user story state is: {0}", userStory.State);
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace StatePattern.ScrumExample
{
public class UserStoryMotivational
{
public String Name { get; set; }
public UserStoryState State { get; set; }
}
}