Sunday, July 10, 2011

Functional UI programming

I started using Scala recently to develop a movie player as a side project, with the goal of using functional constructs whenever possible. I found myself using imperative-style programming when interacting with the UI framework. This got me thinking, is there a functional state-less way to develop UIs? A bit of Googling revealed the following:

  • StackOverflow post that talks about this problem and references functional reactive programming (FRP). 
  • The Haskell people have developed UI frameworks around FRP.
  • For the rest of us non-Haskell people, there is Flapjax, an FRP model built on top of JavaScript for the web.
  • The spreadsheet is an example of a FRP model where cells are re-evaluated when dependent values change.
  • Clojure creater Rich Hickey recommends sticking with state-ful programming but keeping it to a minimal.

Thursday, January 13, 2011

Drupal Developer Modules

Imagine if Firebug disappeared all of a sudden and you have to build a website/app without it?

I came across 3 Drupal modules for development that will help you do better customization, improve performance and responsiveness of the beast, and help flatten that learning curve. These modules may even get you to start thinking about using Drupal in the web application space, as opposed to a mere brochure-ware. After spending 30 minutes with these modules, you're going to feel like you've been developing without Firebug. Drupal development may even be fun.

Devel - 61k sites report using it, which probably means that you should be using it. This is the core development module that provides the usual SQL query profiling, node debugging, etc..

DrupalForFirebug - 5k sites using it. The name is exactly what you think. Never again will you do var_dump($node). You can see SQL queries profiled. And it's all organized in Firebug into separate Drupal tab (as opposed to a Firebug console dump). There's even a Chrome extension.

Devel Themer - 2k sites using it. The Firebug Drupal extension is a sleeper compared to this. When enabled, you can hover almost any piece of content (like Firebug) and see the Drupal function call and/or theme file that emitted it. It even shows the arguments of the method and tells you what template file to create to override the function. This makes it MUCH easier to customize the output of piece of content because you no longer have to track down the 10s/100s of files and piece together what is calling what. Watch this screencast: