Saturday Hackathon: Client-Side MVC - The Wrong Way

Posted August 27, 2010 at 10:23 AM by Ben Nadel

Tags: Javascript / DHTML

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.


 
 
 

 
Hackathon!  
 
 
 

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.




Reader Comments

Aug 27, 2010 at 11:21 AM // reply »
66 Comments

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.

Good luck!


Aug 27, 2010 at 11:32 AM // reply »
10,638 Comments

@Rick,

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).


Aug 27, 2010 at 5:58 PM // reply »
134 Comments

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.

OHHHH SLAMMMMMM.


Aug 29, 2010 at 1:26 PM // reply »
10,638 Comments

@David,

Ha ha ha - well played good sir :)

@All,

Here's where I ended up going with all of this:

http://www.bennadel.com/blog/1999-Reflections-On-My-Client-Side-MVC-View-Rendering-Hackathon.htm


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Feb 3, 2012 at 10:49 PM
How I Got Node.js Running On A Linux Micro Instance Using Amazon EC2
Wow this was really helpful! Only thing I would add is you need to update your .bash_profile after you edit the secure_path. This is what I did: $ . ~/.bash_profile Otherwise, NPM won't be found. ... read »
Feb 3, 2012 at 10:14 PM
Pushing Base64-Encoded Images Over HTML5 WebSockets With Pusher And ColdFusion
@Ben, Just wanted to let you know that pusher are soon to start limiting sizes on messages. This was the detail that came through in the Feb dispatch: "However, we will soon be limiting the s ... read »
Feb 3, 2012 at 5:05 PM
Regular Expressions Make CSV Parsing In ColdFusion So Much Easier (And Faster)
I tried using your RegEx in my C# program, but it was matching an extra empty-string at the end and so I would end up with an extra field that doesn't exist, so I changed it to this: (^|,)("(?: ... read »
Feb 3, 2012 at 3:47 PM
ColdFusion Supports HTTP Verbs PUT And DELETE (As Well As GET And POST)
Josh Cyr posted this on Twitter just a little bit ago. Thought it was appropriate. http://stackoverflow.com/questions/1619152/how-to-create-rest-urls-without-verbs/1619677#1619677 ... read »
Feb 3, 2012 at 2:28 PM
Changing The Execution Context Of Your Self-Executing Function Blocks In JavaScript
@Michael, You definitely make a good point (and extra points for quoting movies - I love movies). When you use a return() statement to define the object's public API, it does provide a consistent a ... read »
Feb 3, 2012 at 2:04 PM
Changing The Execution Context Of Your Self-Executing Function Blocks In JavaScript
To quote Jurassic Park: "Just because you can doesn't mean you should". I completely, utterly disagree with the thought that this is more readable. Consider the current module pattern: if ... read »
Feb 3, 2012 at 1:10 PM
REST API Design Rulebook By Mark Masse
@Jordan, Yeah, WRML was created by Mark Masse (author of the book). I also found it to be a bit convoluted. I suppose it is intended to allow the Client to be able to programmaticaly respond to cha ... read »
Feb 3, 2012 at 1:08 PM
ColdFusion Supports HTTP Verbs PUT And DELETE (As Well As GET And POST)
@Jason, To be honest, I don't have good answers for that kinds of stuff. And, to the point, that is specifically why I *really* liked the REST API Design Rulebook by Mark Masse - he just cuts throu ... read »