IT Poetry


A fragment of Qi4J
November 22, 2007, 12:09 am
Filed under: Programming, personal | Tags: , , , , ,

Qi4J logoI had the pleasure of attending the Oredev conference here in Sweden last week. Where Richard Oberg (Öberg, founder of JBoss) introduced the concept of Composite Oriented Programming (COP), specifically Qi4J with slogan “Classes are dead, long live interfaces”.

Composite oriented programming is about fragmenting the constraints, concerns, side effects and actual behavior of your beans into fragments (implemented by “Mixins”) which are brought together by a composite.

These are some things you can do with composites:

  • A typical constraint of a bean is to not allow null values. -Move this constraint to a generic constraint checking for null or empty values in the setters.
  • A typical side effect of a bean is to invalidate a cache when invoking a setter or logging invocations that take an unexpectedly long time. -Move these side effects to generic mixins.

These examples look very much like Aspect oriented programming, but I think that fragmentation should be applied on a higher level in the application design. Another difference with AOP is that control of the aspects of an object is moved from the AOP rules into the definition of a composite, which should give more transparency and flexibility.

If you are interested, the Qi4j website is still quite immature, and it is quite frustrating trying to penetrate the essence of the framework, but i recommend starting with a Composite Example.

The most interesting part of the Qi4J initiative is the model in which it is developed. After their presentation, I got a chance to speak with the guys from Jayway which have sponsored the project so far. Qi4j is hosted on OPS4J (Open Participation Software for Java), which is working like a “Wiki brought to coding”. The idea with the OPS4J hosting is that anyone should be able to contribute without having to be accepted by the group. The commits will be moderated like on Wikipedia. This is probably a fantastic way to get people to start contributing. But I suppose it is very risky not having control over the commiters to steer the project towards a road map. It shall be very interesting to follow Qi4J, and as the Jayway people said: “Now we are what the Spring framework was in 2003″.



Information hubs
November 20, 2007, 3:24 pm
Filed under: Internet

Flickr is a pretty interesting online photo sharing service.

  • It has pretty lousy user pages with almost no control over the page appearance
  • It has some lousy discussion features, where discussions are organized either by latest comment or chronologically
  • It has a groups system where you can post your pictures.
  • You can comment on pictures, make the photographer a “friend” and add photos to your “favourites”. Even still it is not super convenient to keep track of photographers of interest.
  • (It has geotagging with integration with Yahoo maps, which is cool and slowly getting useful. Will probably explode in popularity when GPS is embedded in the cameras)

The interesting part of its success (2 billion uploaded photos) is its open API. Letting you delegate trust in a controlled way to third parties without giving out your password. You can also revoke access whenever you feel like from a list of all active permissions.

One aspect I don’t like is how flickr give out programmatic access to “public” content to anyone on the internet without explicit permission from its users. (Remember the days when “public” ment public to only the community users?) I don’t think this affects flickrs popularity since its something you don’t realize until its too late and you’re already using the service.

Well, the features that flickr lack is available through third party “addons”. Like FlickSlidr, where you can create embeddable slideshows for with your or somebody elses photos. Or a yahoo pipes implementation, where you can see your “contacts” favourite pictures. BigHugeLabs has a vast collection of tools like these.

Esentially, flickr is like an online hard drive of photos, where applications are on the Internet.

Similarly, I hope that the online document editors that are emerging will open up to something similar. It would be utterly convenient to have an online document storage where I could place my documents to be edited with the best online editing tools. The storage solution could specialize in storage-centric features, (that we all would love on our hard drives) like versioning, tagging, indexing, sharing, available time windows, branching/merging, licensing, backup to own hard drive, and other cool storage features.

Amazon S3 is a cool service where Amazon is sellining its great storage solution to others. But since it doesn’t have these features, all i’ve seen it being used for is as a backup solution.



Loose the task bar
November 18, 2007, 4:24 pm
Filed under: Productivity

Lets build on our work so far with shortcuts in the path, by adding shortcuts to the keyboard. (Like the ones that come with “multimedia keyboards” but more powerful)

The idea is to make all your commonly used programs available as keyboard shortcuts, so that you can switch between them without using alt-tab. The programs will even be started for you if they aren’t runing. This will save time and add predictability. You will also get the benefit of being able to start dragging an object, pressing the application shortcut then drop the object into the application that magically appeared as you dragged the object! (It’s no longer really a drag, but a pin, hover, focus new application, drop)

The method I use and recommends builds on the excellent tool, AutoHotkey (windows scripting freeware).

  1. Download and install AutoHotkey,
  2. AutoHotkey will be installed with a default script that you can edit. (If you’re ambitious, you can modify the autorun link to run a script in your documents folder)
  3. Start your script with the following line:
    SetTitleMatchMode 2
  4. For each application that you commonly use, decide on a shortcut and enter code following this template.
  5. The titles will have to be customized according to the language of your windows installation.

#n::
IfWinExist Untitled - Notepad
     WinActivate
else
     Run Notepad
return

This script will make sure you have an unsaved notepad document whenever you press [Windows]+N.
This says, when pressing the [Windows]+N keys, activate a window called ‘Untitled – Notepad’ if it exists. Otherwise run the Notepad application which is available on the path.

Since I have a link to Microsoft Outlook in my c:\path directory I can get to my inboxy by typing [Windows]+M


#m::
IfWinExist Microsoft Outlook
     WinActivate
else
     Run outlook
return

And I get my browser by typing [Windows]+I

#i::
IfWinExist Mozilla Firefox
     WinActivate
else
     ;assumes that ff is a shortcut on the path pointing to firefox.
     Run ff
return

Autohotkey is an excellent free scripting tool, also featured in lifehacker.com and lifehack.org.
Many other resources on Google.



Delicious links
November 18, 2007, 4:16 pm
Filed under: Productivity

Daunted by your link collection?
I used to be, as I had a few hundred links in my link collection, partly organized in folders. The funny thing is, Google is much better at finding the right page from the entire web, than I was at finding the right link from my own link collection. Even still, it is comforting to “save” the gems of the web for later.
Enter del.icio.us!
Delicious is a catalog of tagged links where you can save links with keywords on the web. No need to synchronize computers, and links are easy to find by keywords. This way, you can tag pages with “todo” keywords or similar.

Its not necesarry, but much snappier to use with a plugin for firefox.

Firefox 3 apparently has some similar features in the making.