[haiku-development] Re: [GSoC 2010] Services Kit API draft

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 15 Apr 2010 12:54:54 +0200

> 2010/4/14 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> > That depends a lot on your usage; const char* should be used where
> > it
> > makes sense -- constructing a BString for nothing is definitely a
> > lot
> > more expensive than just passing an actual const char*.
>
>  That's why I didn't see the need of BString at the moment, even if I
> don't have the code in mind yet.

There are quite a lot of useful functions for search and replace that I
imaginne would be useful for handling an URL (finding the / for
splitting, finding the ://, escaping/unescaping, ...)

> Concerning the lack of flexibility with the maneer I connect classes
> between them, I had the cURL interface in mind while drafting my
> document, rather than QT or Java framework. It's more oriented on the
> simplicity of implementation from the developer side (but with a lot
> of configuration options). But you're right, I used QT and Java for a
> while and the flexibility they offer is quite powerful. However, I
> don't know the Chromium network backend but I will take a look and
> try
> to update my rough draft. (I read on previous haiku-dev mailing list
> posts that you agree on using Chromium code within Haiku ?)

That would be ok, yes. Things to take care of :
 * Your kit should have a stable API and ABI, meaning you have to hide
the backend from the user applications. This way, it is possible to
update the kit without breaking existing applications.
 * Your kit should integrate well in the BeAPI, using BString,
BMessages, and all that stuff, and translate that to the backend API
(chromium, curl, or whatever else you want).

As for the API design, your proposal isn't actually that simple : there
are few classes and few methods because the complexity is hidden in a
big BMessage you use to do almost everything. Having some more classes
would likely avoid the need for that.
It's also a matter of how you design your project : do you work from
the ground up, starting with BUrl and building services on top of it,
or do you start with designing a BPasteService and see what you need to
implement it ? Both ways are valid, but you have to explicitly select
one to make a good design.

--
Adrien.

Other related posts: