View Single Post
  #1   Spotlight this post!  
Unread 29-03-2008, 01:59
Nibbles Nibbles is offline
Interstellar Hitchhiker
AKA: Austin Wright
FRC #0498 (Cobra Commanders)
Team Role: Alumni
 
Join Date: Jan 2008
Rookie Year: 2003
Location: Arizona
Posts: 103
Nibbles is just really niceNibbles is just really niceNibbles is just really niceNibbles is just really niceNibbles is just really nice
Re: [TBA]: API Client Development

That was supposed to be a silly fanboy rant, though I do come across as too serious too often. I do have a tiny issue with this project though, and isn't with anything in particular, but it does seem like it was created just because, with no real purpose. That said I realize some really cool things have been implemented with the API/data server, like the BeachBots put in a flash player with videos of their matches. Still, it all seems hackish to me.

I have been using the data not to dynamically call another server every time I load a web page, but to import data to my own database of teams and scores (with penalties and a much more relational format).

Here is a web version of that simple test console for whoever to use: http://frcdb.redjacket.ws/tests/tba/console.php

If it wasn't obvious, I am a fan and long time user of PHP and XML (I also realize PHP was not designed to be an event-based language). I am expirenced with SQL, JavaScript, and have not learned but really, really like anyways, Ruby. I don't know what people like about Python, I have to use that thing inside SAGE Math to work out team strength algorithms, and it is the most reverse intuitive language I have ever seen (next to this one). I know C and C++ to work on the f/oss game BZFlag, and regularly use many different compilers and debuggers, including MSVC, which I will say has a great debugger (compared to, say, the text-based gdb). Never used .net, and have no need to.

Back to this API: It also seems like people are making this way overly complicated. Each of the get_* functions do the same thing, with the only variation being the method called in the URL. This is not how you program!! Good practice says you should make them the same function, and use an argument to provide different attributes. Sounds quite a bit like the tba_send_request which we are discouraged from using...
Now, In C++, different functions might be needed, as each function would return an array or std::list of structs or classes, but even then that isn't always necessary, as you could just return a std::list of voids or extended objects.

And like I mentioned earlier, there is a serious lack of error checking in the library.

<edit>RFC 2616 is the specification for HTTP and HTTP headers, including caching. Calling get_matches with no argument results in a memory allocation error that returns invalid XML. Also, I like the fact SOAP or XML-RPC wasn't used, but I would like to know the decision on why that was not the choice.</edit>

<edit><criticism type="text/x-constructive+criticism">
The API is horrible with relational data sets. I can't go in and say "find me the links to videos for all matches played by teams in Arizona" without importing the data to a relational database and throwing together a query: SELECT c.video_url FROM team a, team_match b, match c WHERE a.state="AZ" AND a.teamnum=b.teamnum AND b.teamnum=c.teamnum GROUP BY c.matchid
</criticism></edit>

Last edited by Nibbles : 29-03-2008 at 02:41. Reason: /me mumbles about preview
Reply With Quote