Monday, July 31, 2006

jvoorhis | What’s New in Edge Rails: Restful Routes

Restful Routes talks about the new RESTful programming models that are now possible in Rails (now in Edge, soon to be in the released version).


In this case, the url /comments/1;approve would be created. The rationale is to use the path to the left of the semicolon for a resource’s identity, and to use the path to the right of the semicolon as a modifier. Frequently this modifier would be an operation that you would perform on the resource, such as approving a comment that requires moderation.


This isn't very restful. This modifier hack is just another way to force another verb into the mix.

The best way to be more RESTful would be to PUT a representation of the comment with the approval flag set to true. In REST, representations of resources are exchanged. Instead of referencing the URI of the comment, with a verb modifier stuck on the end, send along a representation of the whole comment.

Now, you're saying, "But how do I do that in Rails?" This is, of course, very difficult. Most of the fault lies with the XHTML spec, which has been updated to support full method selection in form actions, or the inability to send form data as XML. You don't really care about the representation format, so the current name=value pairs would work OK as the body of the PUT. But a lack of PUT as a form action? It's a RESTful crime.

Another way to be more RESTful would be to create a new resource, a collection that accepts ApproveComment documents. This is a document style web service, but minus the SOAP. This models the event that is "Approve this Comment". You can then POST this new even to the /comments/approval_queue. The representation would include the comment id you want to approve.

This intermediary resource is similar to why Rails has introduced :has_many :through. Those old many to many join tables are old and busted, and first class join models are the new hotness. They function to enrich the domain model and make relationships themselves a first class citizen. I think of these new documents, the ApproveComment document, as filling in the same type of gap.

The URI, /comments/1;approve, both identifies the noun and the verb. To me, that violates a central tenent of REST, in that you should only need the CRUD methods. I see no difference between /comments/approve/1 and /comments/1;approve when talking about the intended consequences of the user's request.

It's great to see Rails try to be more RESTful, don't get me wrong. They are doing some great work here. I'd like to see them take it even farther, and use only the HTTP verbs (GET, POST, PUT, DELETE) and make new documents (representations) for what would have been that URI modifier.

Friday, July 28, 2006

XML.com: What Is RDF

XML.com: What Is RDF has been updated for Summer 2006. The last update was back in 2001.

Sunday, July 23, 2006

del.icio.us links and How To Get Them To Be Useful

On the theme of "How to get my del.icio.us links to be useful", I have another idea.

Problem: My del.icio.us links are a blackhole, where good links go, never to be retrieved again.

Hypothesis: Why are they never able to be retrieved? I believe it's because there is no good way to pull them back out at the moment I need them.

Solution: My computer should *know* what I'm doing, and do the search or lookup for me in real time. Google is good for when I need a specific answer to a question. del.icio.us is good for when I don't even know I know the answer.

Let me explain.

Let's say I'm writing some Ruby on Rails code. As I'm performing Rails related tasks, shouldn't my computer say, "You're writing some Rails migrations. Here's your del.icio.us links related to migrations." Sounds a bit Clippy (It's looks like you're writing a business letter?!), but I think it would be useful. I want those information nuggets (my del.icio.us links) to appear when I need it most, and disappear when I don't need it.

This is a sort of anticipatory retrieval, as the computer is performing searches and information gathering as I work. These search results are then waiting in the wings, ready to be integrated into whatever task I'm performing.

There's a fine line between helpful and annoying. But if the search results are sufficiently in the background, with just a small hint of, "Hi, I noticed you're doing X, I found some tips that might be helpful. If you're having problems, click me and I have hints."

To me, the problem with del.icio.us, is that I don't know what I put in there. I need the computer to tell me I already found a link for that problem.

Friday, July 21, 2006

del.icio.us + google would be nice

Just thinking about how to get better ROI from my del.icio.us links. I typically put links in there that I want to retrieve later, usually multiple times. I don't put transiently interesting links in there usually, as I know I'll never go back there. I use del.icio.us to store links I know I'll want to refer to again and again.

Problem is, del.icio.us is a black hole. I throw stuff in there, and I never return to it. Why? Because the little Google search box in firefox makes it way to easy to just search google.

What I need is a single search box, but with the ability to search google and del.icio.us. I want to see my del.icio.us links have very high priority on my google searches. If I can integrate the two databases, then I'd have something special.

I'm sure there's a way to do this with a firefox plugin.

There real issue is, "How do I know I put something into del.icio.us?" Once it's in there, how do I know I'm even able to retrieve it? That's why google works so well, because I don't have to know if it exists or not.. I just assume it does. With del.icio.us, that assumption isn't valid all the time. But my workflow doesn't involve me asking myself, "Maybe I bookmarked it, so first let me search del.icio.us" I need the searching of my bookmarks and the whole web to be integrated into one simple search.

Tuesday, July 18, 2006

Grand Text Auto » Google’s Norvig Questions Berners-Lee on the Semantic Web

Grand Text Auto » Google’s Norvig Questions Berners-Lee on the Semantic Web closes its post with this excellent quote:


Although Berners-Lee closed by encouraging everyone to contribute data that they had in RDF to the Semantic Web, here I am typing up a blog post instead

Disclaimer

I'm probably required to say that the views expressed in this blog are my own, and do not necessarily reflect those of my employer.