[Newbies] conceptual design help
ron at usmedrec.com
Fri Apr 29 00:11:16 UTC 2016
Depending on how many different structures you have you may want to consider
having some external configuration object. My first thought when reading
your description was that there are only so many ways to parse, and so many
different types of data. Having a collection of parser objects that handle
specific translations seems clean. Once you have an idea of what types of
translations you need you could trigger those operations by building your
collection of parser objects from an external config file. In that way you
read the parameters in (could be a file in the JPMorgan directory) conf.xml
or parse.conf something like that, and then use that to set up your parser.
The parser is then written to be generic and reusable. It would allow you
to write methods once and then reuse them for files you haven't seen yet by
creating a new config file for your format. You could even have a config
file generator that asks you questions and shows you the results from a
current sample data file. :)
nameFormat: 'title, first, [mi], last, [suffix]'.
fieldOrder: 'id, name, balance'.
One other thought is if there is a way for the system to determine what
format to use (this is a JPMorgan file) then instead of an external config
file you could just store the different configs internally and match for the
right config collection and error if one doesn't exist (asking the user to
create one using your config builder method). if you can't match then
having a file in a JPMorgan directory seems simple enough. In general
thinking of the setup step as a collection of generic parser configuration
objects instead of a different parsing method for each file, simplifies
everything. Of course back to my original point, writing 3 parser methods
will go faster if there are not that many formats. There is always a trade
off when you consider building a framework or just hacking some code that
All the best,
> From: Joseph Alotta
> Sent: Thursday, April 28, 2016 6:15 PM
> I am writing a program to consolidate all my personal finances for tax
> next year. (This is not a school project.)
> There are transaction files from several banks and credit card companies.
> Each has a similar format, CSV, but they vary in many ways, order of
> extra notes, pipe delimited or tabs, etc. I want to read them and load
> into a collection of transaction objects.
> 1. Should I have a FileReader object?
> 2. Should it have subclasses like FileReaderAmericanExpress,
> FileReaderJPMorgan ?
> 3. Or should it have different methods like loadAmericanExpresFile,
> loadJPMorganFile ?
> 4. Is a Collection of Transaction objects, the structure that you would
> the files into?
> The rest of the project would be to do data checking on the files, to make
> sure there are no duplicates or missing dates. Then write reports that I
> give to my accountant.
> I would appreciate some design help?
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners