What is the best possible Design Pattern
-
Hi, I'm designing a processing engine that will do the following: 1. Determine the file type, i.e .TXT;.CSV;.XML 2. Check to make sure the file being review is valid 3. Make sure the data is valid based on delimiter and based on XML parsing 4. Load to a database server or pass to some type service The purpose of this is to enable IS to utilize this "Framework" and extend the use of File I/O functionality or XML functionality dependending on the file type selected. My first question is where do I start? I'm looking at the Decorator/Iterator patterns but I feel I'm only extending the File I/O. Thanks,:confused:
-
Hi, I'm designing a processing engine that will do the following: 1. Determine the file type, i.e .TXT;.CSV;.XML 2. Check to make sure the file being review is valid 3. Make sure the data is valid based on delimiter and based on XML parsing 4. Load to a database server or pass to some type service The purpose of this is to enable IS to utilize this "Framework" and extend the use of File I/O functionality or XML functionality dependending on the file type selected. My first question is where do I start? I'm looking at the Decorator/Iterator patterns but I feel I'm only extending the File I/O. Thanks,:confused:
I might have done it this way: Have a class for each file type. 1.) Find out the class/provider which knows how to handle the given file type from the list of registerd handlers (maintained in a global variable list). eg:= FileProcessorTXT, FileProcessorCSV etc, all deriving from FileProcessorBase. 2.) If there is no registered handlers, error! 3.) If there is a registered handler, call the virtual function Validate() which should check the format. eg:- FileProcessorTXT's Validate() needs to bother about TXT file validation only. The above classes job is to validate, read the special file types. Now we might need to introduce a common interface to talk with the DB. This could be a class/function on the FileProcessorBase such that each of the descendants would return data in the accepted format; say based on an XML template. O my god.. I think I just wrote a design document!
namaste, Nitin Koshy http://devwaves.blogspot.com ...and I thought I knew
-
I might have done it this way: Have a class for each file type. 1.) Find out the class/provider which knows how to handle the given file type from the list of registerd handlers (maintained in a global variable list). eg:= FileProcessorTXT, FileProcessorCSV etc, all deriving from FileProcessorBase. 2.) If there is no registered handlers, error! 3.) If there is a registered handler, call the virtual function Validate() which should check the format. eg:- FileProcessorTXT's Validate() needs to bother about TXT file validation only. The above classes job is to validate, read the special file types. Now we might need to introduce a common interface to talk with the DB. This could be a class/function on the FileProcessorBase such that each of the descendants would return data in the accepted format; say based on an XML template. O my god.. I think I just wrote a design document!
namaste, Nitin Koshy http://devwaves.blogspot.com ...and I thought I knew
Thanks I appreciate your input