Search code examples
robotlegs

Which package parsers should belong to


In the book 'ActionScript Developer’s Guide to Robotlegs' it is said that services should use parsers for transforming data. In which package should I put a parser for a service in com.stackoverflow.services.fooService?


Solution

  • There is no strict rule in this, what works well for you.
    A possible setup could be:

    besides:
    com.stackoverflow.control
    com.stackoverflow.event
    com.stackoverflow.model

    you could have:
    com.stackoverflow.remote

    with another split up according the different API's which are used (divided according to endpoints + type e.g. JSON/AMF/SOAP/...)

    com.stackoverflow.remote.api -> own back-end
    com.stackoverflow.remote.twitterapi

    from there you can go further:
    com.stackoverflow.remote.api.service
    OR
    com.stackoverflow.remote.api.resource
    com.stackoverflow.remote.api.host -> endpoint setup, security,... to inject in the service class
    com.stackoverflow.remote.api.parser -> data parsers

    Additionally you could include a control package to include the commands to configure the api (setup events, hosts, injection for parsers,...) and how it integrates to the main context.