Code Samples/Comparisons

Dave Cragg dave.cragg at lacscentre.co.uk
Sat Dec 5 14:31:38 EST 2009


On 5 Dec 2009, at 18:12, Colin Holgate wrote:

> 
> On Dec 5, 2009, at 12:30 PM, Dave Cragg wrote:
> 
>> How would you do the following in Java/C/etc?
>> 
>> get last item of line 2 of url "http://ichart.finance.yahoo.com/table.csv?s=RBS.L"
>> 
>> but rather, 
>> 
>> How would you get and display the latest stock price for RBS.L from the internet in Rev/ Java/C/etc?
> 
> 
> The significant thing in Rev is that you can get the thing you want in one line. With other languages you have to dispatch a request for the URL, set up a listener for when it's come back, then handle the contents of the event. Doing it that way does make it more asynchronous, you're not halting everything else for the time it takes to get the text back, but it is several more steps to deal with.

Yes, but a litigious ActionScript scripter using Adobe's Flex might argue you can also do the above task with a single line of code, indeed a shorter one. (myHttpService.send() ) So long as the contest rules don't include XML descriptions of objects in the definition of code. (In Flex, you can use XML to define a programs's layout, and also bind text fields to the results of http calls, so no listener is necessary.) But it doesn't mean it's any easier to do in Flex overall. Just the opposite, I'm sure.

I just don't think that pure code comparisons provide accurate comparisons of what's involved. And can perhaps deflect attention from the benefits of using Rev. With the stock quote example, I can open Rev, write my script and see the result without saving a single file.  I'd even be willing to write a few more lines of code in Rev if it was required rather than sacrifice the overall simplicity of completing the task in hand.

Cheers
Dave


More information about the Use-livecode mailing list