Tuesday, April 15, 2008

Access RESTful API in 2 LOC

Today I was playing with json-lib and FriendFeed API in Groovy console and was able to fetch feed's JSON representation and do a simple result filtering in 2 lines of code! So, for example, here are all my recent twitter entries (filtered from all the other content e.g. different services like flickr, amazon, etc.):


import net.sf.json.*

def friendFeedJsonResponse = new URL('http://friendfeed.com/api/feed/user/dima767').text
JSONObject.fromObject(friendFeedJsonResponse).entries.
findAll { it.service.id == 'twitter' }.
each { println it.title }
I know it is a very simple example, but IMO, with an 'expressiveness' and 'compactness' of Groovy, in the majority of cases, there is no need for a 'wrapper' library and various web APIs could be used 'as is'

Later...

Thursday, April 10, 2008

Grails in a 'Cloud'

These days, the new generation of computing, so called 'cloud computing', where the infrastructure of the entire data centers is outsourced, abstracted, and hosted somewhere in the 'cloud' (on the Internet), is getting hugely popular. In a nutshell, it provides a so called 'low barrier to entry' for smaller internet companies to make their presence on the Internet market place without spending a fortune and ridiculous amount of time and energy buying their own hardware and maintaining their own data centers.

Amazon EC2 service hugely popularized this type of computing and early this week, Google jumped on the bandwagon with their App Engine exposing the power of their computing infrastructure, as well as the entire web development stack (Python-based - what else did you expect from Google) :-) to the army of ordinary, but creative software development minds.

After the announcement, Google has received feedback from developers requesting support for different programming languages/frameworks, and among Perl and Ruby, the requests for Java/Groovy/Grails are overwhelming.

Now that we have a rock-solid RAD web framework for Java (Grails that is), we are just missing the last piece of the puzzle: a rock-solid and affordable Grails hosting in a 'cloud'. The demand seems to be there. Hint, hint for ambitious start up companies :-)

Later...

Friday, April 4, 2008

So enjoyable

While hacking GrailsCrowd today, I caught myself thinking that programming in Groovy is such an enjoyable experience (for me). Take this method for example:


// Social feature: gets a list of 'colleagues' working on the same projects as *this* member
def getProjectColleagues() {
getActiveProjects().collect
{it.participants}.flatten().findAll
{it.participant.id != this.id}.collect {it.participant}
}
Is it possible to navigate "deep" object graph and express the same intent with the similar compactness in 'raw' Java code? I think not :-)

Later...