locked
Service layer should have single function!:RunCommand(Command) RRS feed

  • Question

  • An application manage many types of objects

    Why should the service layer expose a specific  interface(with the functions each

     object supports) instead of something like


    public <UniversalDTO> RunCommand(Command command)  or better

    public <UniversalDTO> RunCommand(string xml_describing_a_command)  

    This RunCommand will forward the command to the business layer

    The command contains an array of parameters and the function name or alias (in the

     context of the business layer)

    The UniversalDTO is just a hash table of properties

    my client is just a dumb thin client and all business logic done on the server,

    all other stuff like validation which methods an object supports, how to

    render its form, how to do validation etc can be  declaratively  defined and

    send to the client

    In such case when adding new function in the business layer or new type of

    object  I don’t need to change the service layer,so i now decoupled the

    client from the business layer....mmmm...so why do i need a service layer at all?!?

    I can push this function "public <UniversalDTO> RunCommand(string xml_describing_a_command)  "

    Into the business layer

    back to 2 Tiers....

    Why not?

    Tuesday, October 5, 2010 7:14 PM

All replies

  • Hello there,

    Yoyu have thought of applying design pattern for your software problem. Just look into this what I have mentioned, It might be useful for you.

    Regards,

    Phijo Mathew Philip.


    PHIJO MP
    Thursday, October 14, 2010 5:55 PM
  • If you're not repeating code and your application is simple enough that one business layer can do it all then there's little advantage to extra layers.

     

    Friday, October 15, 2010 10:47 AM