Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Created July 31, 2014 08:49
Show Gist options
  • Save yemrekeskin/f718677e5bac173a21fd to your computer and use it in GitHub Desktop.
Save yemrekeskin/f718677e5bac173a21fd to your computer and use it in GitHub Desktop.
template method design pattern's implementation - DataProcessor
public abstract class DataProcessor
{
public abstract void SetDataSource(string url);
public abstract bool IsValid();
public abstract void Parse();
public abstract void SaveData();
// template method
public void GetResult()
{
if (IsValid())
{
Parse();
SaveData();
}
}
}
public class LinkedinDataProcessor
:DataProcessor
{
public override void SetDataSource(string url)
{
throw new NotImplementedException();
}
public override bool IsValid()
{
throw new NotImplementedException();
}
public override void Parse()
{
throw new NotImplementedException();
}
public override void SaveData()
{
throw new NotImplementedException();
}
}
public class TwitterDataProcessor
:DataProcessor
{
public override void SetDataSource(string url)
{
throw new NotImplementedException();
}
public override bool IsValid()
{
throw new NotImplementedException();
}
public override void Parse()
{
throw new NotImplementedException();
}
public override void SaveData()
{
throw new NotImplementedException();
}
}
public class GithubDataProcessor
:DataProcessor
{
public override void SetDataSource(string url)
{
throw new NotImplementedException();
}
public override bool IsValid()
{
throw new NotImplementedException();
}
public override void Parse()
{
throw new NotImplementedException();
}
public override void SaveData()
{
throw new NotImplementedException();
}
}
public class BitbucketDataProcessor
:DataProcessor
{
public override void SetDataSource(string url)
{
throw new NotImplementedException();
}
public override bool IsValid()
{
throw new NotImplementedException();
}
public override void Parse()
{
throw new NotImplementedException();
}
public override void SaveData()
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment