Update description on ChainOfResponssibility and Command pattern

This commit is contained in:
Petrutiu Mihai
2016-06-23 10:07:17 +03:00
parent 2f98e10ee2
commit 494e3650f9
7 changed files with 48 additions and 13 deletions

View File

@@ -80,9 +80,10 @@ namespace ChainOfResponssibility.PurchaseExample
}
public string GetDescriptionOfClass()
public string GetDescriptionOfExample()
{
return @"CheckAuthority allows an employee to spend money
return @"Description of example:
CheckAuthority allows an employee to spend money
if(manager can approve it) manager will process the request
if (director can approve it) director will process the request
if (vice president can approve it) vice president will process the request

View File

@@ -17,7 +17,7 @@ namespace ChainOfResponssibility
CheckAuthority moneySpender = new CheckAuthority();
Console.WriteLine(moneySpender.GetDescriptionOfClass());
Console.WriteLine(moneySpender.GetDescriptionOfExample());
GoToNextStep();
moneySpender.PrintHowMuchEachCanSpend();
@@ -26,7 +26,7 @@ namespace ChainOfResponssibility
TransferFilesManager transferFilesManager = new TransferFilesManager();
Console.WriteLine(transferFilesManager.GetDescriptionOfClass());
Console.WriteLine(transferFilesManager.GetDescriptionOfExample());
GoToNextStep();
transferFilesManager.TransferFiles();
@@ -50,7 +50,7 @@ namespace ChainOfResponssibility
public static string GetPatternDescription()
{
return @"
return @"Pattern description:
Decouples sender and receiver (as a sender you don't know who will handle the request/ as a receiver you don't know who the sender is necessary)
Hierarchical in nature
When using the Chain of Responsibility is more effective:
@@ -67,7 +67,7 @@ Examples in real life:
public static string GetPitfalls()
{
return @"
return @"Pitfalls:
Handling/Handler guarantee - you won't be sure that someone can process the request
Runtime configuration risk - the order matters/and it might be that the chain is not configured correctly
Chain length/performance issues - in theory you could see a chain that is too big, and it would be a bottleneck in performance";

View File

@@ -42,9 +42,10 @@ namespace ChainOfResponssibility.TransferFileExample
return "exit".Equals(input, StringComparison.OrdinalIgnoreCase);
}
public string GetDescriptionOfClass()
public string GetDescriptionOfExample()
{
return @"TransferFilesManager will try to transfer the file to the destination by trying FTP, SFTP, Http, and simple file copy";
return @"Description of example:
TransferFilesManager will try to transfer the file to the destination by trying FTP, SFTP, Http, and simple file copy";
}
}
}

View File

@@ -2,9 +2,6 @@
using ChainOfResponssibility.Validators.UserEntities.UserMenu;
using ChainOfResponssibility.Validators.UserEntities.Validators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ChainOfResponssibility.Validators.UserEntities
{