Limelight at RailsConf 2008

Limelight at RailsConf 2008

Micah Martin
Micah Martin

February 04, 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.

<div style="border: 1px solid blue; width: 100px; height: 100px; text-align: center; background-color: white;">
		<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>
		<input type="submit" id="button" value="Start" onclick="stopOrGo();">
		<script type="text/javascript">
				function stopOrGo() {
						var button = document.getElementById('button');
						var light = document.getElementById('light');
						if (button.value == 'Start') {
								start(button, light);
						} else {
								stop(button, light);
						}
				}

				function stop(button, light) {
						light.style.backgroundColor = "red";
						light.innerHTML = "Stop";
						button.value = "Start";
				}

				function start(button, light) {
						light.innerHTML = "Go!";
						button.value = "Stop";
						blink();
				}

				function blink() {
						var light = document.getElementById('light');
						if (light.innerHTML == "Go!") {
								if (light.style.backgroundColor == "green") {
										light.style.backgroundColor = "lightgrey";
								} else {
										light.style.backgroundColor = "green";
								}
								setTimeout("blink()", 500);
						}
				}
		</script>
</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.