Created
July 31, 2014 08:49
-
-
Save yemrekeskin/f718677e5bac173a21fd to your computer and use it in GitHub Desktop.
template method design pattern's implementation - DataProcessor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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