Limelight at RailsConf 2008

Back at RubyConf 2007 I prepared a 1 minute presentation, well…more of a teaser, about an application framework called LimeLight.

What is it? LimeLight is a selfish dream of mine. In a nutshell it’s a light weight ruby framework for building rich client applications. To explain further, know this.

I hate building web applications. Not because they’re hard to build or anything silly like that.

It’s because they’re so perverted. Writing web apps makes me feel dirty; as though I’ve sunk into a pit of waste and decay where the foundation of my work is a pool of sludge.

No matter how hard I may try, the very nature of modern web apps taints my code and leaves me a sour, grumpy developer.

Stop

To understand what I mean, consider the trivial little widget above. Try clicking the button and watch the light blink.

Simple huh? Can you count the number of languages/technologies used in implementing this widget? And don’t forget the code required on the server side…

I count 5. That is, in most cases this widget would require about 5 or more different languages. Let’s count. HTML of course. CSS to make it look right. JavaScript.

That’s 3, but in most cases you’ve got server-side code which, if you’re lucky, involves Ruby and ERB. Think about it. You need to know 5 difference languages to build that silly widget. Yikes!

I’ll include the code below. Know that I’ve made every effort to make this code as clean and simple as possible. Still, I would need to borrow your hands and feet to count all the things I find distasteful about it.

Have a close look. Ask yourself, “Couldn’t there be an easier way to do this?” I say there is.

 1 <div style="border: 1px solid blue; width: 100px; height: 100px; text-align: center; background-color: white;">
 2     <div id="light" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; width: 50px; height: 35px; margin-top: 10px; margin-right: 24px; margin-bottom: 10px; margin-left: 24px; text-align: center; padding-top: 15px; background-color: red; ">Stop</div>
 3     <input type="submit" id="button" value="Start" onclick="stopOrGo();">
 4     <script type="text/javascript">
 5         function stopOrGo() {
 6             var button = document.getElementById('button');
 7             var light = document.getElementById('light');
 8             if(button.value == 'Start') {
 9                 start(button, light);
10             }
11             else {
12                 stop(button, light);
13             }
14         }
15 
16         function stop(button, light) {
17             light.style.backgroundColor = "red";
18             light.innerHTML = "Stop";
19             button.value = "Start";
20         }
21 
22         function start(button, light) {
23             light.innerHTML = "Go!";
24             button.value = "Stop";
25             blink();
26         }
27 
28         function blink() {
29             var light = document.getElementById('light');
30             if(light.innerHTML == "Go!")
31             {
32                 if(light.style.backgroundColor == "green") {
33                     light.style.backgroundColor = "lightgrey";  
34                 }
35                 else {
36                     light.style.backgroundColor = "green";
37                 }
38                 setTimeout("blink()", 500);
39             }
40         }
41     </script>
42 </div>

If you’d like to learn more, I’ll be presenting on the topic at RailsConf 2008. Or you can come back this this blog site later. I’ll be sure to post any exciting progress.

Micah Martin, Chairman, Founder

Micah Martin is co-founder of 8th Light and is known for his open source work such as FitNesse, Limelight, Joodo, and Speclj.