Re: Input about API design interface
Re: Input about API design interface
- Subject: Re: Input about API design interface
- From: Chuck Hill <email@hidden>
- Date: Mon, 17 Sep 2012 10:46:34 -0700
On 2012-09-16, at 12:22 PM, Pascal Robert wrote:
> Hi guys,
>
> I'm going to add some stuff (MS Exchange and CarDav support…) to ERGroupware in the next couple of months and I'm wondering how I should construct the API.
>
> Each groupware do mostly the same (adding events, getting a list of contacts, etc.), the main difference is how they do it. For example, CalDav is an extension of WebDav + XML for the body, and MS Exchange is using SOAP.
>
> So I was thinking of the following:
>
> - Using interfaces for common methods (createFolder, fetchEvents, etc.) and have a store (MSExchangeStore, CalDavStore, etc.) that will implements those interfaces.
Interfaces, definitely.
>
> or
>
> - Using a type to specify the kind of store we will connect to. For example, when constructing a CalendarStore, the constructor will ask for a type (MSExchange, etc.) and the addEvent method will check the type of store to call the corresponding method to add the event in the asked store.
I think you would be better off with a factory method that returned and CalendarStore sub-class specific to a type:
CalendarStore cs = CalendarStoreFactory.calendarStroreFor("MSExchange");
Chuck
>
> or
>
> - Using interfaces + delegates.
>
> Any input?
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden