I honestly think from what you've said so far, you're already on track.
You've got quite a bit to get started. My only recommendation would be
if you can have your client objects either interacting with an Interface
class or a Facade instead of accessing directly the concrete
class/implementation of your services.
By introducing an abstraction layer, you can 1) change the underlying
implementation such that it adheres to a public declared interface.
Connected client objects will not be too adversely affected by change
since it is loosely coupled to the core implementation details of your
api. 2) you can implement stub/dummy/hard code so that when client
objects hit your API, they get the expected results in which case they
don't know if they are getting the real deal or not. Once you have this
in place, it's a matter of getting your internals of the api to actually
deliver what the stub/dummy/hard code is responding back to client objects.
I think to a certain degree, you need to wear at least two hats. One is
how is your API going to work internally. The other is how easy will it
be to access the services your API will provide. I think librarification
of code is well worth the trouble if it's going to be reused in more
than one project.
Also the other bit of advice that I think people would agree is to keep
it as simple as possible. It's very easy to offer an API with a
ga-billion methods when client objects are only interested in a few if
not one method call.
Sidney de Koning wrote:
He Glen,
Thanks for your post;
What i want to do is this; take data from an external source (an API
for some service) and write a wrapper for flash (i found the right
termonoligy :) )
But there is not that much documentation on writing this. Any good
resources will help.
Thanks,
Sidney
Glen Pike wrote:
Hi,
Do you mean you want to write Web Services or the AS3 code to use
these?
For the former, you would probably want to look on other lists as
this will be server side code - for PHP, the only thing I can
recommend is to look at Pear's libraries for common web services and
see if you can extend the base classes to roll your own. There are
also lots of other libraries out there - CakePHP had some if I
remember rightly. Programmable Web http://www.programmableweb.com/
has a good list of API's available and may also mention some stuff
that has been done in Flash already.
For AS3, I would look at the documentation provided by the
web-service providers and think about duplicating these functions on
the client side...
Have a look at the structure of some of the things I have
mentioned - take them apart. You will probably see common
functionality:
A set of functions duplicating the server side functions you can
call, some error handling and some response handling.
If you are making a solid class, you will probably have to deal
with asynchronicity - you can't block your client code waiting for
something to happen on the server side as this is unreliable,
instead, you will need to think about the EventListener model, etc.
I remembered a good tutorial on the Devnet site which is really
useful for thinking about any application that talks to servers
somewhere:
http://www.adobe.com/devnet/flex/articles/blueprint.html
The article provides source code to download, but the main point
is that it separates the services from the rest of the application
really nicely - what you want to do.
Have a look at Flashr too - this was a nice example of something
that provided a really nice interface to the Flickr web service.
Glen
Sidney de Koning wrote:
Sounds like a very good tip :)
The thing is i want to start writing my own api's. But i have no
idea where to begin, what is a good starting point for me?
Cheers, Sid
Mark Lapasa wrote:
(If you already know about this, my apologies in advance)
A useful API is a well documented one. If you haven't already
looked into it, ASDoc is a code documentation tool that will
generate your documentation based on how you apply the ASDoc syntax
in your code.
Glen Pike wrote:
Hi,
Have not written anything myself, but have played with quite
a few AS2 ones.
The SWXFormat project has quite a few API's for some of the
services you mentioned, but they are still working on porting SWX
to AS3.
I guess one thing to suggest would be to get involved with the
project and help them write the API's for these things.
Yahoo is pretty up on Flash and has just released a few useful
things.
http://developer.yahoo.com/flash/
The Adobe labs site has some examples links here:
http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries
Hope this helps.
Glen
Sidney de Koning wrote:
Hi List,
Are there people who write their own AS3 apis for web services?
for instance twitter, the nabaztag rabbit, amazon?
Do you have any good documentation on how and where to start?
Special steps to take concerning events, things to
keep in the back of your mind when coding. Or is there a
Hitchhikers guide to writing flash api's?
Any help would be highly appreciated1
Sid
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Notice of confidentiality:
The information contained in this e-mail is intended only for the
use of the individual or entity named above and may be
confidential. Should the reader of this message not be the intended
recipient, you are hereby notified that any unauthorized
dissemination, distribution or reproduction of this message is
strictly prohibited. If you have received this message in error,
please advise the sender immediately and destroy the e-mail.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Notice of confidentiality:
The information contained in this e-mail is intended only for the use of the
individual or entity named above and may be confidential. Should the reader of
this message not be the intended recipient, you are hereby notified that any
unauthorized dissemination, distribution or reproduction of this message is
strictly prohibited. If you have received this message in error, please advise
the sender immediately and destroy the e-mail.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders