POV-Ray : Newsgroups : povray.off-topic : APIs first? Server Time
14 Oct 2026 01:12:37 EDT (-0400)
  APIs first? (Message 1 to 28 of 28)  
From: Darren New
Subject: APIs first?
Date: 1 Apr 2009 12:56:44
Message: <49d39ccc$1@news.povray.org>
http://asserttrue.blogspot.com/2009/04/api-first-design.html

Huh? Doesn't everyone document the APIs before they start writing code that 
exports APIs?  Seriously, don't you programmers do that?

I can't imagine how you can even know when you're done a piece of the 
library if you didn't do the documentation first. I thought that was, like, 
the only way to do it.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: APIs first?
Date: 1 Apr 2009 14:56:30
Message: <49d3b8de@news.povray.org>
Darren New wrote:
> http://asserttrue.blogspot.com/2009/04/api-first-design.html
> 
> Huh? Doesn't everyone document the APIs before they start writing code
> that
> exports APIs?  Seriously, don't you programmers do that?
> 
> I can't imagine how you can even know when you're done a piece of the
> library if you didn't do the documentation first. I thought that was,
> like, the only way to do it.

I spent weeks deciding on the API, some more weeks deciding on internal
design, and I've yet to write any *real code* for this one library... :)


Post a reply to this message

From: Orchid XP v8
Subject: Re: APIs first?
Date: 1 Apr 2009 15:22:37
Message: <49d3befd$1@news.povray.org>
Darren New wrote:
> http://asserttrue.blogspot.com/2009/04/api-first-design.html
> 
> Huh? Doesn't everyone document the APIs before they start writing code 
> that exports APIs?  Seriously, don't you programmers do that?
> 
> I can't imagine how you can even know when you're done a piece of the 
> library if you didn't do the documentation first. I thought that was, 
> like, the only way to do it.

Maybe I don't do anything enterprisy enough. I'm usually more worried 
about "Jesus, how the hell do you design an algorithm does solves X?"

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 1 Apr 2009 18:19:20
Message: <49d3e868@news.povray.org>
Orchid XP v8 wrote:
> Maybe I don't do anything enterprisy enough.

I think the commentators use "API" to mean "external API to access your 
webby crap."  It used to be that "API" was how you interface to pretty much 
any chunk of library code.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 04:06:54
Message: <49d4721e$1@news.povray.org>
Darren New wrote:
> Orchid XP v8 wrote:
>> Maybe I don't do anything enterprisy enough.
> 
> I think the commentators use "API" to mean "external API to access your 
> webby crap."  It used to be that "API" was how you interface to pretty 
> much any chunk of library code.

It's news to me that it's possible to access anything web-based with 
something other than a web browser.


Post a reply to this message

From: Warp
Subject: Re: APIs first?
Date: 2 Apr 2009 04:24:41
Message: <49d47649@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> It's news to me that it's possible to access anything web-based with 
> something other than a web browser.

  Why would the http protocol be limited to web browsers?

-- 
                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: APIs first?
Date: 2 Apr 2009 04:30:02
Message: <49d4778a$1@news.povray.org>
> It's news to me that it's possible to access anything web-based with 
> something other than a web browser.

Tell Windows Live Mail to use your Hotmail account and it will talk over 
http.


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 04:33:03
Message: <49d4783f$1@news.povray.org>
scott wrote:
>> It's news to me that it's possible to access anything web-based with 
>> something other than a web browser.
> 
> Tell Windows Live Mail to use your Hotmail account and it will talk over 
> http.

That's because they are both Micro$oft products.


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 04:36:55
Message: <49d47927$1@news.povray.org>
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>> It's news to me that it's possible to access anything web-based with 
>> something other than a web browser.
> 
>   Why would the http protocol be limited to web browsers?

It isn't. I personally have written a small Haskell program that 
connects to PassMark website, downloads the current benchmark table, and 
gives me a CSV file containing all the current results.

Of course, writing an HTTP client is very nontrivial. If anything 
remotely unusual were to happen, my program would hopelessly fall over. 
More to the point, there's masses of tricky parsing to wade through all 
the presentational HTML to extract the actual raw data I'm after.

(The original plan was to then connect to ebuyer.com and dredge out the 
processor prices and availability - but this turned out to be far too hard.)

The fun part is, if PassMark ever change their presentational HTML (or 
their URLs), my program will spectacularly break.

I wouldn't really call this "interfacing my program to a website". I'd 
call this "a fragile hack which just happens to sort-of work right now".


Post a reply to this message

From: scott
Subject: Re: APIs first?
Date: 2 Apr 2009 04:45:38
Message: <49d47b32$1@news.povray.org>
> That's because they are both Micro$oft products.

Not really, it's because there is an agreed standard for how the information 
is transferred over http (of course if both sides are made by the same 
company this is usually automatically the case).

How about RSS feeds, loads of programs written that access those over the 
web?


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 04:56:54
Message: <49d47dd6@news.povray.org>
scott wrote:
>> That's because they are both Micro$oft products.
> 
> Not really, it's because there is an agreed standard for how the 
> information is transferred over http (of course if both sides are made 
> by the same company this is usually automatically the case).

Well, let's face it, any system is merely an agreed way to send data 
between multiple computers. I'm just saying, I'm not aware of any way of 
accessing an arbitrary website programatically without going through a 
world of pain.

> How about RSS feeds, loads of programs written that access those over 
> the web?

I don't what what RSS is.


Post a reply to this message

From: scott
Subject: Re: APIs first?
Date: 2 Apr 2009 05:02:54
Message: <49d47f3e$1@news.povray.org>
> I don't what what RSS is.

http://tinyurl.com/ct6woq


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 05:06:25
Message: <49d48011$1@news.povray.org>
scott wrote:
>> I don't what what RSS is.
> 
> http://tinyurl.com/ct6woq

Oh, the Wikipedia article on RSS. I would *never* have thought of that. :-P

Seriously, did you think I hadn't read that already?


Post a reply to this message

From: clipka
Subject: Re: APIs first?
Date: 2 Apr 2009 07:55:00
Message: <web.49d4a77ecd1f6b8ff708085d0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Darren New wrote:
> > http://asserttrue.blogspot.com/2009/04/api-first-design.html
> >
> > Huh? Doesn't everyone document the APIs before they start writing code
> > that
> > exports APIs?  Seriously, don't you programmers do that?
> >
> > I can't imagine how you can even know when you're done a piece of the
> > library if you didn't do the documentation first. I thought that was,
> > like, the only way to do it.
>
> I spent weeks deciding on the API, some more weeks deciding on internal
> design, and I've yet to write any *real code* for this one library... :)

From my experience, a *typical* real-life working mode would be to

(1) design and (optionally) document the API
(2) design and (optionally) document the internal design, modifying the API as
problems with the internal design arise
(3) write the real code, modifying both the internal design and API as problems
with the real code arise
(4) start working on a new project
(5) (optionally) document the changes made to the API in phases (2) and (3)
(6) (optionally) document the changes made to the internal design in phase (3)


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 11:15:59
Message: <49d4d6af$1@news.povray.org>
clipka wrote:
> From my experience, a *typical* real-life working mode would be to

<chortle>  I think you hit the nail on the head.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 11:19:46
Message: <49d4d792$1@news.povray.org>
Invisible wrote:
> More to the point, there's masses of tricky parsing to wade through all 
> the presentational HTML to extract the actual raw data I'm after.

That's because you're getting the results in HTML instead of "via an API".

That's what people are talking about when they talk about web APIs: 
presenting data without making you parse it.

"REST" is a pattern for doing this in a way that *also* lets you use a web 
browser to reverse-engineer the protocols by looking at it and which is 
theoretically kind to intermediate proxies.

"SOAP" is a pattern for doing this in a way that lets you publish the 
specification of the interface in a form that a tool can generate code to 
decode it into whatever native data structures are available for your language.

What you're doing is called "screen scraping", and yes, it breaks when the 
format of the web page changes, which happens often when there's so many 
people doing screen scraping that it starts to impact the actual customers 
of the web site.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 11:21:09
Message: <49d4d7e5$1@news.povray.org>
Invisible wrote:
> accessing an arbitrary website programatically without going through a 
> world of pain.

No, you can't access "arbitrary" websites that present HTML. Well, you can, 
depending on what you want to do. Google does it all the time. But it's hard 
to get specific information out in an automated way. That's why people 
invented HTTP-based APIs like SOAP.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 11:27:54
Message: <49d4d97a$1@news.povray.org>
>> accessing an arbitrary website programatically without going through a 
>> world of pain.
> 
> No, you can't access "arbitrary" websites that present HTML. Well, you 
> can, depending on what you want to do. Google does it all the time.

Uhuh. And how many PhDs work for Google?

> But 
> it's hard to get specific information out in an automated way. That's 
> why people invented HTTP-based APIs like SOAP.

Why would you base a protocol on HTTP?


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 11:28:06
Message: <49d4d986$1@news.povray.org>
Darren New wrote:
> Invisible wrote:
>> More to the point, there's masses of tricky parsing to wade through 
>> all the presentational HTML to extract the actual raw data I'm after.
> 
> That's because you're getting the results in HTML instead of "via an API".
> 
> That's what people are talking about when they talk about web APIs: 
> presenting data without making you parse it.
> 
> "REST" is a pattern for doing this in a way that *also* lets you use a 
> web browser to reverse-engineer the protocols by looking at it and which 
> is theoretically kind to intermediate proxies.
> 
> "SOAP" is a pattern for doing this in a way that lets you publish the 
> specification of the interface in a form that a tool can generate code 
> to decode it into whatever native data structures are available for your 
> language.

So you mean you get the web server to search an XML document so the 
client at the other end can parse it into something useful more easily?

> What you're doing is called "screen scraping", and yes, it breaks when 
> the format of the web page changes, which happens often when there's so 
> many people doing screen scraping that it starts to impact the actual 
> customers of the web site.

I doubt my one hit per month hurts PassMark. ;-)


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 11:43:59
Message: <49d4dd3f$1@news.povray.org>
Invisible wrote:
> So you mean you get the web server to search an XML document so the 
> client at the other end can parse it into something useful more easily?

s/search/serve

Yes.

> I doubt my one hit per month hurts PassMark. ;-)

No, but when people distribute software that (for example) takes TV listings 
off Yahoo's web site without grabbing or showing any ads, and 100,000 people 
run that every day, Yahoo notices.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 11:45:59
Message: <49d4ddb7$1@news.povray.org>
Invisible wrote:
> Uhuh. And how many PhDs work for Google?

Lots. So? It's not hard to make a web crawler, as long as you're not trying 
to understand data that *isn't* presented in HTML tags. How hard is it to 
find all the URLs in a HTML document?

>> But it's hard to get specific information out in an automated way. 
>> That's why people invented HTTP-based APIs like SOAP.
> 
> Why would you base a protocol on HTTP?

Because it's easy and the standards are there to say how to look things up 
and encode the bytes and do the logging in and encryption and things like 
that. If you have a request/response model, it's not a bad protocol. If you 
have something more complex than a request/response model, you should be 
using something like BEEP.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Invisible
Subject: Re: APIs first?
Date: 2 Apr 2009 11:56:08
Message: <49d4e018$1@news.povray.org>
>> So you mean you get the web server to search an XML document so the 
>> client at the other end can parse it into something useful more easily?
> 
> s/search/serve
> 
> Yes.

Hmm. Interesting.

Does anybody ever do this?

>> I doubt my one hit per month hurts PassMark. ;-)
> 
> No, but when people distribute software that (for example) takes TV 
> listings off Yahoo's web site without grabbing or showing any ads, and 
> 100,000 people run that every day, Yahoo notices.

It's news to me that Yahoo is still in business...


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 12:03:42
Message: <49d4e1de$1@news.povray.org>
Invisible wrote:
> Does anybody ever do this?

Um, yes, scads of people. For example, the whole Amazon "cloud computing" is 
based on this, Yahoo does it for their search engines, iTunes does it for 
music search, Google has APIs for the stuff they do, Amazon lets you search 
and buy and sell things that way, etc.

> It's news to me that Yahoo is still in business...

Do you do this on purpose? :-)  I mean, you don't even have to google 
anything to figure out if Yahoo is still running a web site.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Orchid XP v8
Subject: Re: APIs first?
Date: 2 Apr 2009 13:24:18
Message: <49d4f4c2$1@news.povray.org>
>> Does anybody ever do this?
> 
> Um, yes, scads of people. For example, the whole Amazon "cloud 
> computing" is based on this, Yahoo does it for their search engines, 
> iTunes does it for music search, Google has APIs for the stuff they do, 
> Amazon lets you search and buy and sell things that way, etc.

...wait, so you mean there's a way I can use this to find out how much 
money Amazon want for product X?

>> It's news to me that Yahoo is still in business...
> 
> Do you do this on purpose? :-)  I mean, you don't even have to google 
> anything to figure out if Yahoo is still running a web site.

I'm not disputing that Yahoo are still going - clearly they are - I'm 
just saying it's news to me. As in, nobody ever speaks about them any 
more...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 14:52:51
Message: <49d50983$1@news.povray.org>
Orchid XP v8 wrote:
> ...wait, so you mean there's a way I can use this to find out how much 
> money Amazon want for product X?

Yes.

Look at "amazon web services" on wikipedia for a list of all their APIs. The 
"associates" API is what you're looking for.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

From: Orchid XP v8
Subject: Re: APIs first?
Date: 2 Apr 2009 17:11:25
Message: <49d529fd@news.povray.org>
Darren New wrote:
> Orchid XP v8 wrote:
>> ...wait, so you mean there's a way I can use this to find out how much 
>> money Amazon want for product X?
> 
> Yes.
> 
> Look at "amazon web services" on wikipedia for a list of all their APIs. 
> The "associates" API is what you're looking for.

Heh. Too bad Amazon don't sell CPUs. I might actually be able to write 
my price/performance autoplot tool after all. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: APIs first?
Date: 2 Apr 2009 17:15:54
Message: <49d52b0a@news.povray.org>
Invisible wrote:
> scott wrote:
>> How about RSS feeds, loads of programs written that access those over
>> the web?
> 
> I don't what what RSS is.

http://blog.orphi.me.uk/feed

Open it with a text editor. Isn't it easier to parse than all the
presentational HTML in your blog?


Post a reply to this message

From: Darren New
Subject: Re: APIs first?
Date: 2 Apr 2009 17:42:20
Message: <49d5313c$1@news.povray.org>
Orchid XP v8 wrote:
> Heh. Too bad Amazon don't sell CPUs.

No, but they'll rent them to you. ;-)

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.