parsing - Proper design to parse file in c++ -
i'm trying parse file , store different fields in variable. however, i'm not sure of proper design this:
should have class parsing , class storage, or should parser used storage hold fields ?
i have keep in mind might need extend parser new fields may appear in file.
edit: has been mentionned question broad. included more details here didn't want influence answers implemented. in current implementation faced issues extended parser, , pointed out shouldn't separate data storage , parser (because of single responsibility principle) me made sense separate them.
it's question of necessity. if problem stay small, put parsing , storage together. you'll have have parsed data somewhere in memory regardless, why not right comes in?
the main reason you'd want separate them if need store in different ways, such database or file, , need sort of interface can deal extensibility.
but think if looks come up.
Comments
Post a Comment