hays.clark's Avatar


04 Nov, 2014 05:14 PM

I was curious what package more people end up putting their parsers into? I have tried answering this question but my answer ended up being 'anywhere other then the view'. :D

My thoughts:
Controller - This seems correct if you want to encapsulate the logic into a Command or an internal class.
Model - This seems less correct, but often my parsers are tightly coupled to the VO objects and the Models.
Services - If I was trying to make a service for Twitter which supported multiple Twitter outputs and inputs over the years I would expect all of that logic to be in this class.

What are your thoughts? Anyone know of any good resources on the topic?

  1. Support Staff 1 Posted by Ondina D.F. on 06 Nov, 2014 11:37 AM

    Ondina D.F.'s Avatar

    I also think that a services-package is a good place for parsers, if the parsers are meant to be used by services to build a data structure of some kind from the loaded data.

    In my opinion, a parser belongs in the same package as the class needing it to 'manipulate' the input data. If a Model needed to parse some data, for whatever reasons, then I'd put the parser into a 'models.parsers' package.

    Or, in a modular application, where different modules are interested in using the same parser, I would create a 'shared' or 'commons' package and a sub-package for 'parsers' or 'helpers' (containing parsers and/or other classes like factories, for example).

  2. Ondina D.F. closed this discussion on 17 Dec, 2014 03:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac