revjim.net Rotating Header Image

Inklog: a comparison

Often times I catch myself wondering why I don't just use one of the many Struts implementations for PHP instead of rolling my own when I write Inklog. That's when I realize the fundamental difference between the two.

Struts allows you to access "web pages" like you'd access an object… kind of. Each page had programmed actions or methods that make it appear to be an object addressable by URL. And Inklog works in the same fashion. It's a bunch of objects that implement a specific interface. The user can request the access of a particular method on each object via a constructed URL. However, with Struts, each new "page" is programmed. Meaning, in order to add a new "page", the parent of that page must be extended in code. This means that each new "page" will require PHP code. Now, that PHP code can be written in a way to allow different pages to be displayed, but, which particular page would be denoted as a parameter passed to a method of the programmed object. Inklog works differently. Entire objects are stored, not programmed. Objects of one type operate differently than objects of another type. These objects can be represented with properties, methods, and can contain other objects entirely. The properties of an object are unique to it. And it's methods are programmed only once inside of the class that implements an object of that type. A clearer way of seeing the difference between the two can be seen by looking at URLs that might access the same object from each environment:

Accessing a weblog entry:

Struts:
http://me.com/blog?action=view&format=html&item=mydayinreview

Inklog:
http://me.com/mydayinreview?action=view&format=html

Accessing an image:

Struts:
http://me.com/images?action=view&format=jpeg&item=aboutme/picture

Inklog:
http://me.com/aboutme/picture?action=view&format=jpeg

Accessing a gallery item:

Struts:
http://me.com/gallery?action=view&format=html&item=travel/canada/sudbury/lakeramsey

Inklog:
http://me.com/travel/canada/sudbury/lakeramsey?action=view&format=html

You can see immediately that, with Inklog, the data you are accessing is an object. With Struts, you are accessing an object and asking it to display a particular piece of data.

Another interesting feature of Inklog is that each object can have default actions, therefore, as long as the action you are requesting is the default, you don't need to specify it. Additionally, objects can have default output formats, which means you have even less to specify in the URL. Furthermore, the agent that handles the request can be easily programmed to accept URLs in whatever format the website owner chooses. Therefore, if the same three URLs you see above were on my website, they'd probably look like this:

http://me.com/mydayinreview.html
http://me.com/aboutme/picture.jpeg
http://me.com/travel/canada/sudbury/lakeramsey.html

I hope that helps make things even more clearer for you eager Inklog fans.

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Digg
  • del.icio.us
  • Google
  • Reddit
  • Technorati
  • Furl
  • Spurl
  • Live
  • Pownce
  • TwitThis