Software Design & Web Service Design
        Posted  
        
            by 
                001
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by 001
        
        
        
        Published on 2010-12-30T01:33:09Z
        Indexed on 
            2010/12/30
            1:54 UTC
        
        
        Read the original article
        Hit count: 460
        
I'm about to design my Web service API, most of the functions of my API is basically very simular to my web application.
Now the question is, should I create 1 single method and reuse them for both the web application and the web service api? (This seems to be the logical solution, however its very complicated; it's much easier to duplicate the method used by the web application, and keep both separate, ie one method for the web application and one method for the web service.)
How do you guys do it?
1) REUSE: one main method and reuse them for both web application and web service application (I like this but it's complicated)
- WebAppMethodX --uses--> COMMONFUNCTIONMETHOD_X
 - APIMethodX ---uses----> COMMONFUNCTIONMETHOD_X
 
ie common function performs functions such as creating/updating/deleting records etc
2) DUPLICATE: two methods, one method for the web application and one method for the web service.
- WebAppMethodX
 - APIMethodX
 
© Stack Overflow or respective owner