Saturday Hackathon: Client-Side MVC - The Wrong Way
Posted August 27, 2010 at 10:23 AM by Ben Nadel
Over the past week, I've heard a number of people talk about various hackathons, hack days, pitch days, and general all-night coding adventures. I've never attended one of these events and I have to say, hearing about them makes me more than a little bit jealous. I understand that a majority of the fun that people get out of these things is due to the fact that you have so many people together doing the same thing. But, I'm an impatient man and I believe that the next hackathon in my area is Ruby-based. As such, I figured I would get a little taste of the sweet hack day experience this Saturday... on my own.
| || || |
| || |
| || || |
After 10PM, my brain is mostly useless - I've never been an all-night person. So tomorrow, I've blocked off 9AM to 9PM to see what I can get done in 12 hours of uninterrupted coding. My goal: to build a small, client-side MVC-based application using a completely inappropriate approach to View rendering. I know that it might sound strange to explore sub-optimal solutions; however, I hope that by embracing failure ahead of time, I will be able to turn the landscape of my mind into a fertile ground ready for the seeds of learning.
When a user makes a request to one of my ColdFusion applications, I typically build the content areas of the page before I render the final template. In this approach, page rendering is performed in somewhat of an inside-out manner. This works really well on the server side because successive requests are disconnected and every request has to re-render the requested page. On the client side, however, AJAX technology allows us to maintain a complex view state across requests. As such, a complete re-rendering of the markup on the client-side is undesirable. But, as undesirable as it may be, it is this very approach that I am going to try and implement.
I know this sounds crazy, but I want to feel the pain of poor architecture. In the past, I've seen people demo some really amazing code; but, until I feel the pain of the problems that these demos are trying to solve, I believe that there will always be a hesitation on my part to accept their value. This personal hackathon is my attempt to find the right path by identifying the wrong one. And, hopefully, I'll have a moment or two of insight along the way.
I look forward to hearing how this goes.
I just spent several hours yesterday writing a new homework for my students in my Advanced Database Structures course. The homework works through the basics of CouchDB and Map/Reduce, and ends with them building a simple jQuery-based interface to the iTunes track info they've exported to CouchDB. Since the HTML and JS are all stored in CouchDB itself, the server-side programming is all pure JS and sort of melts into the jQuery on the client side. It's easy to think of it as a pure client-side app.
It's weird teaching two courses that are sometimes at odds with each other -- I show them how to do tons of stuff with CF on the server side ... and then I show them how to eschew CF altogether with CouchDB+jQuery. So, yeah, I get where you're going with your hackathon.
Sounds really interesting! Are you storing stuff in the CouchDB with a REST API? I hear that's what's really cool about these new NoSQL DBs - they have HTTP-based API interactions.
I'm looking forward to it (and to the excuse to drink more caffeine than usual).
Correct me if I'm wrong, but aren't you already feeling the pain of poor architecture? I could've sworn you switched to mac a few weeks ago.
Ha ha ha - well played good sir :)
Here's where I ended up going with all of this: