Design a JSON Parser ( Feedback apprectaied)
I am using  a layered approach and have used design realted concepts . Feedback appreciated. 

//Declaring Member fucntion
public class Text
{
    public  string data{get;set};
    public  TextFormat textFormat{get;set};
}


 enum TextFormat {
    XML,
    JSON,
    PLAIN_TEXT;
}


//bal layer
public class TextParseService
{
// creating contructor object 
private readonly ITextParserRepository _TextParserRepository;
//Utilizing the instantiated object to access the interface 
public  list<Text rawText>  JsonTextParser ()
{
return _TextParserRepository.JsonTextParser()
}

//Utilizing the instantiated object to access the interface 
public  list<Text rawText>  PlainTextParser ()
{
return _TextParserRepository.PlainTextParser()
}

//Utilizing the instantiated object to access the implemeation via interface 
public  list<Text rawText>  XmlTextParser ()
{
return _TextParserRepository.XmlTextParser()
} 

}

//Dal layer [IRepository folder/Repositry folder]
// Following a repositry pattern to acheive abstraction between service and dal layer
// defining interface within Irepository folder  
public interface ITextParserRepository {
     // by default all the methods are abstract (we only define the signature inside interface)
	 list<Text rawText>   JsonTextParser (); 
	 list<Text rawText>  PlainTextParser();
     list<Text rawText>  XmlTextParser();

}

//Implementation code inside repositry folder
public class  TextParserRepository: ITextParserRepository
{
public  list<Text rawText>  JsonTextParser ()
{
 //implementation
 list<Text rawText> text  = new  list<Text rawText>
 return text

}

public  list<Text rawText>  PlainTextParser (Text rawText)
{
 //implementation
 list<Text rawText> text  = new  list<Text rawText>
 return text
}

public  list<Text rawText>  XmlTextParser (Text rawText)
{

//implement
 list<Text rawText> text  = new  list<Text rawText>
 return text
}
}

Comments (4)