#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2016
    Posts
    1
    Rep Power
    0

    Request of work design


    Hi all,
    in my scenario i have a client that fill a form and the server have to insert a request of work.
    I would like to create a flexible, cohesive and non coupled architecture so it will be easy to mantain.
    What troubles me is:
    1) how to treat all properties that come from the client?
    2) how to design the set of classes and interface (with design patterns?) to insert (and validate) a request of work?

    In this scenario there's a tangle: exist different kind of requests of work depending on the customer who submits the request, so i should keep in mind that "Request A" of the customer "X" could have some different logic from "Request B" of the customer "Y".

    To make an example of requirements:
    Customer John fills the form with these characteristic: type of request, task and description
    Customer Jack fills the form with these characteristic: type of request, equipment and description
    Customer ThatsMe fills the form with these characteristic: type of request, task, description and priority

    For John a valid request is when task is not null.
    For Jack the request is valid where description is equal to "test".
    For ThatsMe exists a default validation that just checks if Description is not null.

    Looking forward everything is translated in inserting rows in a database in different way, but this is another kettle of fish...

    Thanks all for every suggestion.

    Max
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2016
    Posts
    54
    Rep Power
    2
    How about this:

    We have a baseclass "WorkRequest" -> which uses a decorator pattern? Or just specialized classes, for task, equipment, etc. The customer would just be a parameter on the baseclass.

    You build a set of controllers, that handles "WorkRequest" objects, and then in each specialized class, you have a singleton pattern, to a data access layer, that handles the "WorkRequest" specialized classes off to whatever destination it needs to go?

    This was just quick inspiration... But if you have a more detailed layout of the task and the requirement, I can be more specific.

    You would have a bit of overhead, but modifying this architecture from user requests, would be extremely simple.

IMN logo majestic logo threadwatch logo seochat tools logo