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 »
67 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 »
11,246 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 »
149 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 »
11,246 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
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 24, 2013 at 5:39 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
@Adam Oops! My mistake! I hadn't gotten that far in my testing - I'm still baby stepping my way through the process. ... read »
May 24, 2013 at 5:13 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
Hi Jason, Thanks for checking up on that, but I still stand firm on my position. :) There are actually two listLast()'s in use, and you're right that the one using a space as a delimiter is fine. ... read »
May 24, 2013 at 4:45 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
@Ben I have been lurking your site for quite some time, and haven't stepped up to comment until today. Thanks for all the great info - keep it up! @Adam I believe you are mistaken... as the commen ... read »
May 24, 2013 at 11:21 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
@WebManWalking, Ha ha, let's us never speak of justifying "##" notation again :P ... read »
May 24, 2013 at 11:18 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
@Ben, Ah, so it was indeed how I vaguely remembered it to be: A direct assignment value = users.id[ i ] causes value to retain the sticky datatype of the query column. Although unnecessary in ... read »
May 24, 2013 at 9:11 AM
Preventing Links In Standalone iPhone Applications From Opening In Mobile Safari
@Brandon, Hi, No, I haven't been able to do that. I have just kept it as it is. ... read »
May 23, 2013 at 9:52 PM
Preventing Links In Standalone iPhone Applications From Opening In Mobile Safari
@Muhmmadibn Did you figure out a solution to launching PDFs? I am running into the same issues myself. There is no way to close the PDF or go back once you launch it. Thanks in advance! ... read »
May 23, 2013 at 6:06 PM
The Girl Who Broke My Heart, And Made Me A Better Person
Good day,ladies and gentle men, my name is Dr AMADI the great spell caster in Africa, i have help so many people for different kind of problems,who say there is no solution to problems on earth, that ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools