<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>getiblog</title>
	<atom:link href="http://blog.getify.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.getify.com</link>
	<description>open-source, performance, javascript &#38; ui musings</description>
	<lastBuildDate>Mon, 23 Aug 2010 20:50:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>#SXSW &#8216;11: &#8220;Performance Enhancing Drugs&#8230;for the web&#8221;</title>
		<link>http://blog.getify.com/2010/08/sxsw-11-performance-enhancing-drugs-for-the-web/</link>
		<comments>http://blog.getify.com/2010/08/sxsw-11-performance-enhancing-drugs-for-the-web/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 20:50:24 +0000</pubDate>
		<dc:creator>getify</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://blog.getify.com/?p=523</guid>
		<description><![CDATA[

We all know that web performance optimization is important, especially if you care about Google/SEO value and your users. But most developers only consider the checklist items in YSlow and PageSpeed. These tools, however, barely scratch the surface. Get ready to get your hands really dirty.

Just confirmed: Tom Hughes-Croucher, Platform Evangelist for Yahoo! and web [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://panelpicker.sxsw.com/ideas/view/5751"><img src="http://getiblog.2static.it/wp-content/uploads/2010/08/sxsw-perfdrugs.png" alt="Go vote for this topic!" title="SXSW &#039;11: &quot;Performance Enhancing Drugs... for the web&quot; -- Go Vote!" width="500" height="459" class="aligncenter size-full wp-image-524" border="0" /></a></p>
<blockquote><p>
We all know that web performance optimization is important, especially if you care about Google/SEO value and your users. But most developers only consider the checklist items in YSlow and PageSpeed. These tools, however, barely scratch the surface. Get ready to get your hands really dirty.
</p></blockquote>
<p>Just confirmed: <a href="http://twitter.com/sh1mmer">Tom Hughes-Croucher</a>, Platform Evangelist for Yahoo! and web infrastructure guru, will be joining me for this talk! Please <a href="http://panelpicker.sxsw.com/ideas/view/5751">go vote for us now</a>, we&#8217;d really appreciate it!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.getify.com/2010/08/sxsw-11-performance-enhancing-drugs-for-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSConf 2010 &#8211; getify on middle-end/ui architecture</title>
		<link>http://blog.getify.com/2010/08/jsconf-2010-getify-on-middle-endui-architecture/</link>
		<comments>http://blog.getify.com/2010/08/jsconf-2010-getify-on-middle-endui-architecture/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 18:25:10 +0000</pubDate>
		<dc:creator>getify</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UI Architecture]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[middle-end]]></category>
		<category><![CDATA[ui architecture]]></category>

		<guid isPermaLink="false">http://blog.getify.com/?p=516</guid>
		<description><![CDATA[JSConf 2010, Track B, "Dude, Where's My UI Architecture?"]]></description>
			<content:encoded><![CDATA[<p><embed src="http://blip.tv/play/g_MngemSLgI%2Em4v" type="application/x-shockwave-flash" width="480" height="346" allowscriptaccess="always" allowfullscreen="true"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.getify.com/2010/08/jsconf-2010-getify-on-middle-endui-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node.js: The end of the middle?</title>
		<link>http://blog.getify.com/2010/07/node-js-the-end-of-the-middle/</link>
		<comments>http://blog.getify.com/2010/07/node-js-the-end-of-the-middle/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 19:30:29 +0000</pubDate>
		<dc:creator>getify</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UI Architecture]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[middle-end]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://blog.getify.com/?p=480</guid>
		<description><![CDATA[If you haven&#8217;t yet read my ode to why Node.js is awesome, stop and go do so now. It should be no surprise by now that I am giddy like a school girl over the idea of using server-side JavaScript to revolutionize the web application stack. And perhaps no other project has captured more of [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t yet read my <a href="http://blog.getify.com/2010/07/why-node-js-rocks-the-middle-end">ode to why Node.js is awesome</a>, stop and go do so now. It should be no surprise by now that I am giddy like a school girl over the idea of using server-side JavaScript to revolutionize the web application stack. And perhaps no other project has captured more of the imagination and zealotry from the JavaScript developer community as <a href="http://nodejs.org">Node.js</a> has over the last 6-9 months. It&#8217;s undeniable that Node.js will continue to be one of the most important players in this emerging &#8220;market&#8221;.</p>
<p>But silver-bullet or the second-coming of the web? I&#8217;m not so sure Node.js can quite claim that status. Here, we&#8217;ll investigate the counter-point to Node.js, especially as it relates to practical usage in the middle-end. Raining on the parade may not be fun, but if we&#8217;re gonna gulp down the delicious Node.js grape kool-aid, we&#8217;re also gonna have to stomach a healthy amount of that ick-tasting Node.js cough syrup (that&#8217;s right, I just mixed 3 metaphors in one sentence!). We owe this topic some intellectual honesty and debate.</p>
<h4>Brad Pitt in &#8220;Interview with a devil&#8221;</h4>
<p>I want to (re)introduce you to a good friend of mine. He&#8217;s exceedingly well known, and I&#8217;m sure you&#8217;ve met him many times before. He&#8217;s not a popular guy by any means &#8212; probably more infamous than famous &#8212; but he can be very assistive in times when the hype of something <em>new</em> clouds our judgement of the things we already <em>knew</em> well.</p>
<p><span class="me"><strong>Me:</strong> Devil&#8217;s Advocate (&#8220;DA&#8221;), welcome to the show. I&#8217;m glad you could join us for this discussion today.</span></p>
<p><strong>DA:</strong> Thank you for inviting me over for some tea and a lively discussion. You know how much I enjoy calmly reminding people of reality, and in the process spoiling a lot of their fun.</p>
<p><span class="me"><strong>Me:</strong> DA, are you saying you <em>like</em> being the least popular guy at the party? A lot of people think you are a Contrarian&#8230; that you just like to disagree for the sake of disagreement, and that you don&#8217;t really <em>help</em> the discourse very much. What do you think of that characterization?</span></p>
<p><strong>DA:</strong> Well, that&#8217;s true that most people probably think of me that way. But that&#8217;s ok, I am secure in my manhood and it doesn&#8217;t bother me that much. I&#8217;m used to intellectual rejection. I mean, look at how hard I&#8217;ve been working to try and wake people up to Apple&#8217;s antics with the iPhone 4 antenna, and yet the masses still cling to Jobs&#8217; every word like he&#8217;s a prophet or&#8230;</p>
<p><span class="me"><strong>Me:</strong> Ok, DA. Let&#8217;s not get off on that tangent here. That <em>is</em> a fun topic, but we&#8217;ve got more important things to deal with today.</span></p>
<p><strong>DA:</strong> Sorry, sometimes I just get carried away. But I do think my methods are helpful in encouraging people to question certain assumptions and make sure that all sides of a topic have been examined thoroughly.</p>
<h4>Hello World</h4>
<p><span class="me"><strong>Me:</strong> That&#8217;s good. Let&#8217;s jump right in. I know you read my previous post where I gushed over how awesome Node.js is and where I explored how it might fit with the middle-end concepts I&#8217;m advocating for.</span></p>
<p><strong>DA:</strong> Of course. I wrote that little editorial sidebar as a preview of our discussion today.</p>
<p><span class="me"><strong>Me:</strong> Right. So, tell the readers, what do you think of Node.js?</span></p>
<p><strong>DA:</strong> It&#8217;s awesome. Really it is. But it&#8217;s awesome for a specific set of tasks and for a specific kind of scenario. We have to be careful to remember that even though it&#8217;s very exciting for developers to jump on board and start experimenting with a new implementation like Node.js, that doesn&#8217;t mean in any way that it&#8217;s going to work for everyone.</p>
<p><span class="me"><strong>Me:</strong> Obviously not, no one technology is ever right for everyone. I don&#8217;t think anyone is suggesting that. Seems like you&#8217;re just chewing on the soggy cheerios.</span></p>
<p><strong>DA:</strong> No, it&#8217;s more than that. I&#8217;m actually trying to help people realize <em>exactly</em> what Node.js <em>is</em> and <em>is not</em>, so that we can have productive discussions not only about Node.js and its uses, but <em>also</em> about other alternatives for the rest of the crowd.</p>
<p><span class="me"><strong>Me:</strong> Don&#8217;t you think it&#8217;s just too early to be judging what Node.js can and cannot do? I mean, isn&#8217;t it possible that it&#8217;ll grow to be useful in more parts of the stack as time goes on?</span></p>
<p><strong>DA:</strong> It&#8217;s entirely possible and likely that Node.js will continue to grow in popularity, and more and more waves of developers will find innovative uses for it. But I don&#8217;t necessarily think that means it will ever win over the minds of conservative, established and slow-to-change development teams &#8212; and especially their bosses and IT support staff.</p>
<p><span class="me"><strong>Me:</strong> Why not?</span></p>
<p><strong>DA:</strong> It&#8217;s purely pragmatism, I feel. I&#8217;m considering the <em>majority</em> of the web application universe to be of the sort that is not naturally bleeding-edge (even if the bleeding edge is awesome) and often follows well behind the curve, and sometimes never follows at all. I&#8217;m thinking of the millions of PHP shops, and the Java shops, and lord knows the .NET shops&#8230; all of them out there, chugging along in their own little world. That world is not likely to be &#8220;rocked&#8221; (as you called it) by Node.js or even server-side JavaScript.</p>
<p>The payoff for them re-writing most or all of their current code base (whatever language it is) into server-side JavaScript would have to be epic and enormous, almost beyond adequate description in words, to convince them it&#8217;s worth all the time, money, and <em>risk</em> such a venture would entail.</p>
<h4>Change you can believe in?</h4>
<p><span class="me"><strong>Me:</strong> OK, fair enough, a lot of them might be resistant to change. But aren&#8217;t all new technologies up against that same battle at first? The ones that eventually prevail do so despite the nay-sayers (like you) from the early days.</span></p>
<p><strong>DA:</strong> On the surface, you&#8217;re correct. But again, I&#8217;m talking about something much deeper and more fundamental than just: will the masses ever accept server-side JavaScript? </p>
<p>In fact, I think that&#8217;s really <em>your</em> biggest question to answer as you try and convince people to embrace the middle-end with server-side JavaScript as the driving technology. Yes, the middle-end as a concept doesn&#8217;t require JavaScript, but the biggest payoffs in the middle-end come if people will accept server-side JavaScript into the stack. You&#8217;ve got a big uphill battle even trying to convince people that a little tiny piece of the stack can be done adequately with server-side JavaScript.</p>
<p><span class="me"><strong>Me:</strong> Thank you for reminding me just how challenging this is.</span></p>
<p><strong>DA:</strong> My bigger point is, Node.js at its fullest is much broader than I think most people realize. I think it represents a paradigm shift, not just the introduction of an existing technology into a new environment. </p>
<p>I think I&#8217;d liken this concept to trying to convince a company that makes desktop video-editing software that the new age will be their software web/cloud-based and mobile. Noone would argue that the mobile and cloud movements are huge and clearly represent the future. But the desktop application company is probably still likely to adhere to their core competency and continue to serve and rely on the paradigm of desktop application and hardware.</p>
<p>And they may rightly argue that the payoff for being able to take even part of their awesome video-editing functionality and stick it on a tiny screen device with 1/100th the CPU power probably doesn&#8217;t justify the efforts to try and get on the bandwagon with &#8220;everyone else&#8221;.</p>
<p><span class="me"><strong>Me:</strong> A paradigm shift? Can you elaborate?</span></p>
<p><strong>DA:</strong> Here&#8217;s what I mean: Node.js is not <em>just</em> an execution environment for server-side JavaScript. In theory, you <em>could</em> just run JavaScript on the server in an on-demand way, as needed. And I bet Node.js would be pretty decent at that task.</p>
<p>But by even thinking about Node.js in that light, you&#8217;ve drastically missed the point of what it&#8217;s trying to do. Node.js is trying to leverage the asynchronous power of JavaScript at a deeper level than on-demand application logic. Node.js is trying to <em>become</em> the network server itself, so that the server-side JavaScript you write for your application can be interpreted in a much more natural and almost native way.</p>
<p>Let&#8217;s look at this in light of some more established existing functionality. Consider a PHP web application. Now consider there&#8217;s some additional &#8220;module&#8221; for some task, like for instance doing OpenSSL encryption/decryption. There&#8217;s multiple ways your PHP code could accomplish this task. We know there&#8217;s command-line utilities (written in C and compiled to binaries) for managing OpenSSL. So, from our PHP, we can call out to those binaries by executing them as sub-processes.</p>
<p>But this isn&#8217;t necessarily the most efficient way to do things. It certainly <em>can</em> make code look less graceful and more complicated to maintain (more moving parts). Instead, we&#8217;d like it if someone could write a PHP &#8220;extension&#8221; that brings the capabilities of the OpenSSL engine natively into our PHP code. Coding against a PHP API for OpenSSL feels more natural than executing a binary sub-process, and it&#8217;s also likely to be a lot more performant.</p>
<p><span class="me"><strong>Me:</strong> That sounds about right.</span></p>
<p>I can&#8217;t speak for the designers of Node.js, but I&#8217;d venture that among their various motivations, they wanted to do something similar (but in a much broader sense) for server-side JavaScript in the web stack. They wanted to make coding <strong>your entire application in JavaScript on the server</strong> as natural and native and built-in feeling as doing any other task in the web server, including listening for requests on port 80, doing file I/O, etc.</p>
<p>You see, the different paradigm that Node.js is bringing to the table is the idea that the web server and the application become almost synonymous. I think more than anything, <em>that</em> is the truly compelling story for Node.js. I&#8217;m not saying that Node.js is the <em>first</em> to do this, but I do think that Node.js is the most radical approach in this area that we&#8217;ve seen thus far.</p>
<h4>Vive la Révolution!</h4>
<p><span class="me"><strong>Me:</strong> Ok, so that does sound pretty revolutionary. But I missed the part about how this <em>doesn&#8217;t</em> fit well with the middle-end.</span></p>
<p><strong>DA:</strong> Well, you certainly are the primary advocate for the middle-end, so I won&#8217;t try to speak for you. But, I think you and I have some parallel thoughts in mind at this point, even if you don&#8217;t realize it. <em>You</em> have a vested interest (by virtue of your efforts to call attention to the middle-end) in convincing the &#8220;world&#8221; to adopt middle-end architecture as an intentional and carefully planned layer. The more applications/teams that do so, the more you will &#8220;prove&#8221; that middle-end architecture <em>needs</em> to be its own discipline and not just an after-thought of existing platforms/frameworks.</p>
<p>I&#8217;m trying to suggest that Node.js represents a fundamental shift in how people will think about web servers and applications, not as separate functional units but as conjoined parts of the same whole. A web application no longer has to be thought of as a set of business logic code and pretty HTML that relies on a web server to send it to users. A web application is fully self-contained and capable of doing everything it needs from within itself. And it uses a consistent language (JavaScript) to do everything throughout.</p>
<p>This idea is so radical that I think most web applications and platforms and companies will have a hard time swallowing it, at least any time in the relevant future. Thus, I submit that a &#8220;middle-end&#8221; that relies on Node.js will be less palatable to the masses than a &#8220;middle-end&#8221; that is more agnostic and flexible.</p>
<p><span class="me"><strong>Me:</strong> Right, I&#8217;ve tried to make the point that the middle-end as an architectural pattern doesn&#8217;t <em>have</em> to have JavaScript on the server involved. Really, the primary reason for why server-side JavaScript offers an interesting answer to the middle-end is the idea that we can write code once and re-use it in both server and browser. No other language/technology can ubiquitously offer that.</span></p>
<p><strong>DA:</strong> Exactly. You see, Node.js represents a <em>particular</em> narrowed down implementation of the broader middle-end concept into one specific form. That form happens to be increasingly exciting to the bleeding edge of the web development community, but I foresee problems in truly convincing the establishment that both Node.js <em>and</em> the middle-end together will be right for them.</p>
<p>Take the Chrome browser for example. It&#8217;s got a huge percentage of market-share among open web developers. Along with Firefox, Chrome is quite obviously becoming a web developer&#8217;s browser of choice. But when taken in the overall context of the web, Chrome&#8217;s percentage is still pretty low. There&#8217;s an established momentum around browsers like IE and Safari, and Chrome is not likely to completely overtake them any time in the foreseeable future.</p>
<p>Node.js is an amazing piece of technology. But it&#8217;s almost <em>too</em> amazing for the middle-end. It certainly will be more radical to convince existing applications to embrace the fullness of what Node.js is than it would be to suggest, as you have many times, that a more simple, stripped down approach to server-side JavaScript is possible, and in fact warranted.</p>
<h4>Army of none</h4>
<p><span class="me"><strong>Me:</strong> Why isn&#8217;t using Node.js in a more limited fashion (like on-demand or per-request as you suggest) a valid usage of Node.js?</span></p>
<p><strong>DA:</strong> I wouldn&#8217;t call it invalid. I&#8217;d just say that it&#8217;s a lot like driving a tank down to the corner store to buy some drinks. Can it get you there? Sure. Will it get the task done? Yes. Is that an effective mode of transportation? Perhaps not.</p>
<p>Some people like to argue that because Node.js has all this amazing capability built into it, it&#8217;d be foolish to not use it for your server-side JavaScript tasks because of all the extra stuff you&#8217;d miss out on if you ever decided later you needed it. This is kind of like arguing for taking the tank for the trip down to the corner store because you want to be prepared in case an invading army of aliens attacks. &#8220;Look, I&#8217;m better prepared to fight off the bad guys in my tank than I am on my little scooter.&#8221;</p>
<p><span class="me"><strong>Me:</strong> Don&#8217;t you think that&#8217;s just a little bit of an exaggeration?</span></p>
<p><strong>DA:</strong> Well, maybe a little hyperbole there. But my point remains, Node.js is way overkill for the simple middle-end tasks at hand. If someone is trying to shoehorn using Node.js into doing simple per-request on-demand JavaScript execution (the likes of which you&#8217;ve argued for in the middle-end), they are really missing the point of Node.js. </p>
<p>To put it another way: <strong>they&#8217;re using a sledge hammer to drive in a thumbtack.</strong></p>
<p><span class="me"><strong>Me:</strong> Isn&#8217;t there something to be said for using a project like Node.js for our tasks, because at least it&#8217;s pretty well known and has a lot of active developers and a vibrant support community?</span></p>
<p><strong>DA:</strong> No question, it seems like using Node.js would be the obvious choice for this task. And <strong>perhaps</strong> a developer might be better able to convince their boss to try Node.js at first than some much less known project like your <a href="http://github.com/getify/BikechainJS">BikechainJS</a> option.</p>
<p>But in the long run, I think that <strong>using the right tools for the job always wins</strong> out in terms of efficiency and maintainability over using the more popular or hyped solutions and later on finding it&#8217;s not a good fit.</p>
<p><span class="me"><strong>Me:</strong> If one of those &#8220;established&#8221; companies <em>was</em> going to broaden their horizons, isn&#8217;t it riskier for them to venture off into the wilderness and choose an unknown project/option as compared to sticking closer to home with something more people know better?</span></p>
<p><strong>DA:</strong> It may <em>appear</em> riskier. And definitely perception is hugely important in this game. But in reality, Node.js is actually asking an existing team/platform to put more of their eggs in the server-side JavaScript basket than what you&#8217;ve argued for in the stripped-down middle-end approach. </p>
<p>Like I said earlier, Node.js is a fundamental paradigm shift. This means that companies are going to have to retool a big portion of their web stack. They&#8217;re going to have to train IT support staff on a whole new set of technologies in the web stack. They throw out their 5, 10, 15 years of experience supporting and performance tuning traditional synchronous web servers like Apache, and now they have to learn it all again with a radically different asynchronous server-side JavaScript web server. I shouldn&#8217;t have to point out what a &#8220;shock&#8221; that would probably be to most organizations.</p>
<p>And the risk doesn&#8217;t stop there. Node.js itself is ever-changing. It&#8217;s stabilizing more recently, but it&#8217;s been incredibly volatile. I&#8217;d say right now it&#8217;s like walking over a bed of molten volcano lava that only a few hours ago started cooling and hardening into volcanic rock. How much do <em>you</em> trust that an inch of cooled volcanic rock is enough to protect you (and your 800 lb elephant) from the river of lava just below the surface?</p>
<p><span class="me"><strong>Me:</strong> Doesn&#8217;t <a href="http://www.commonjs.org/">CommonJS</a> offer us hope of stability and compatibility?</span></p>
<p><strong>DA:</strong> Absolutely, it promises that. But it may be literally <em>years</em> before there&#8217;s consensus in the server-side JavaScript world on how all these API&#8217;s should really look and function. In fact, if the browser API&#8217;s have taught us anything, we may <em>never</em> fully have agreement.</p>
<p>Now, certainly the browser irregularities didn&#8217;t sideline 10&#8217;s of millions of companies from leaping into web applications, but most of them didn&#8217;t dare venture into the game until there was at least some sort of reasonable &#8220;gap fill&#8221; like any of the various JavaScript frameworks, which normalize differences across browsers and provide a stable foundation for companies to build upon.</p>
<p>So it may be awhile before CommonJS and/or some set of server-side JavaScript &#8220;frameworks&#8221; are able to secure a stable footing. If you look at Node.js right now, it represents a significant super-set of the small amount that CommonJS participants have &#8220;agreed&#8221; on. So, marrying yourself to Node.js right now is risky because it&#8217;s like marrying your web application to only FF and hoping that its rampant popularity will be enough to drive everyone else to commonality.</p>
<h4>Fatalism: a cruel mistress</h4>
<p><span class="me"><strong>Me:</strong> So can we really do <em>anything</em> with server-side JavaScript at this point, given the immaturity and instability across the board?</span></p>
<p><strong>DA:</strong> Of course! I&#8217;m not at all suggesting Node.js is bad to use because its unstable. I&#8217;m suggesting it has its places where it&#8217;s a natural fit (like in prototypes, developer experiments, and other flexibile-to-change dev environments), and then it also has places it&#8217;s not a good fit (like established teams with slow-to-change environments).</p>
<p>The same would be true of any server-side JavaScript option at this point, in my opinion. Of course there&#8217;s the obligatory &#8220;use-at-your-own-risk&#8221; label on all such things. But the smaller, more independent, and more custom your server-side JavaScript implementations are, the more likely you are to be able to adjust as the &#8220;industry&#8221; matures and changes.</p>
<p>At this point, if you were to go out and re-write your entire application in Node.js&#8217;s flavor of server-side JavaScript, you could be painting yourself in a corner if what evolves over the next few years is not in line with how Node.js is currently doing things.</p>
<p>My point is that the smaller the footprint of your server-side JavaScript at this point, the more insulated you are from these risks. Whereas Node.js represents a pretty big footprint conceptually, using stripped-down, per-request, on-demand JavaScript solutions represents a much smaller footprint both technologically and conceptually. Companies are more easily able to integrate such things little-by-little, and also strip them out if problems arise. A re-architecture to Node.js and server-side JavaScript would both be more comprehensive and also more difficult to undo.</p>
<h4>Parting shots</h4>
<p><span class="me"><strong>Me:</strong> We&#8217;re almost out of time&#8230; do you have any final thoughts to share or clarify with the audience regarding Node.js and the middle-end?</span></p>
<p><strong>DA:</strong> I think your idea of <a href="http://blog.getify.com/2010/07/why-node-js-rocks-the-middle-end">using Node.js as a go-between &#8220;proxy&#8221; for middle-end tasks</a> is an interesting one. I think it represents probably the best possible scenario in which Node.js fits in with your &#8220;middle-end&#8221;.</p>
<p>But I&#8217;ll close by saying this: you must realize that Node.js may in fact be ushering in, at least for those (few) who are inclined and capable of taking up the banner, a new era of web applications. This era will be one defined by a blurring of the lines between front-end, middle-end, and back-end code. It will be a new class of web applications that is built end-to-end in JavaScript. In such a world, the middle-end tasks become the all-end tasks. So, more than anything, I think Node.js may mean there&#8217;s no need for a middle-end any more.</p>
<p>However, I think the reality is there will only ever be a select enlightened few who ever get to fully explore that new paradigm. For the overwhelming majority &#8220;rest of us&#8221;, the &#8220;middle-end&#8221; will still be a valid and important reality for our web applications, and as such, we should embrace this discussion.</p>
<p><span class="me"><strong>Me:</strong> Well said. I have nothing more to add, except a thank you to DA for joining us today. I know you&#8217;re a busy guy, so I&#8217;ll let you get on to other pressing debates.</span></p>
<style>.me { color:#663322; }</style>
]]></content:encoded>
			<wfw:commentRss>http://blog.getify.com/2010/07/node-js-the-end-of-the-middle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Node.js rocks the middle-end</title>
		<link>http://blog.getify.com/2010/07/why-node-js-rocks-the-middle-end/</link>
		<comments>http://blog.getify.com/2010/07/why-node-js-rocks-the-middle-end/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 21:08:20 +0000</pubDate>
		<dc:creator>getify</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UI Architecture]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[middle-end]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://blog.getify.com/?p=467</guid>
		<description><![CDATA[If you&#8217;re even moderately involved in the JavaScript world these days (and you probably are if you&#8217;re reading this blog) you would have to be dead asleep to not have noticed and heard some of the hype and celebration for the poster-child for server-side JavaScript: Node.js. 
I regularly follow the chatter on the interwebs, and [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re even moderately involved in the JavaScript world these days (and you probably are if you&#8217;re reading this blog) you would have to be dead asleep to not have noticed and heard some of the hype and celebration for the poster-child for server-side JavaScript: <a href="http://nodejs.org/">Node.js</a>. </p>
<p>I regularly follow the chatter on the interwebs, and I&#8217;m amazed and thrilled at just how much gravity Node.js has accumulated in terms of developer excitement and <em>actual</em> project input. In fact, in some ways, the Node.js ecosystem of companion projects is even more awesome than Node.js itself! It&#8217;s a fantastic example of how the community was desperate for something (we didn&#8217;t even know exactly what) and how well we quickly rallied around <em>it</em> when we finally found it. It&#8217;s plainly obvious that server-side JavaScript is an idea whose time has come, and Node.js, in many ways, will take us there.</p>
<p>This post is an attempt to put my little niche spin on what Node.js <em>could</em> mean for someone wanting to tackle re-architecting <a href="http://middleend.com">the middle-end</a> of their web application.</p>
<h4>What is Node.js?</h4>
<p>In the broadest terms, Node.js is an application server platform. It&#8217;s actually a server-side JavaScript execution environment (roughly similar to something like Narwhal) wrapped around the V8 JavaScript engine. But it&#8217;s a very special type of environment compared to other options in this space. <strong>Node.js is completely asynchronous.</strong> This means that everything you do in Node.js, you do in terms of asynchronous-friendly API&#8217;s, like network calls, file i/o, etc.</p>
<p>But even more important is that Node.js is specially designed to operate as an independent and fully-functional network server. What do I mean by this? Node.js&#8217; flagship capability, and indeed how most people use it, is its ability to &#8220;listen&#8221; for incoming requests on a particular network port (like port 80 for web traffic) and service those requests like a web server like Apache or IIS might do. <strong>In other words, Node.js at its most optimal is a drop-in replacement for your current web server.</strong> And it wraps in a fully capable application server (using JavaScript) automatically. Cool, huh?!</p>
<p>Because Node.js is asynchronous, it doesn&#8217;t operate under the covers at all like other web servers do. Instead, it operates in an &#8220;evented processing loop&#8221; where it is simultaneously and asynchronously listening for incoming connections, firing off processing to handle each connection, and then &#8220;listening&#8221; for those processing contexts to finish to hand the results back to the requesting connection stream. The result is that in many use-cases, Node.js is able to achieve mind-blowing amounts of parallel processing and throughput compared to more standard web servers like Apache.</p>
<p>Bottom line: Node.js&#8217; core competency is to take a server-side JavaScript application server environment and wrap it cleanly around a super-efficient asynchronous network server. In most respects, this is simply the most efficient server-side JavaScript environment you&#8217;re likely to ever find, and it allows JavaScript to compete head-to-head with even optimized, compiled binary alternatives.</p>
<h4>Is it for me?</h4>
<p>Up until now, every thing I&#8217;ve spoken about and written regarding middle-end architecture and server-side JavaScript has been conspicuously silent on the topic of Node.js. There is good reason for that, but I only want to touch briefly on it here, by means of comparison. The next post will dive into this much more thoroughly.</p>
<p>The utter awesomeness that is Node.js comes with a <em>price</em>. For most developers who are hacking and tinkering with new ideas all the time, this price is mere &#8220;pocket change&#8221; and that&#8217;s probably the biggest reason why the Node.js community has grown so quickly and so broad. But there is a &#8220;silent majority&#8221; lurking out there for whom the Node.js price may not be quite so trivial. What is this <em>price</em>? Infrastructure.</p>
<p>Thus far, my focused efforts have been on finding the lowest possible barrier-of-entry into the server-side JavaScript world. By barrier-of-entry, I mean the least amount of footprint/impact on existing infrastructure/architecture and to existing maintenance and support/IT staff. The current fruits of that labor has been the humble <a href="http://github.com/getify/BikechainJS">BikechainJS</a> server-side JavaScript project. </p>
<p>I shyed away from presenting my middle-end ideas in the context of Node.js because there are many who cannot necessarily proceed under the guise of replacing their top-level web server (along with all its associated dependencies, modules, configurations, etc) with an entirely new (and fundamentally paradigm-shifting) solution like Node.js. No doubt we&#8217;d mostly all agree that it would be exciting and probably even more efficient, but the slow-to-change momentum of existing applications, teams, infrastructure, maintenance, reliability, and IT support staff have a noticeably chilling effect on the hyper-excited server-side JavaScript movement.</p>
<p>It was my goal that something like BikechainJS, with its synchronous, per-request paradigm, could squeeze much more nimbly into existing application infrastructure, even at the cost of the wins from Node.js&#8217; performance.</p>
<h4>But Node.js is just so damn awesome!</h4>
<p>That&#8217;s absolutely true. And I&#8217;ve come to believe that the awesomeness of Node.js does not <em>have</em> to be mutually exclusive of the middle-end architectural ideas I&#8217;m advocating for, nor does it <em>have</em> sit out of reach from so many existing web applications, dev teams, and web shops.</p>
<p><strong>Node.js <em>can</em> (and perhaps should!) be the magic key to unlocking the full potential of your application&#8217;s middle-end.</strong></p>
<p>What if we can have our cake and eat it, too? What if we can find a clean way to plug Node.js into the existing infrastructure of our web applications, and at the same time give it the power to revolutionize our middle-end tasks? We&#8217;d get exponentially better performance <em>and</em> revolutionary better code architecture. That idea is just so full of win it&#8217;s hard to type without going nuts!</p>
<h4>Augment, not replace</h4>
<p>My biggest mental sticking point all along with Node.js has been the (im)practicality of asking an existing application to just simply swap out its entire web server tier for Node.js. I explored even the idea of running Node.js in a more limited, synchronous, per-request (CGI-like) context, but quickly found that was like trying to teach a bird to swim.</p>
<p>Then it hit me. The best way Node.js revolutionizes the middle-end of your existing/legacy web application is if you build your middle-end Node.js-based and insert it wholly into the stack in between the browser and your existing server.</p>
<p>In this respect, your middle-end Node.js layer becomes a &#8220;proxy&#8221; (or &#8220;web balancer&#8221;) server of sorts, sitting in front of your existing web server. All you have to do is bring up a Node.js VM/server instance (even cloud-based!) and direct all your primary traffic to that instance first. Then, you build out your middle-end architecture, doing templating, URL routing, data validation, and all the other tasks, as necessary, in your Node.js server-side JavaScript, and finally, you hook Node.js up to ferrying requests back over to your existing application server.</p>
<p>In this blind-proxy model, you start off with a dumb pass-thru of all your application&#8217;s requests, and then one-by-one you can inject some intermediate middle-end logic using the server-side JavaScript. For instance, <a href="http://blog.getify.com/2010/07/how-to-begin-your-middle-end/">as I talked about before</a>, you can start doing data-validation of inbound data fields using your Node.js-driven JavaScript. And then you can move on to evolving your templating into a true middle-end task in your JavaScript. And so on.</p>
<h4>Win, win, win</h4>
<p>The benefits of this approach are hard to explain by mere words. First and foremost, you will see an insane jump in the request/response performance simply by letting Node.js manage your application&#8217;s front line web server handling. But equally important, you gain invaluable flexibility to start converting your thick back-end into a well-crafted middle-end/back-end approach. And you don&#8217;t have to change very much of your existing infrastructure at all.</p>
<p>This is what I like to call a &#8220;middle-win&#8221; scenario! Node.js really rocks the middle-end.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.getify.com/2010/07/why-node-js-rocks-the-middle-end/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Middle-end your CMS</title>
		<link>http://blog.getify.com/2010/07/middle-end-your-cms/</link>
		<comments>http://blog.getify.com/2010/07/middle-end-your-cms/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:54:34 +0000</pubDate>
		<dc:creator>getify</dc:creator>
				<category><![CDATA[UI Architecture]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[middle-end]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.getify.com/?p=452</guid>
		<description><![CDATA[Continuing my ongoing efforts to simplify the middle-end, this post will focus on a high-level discussion of how you might start to adjust and adapt the middle-end concepts (CVC pattern) for use in a CMS environment, for instance a WordPress blog.
As with everything else I&#8217;ve presented so far, I have no cleanly packaged &#8220;install&#8221; you [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing my <a href="http://blog.getify.com/2010/07/how-to-begin-your-middle-end/">ongoing efforts to simplify</a> the <a href="http://blog.getify.com/2010/07/what-exactly-is-the-middle-end/">middle-end</a>, this post will focus on a high-level discussion of how you might start to adjust and adapt the middle-end concepts (CVC pattern) for use in a CMS environment, for instance a WordPress blog.</p>
<p>As with everything else I&#8217;ve presented so far, I have no cleanly packaged &#8220;install&#8221; you can grab to solve your woes. On the contrary, I believe that pre-packaged frameworks and modules <em>usually</em> lead us to the mess we&#8217;re already in &#8212; that is, they tend to hide from the developer the very details we so critically need to get our brains wrapped around and our hands in control of.</p>
<p>Re-architecting the middle-end of your site/application will never be as easy or as sexy as just dropping in a new module/framework, because the point is to tailor your middle-end <em>specifically</em> to your own needs, which is opposite of the goal of most turn-key frameworks that &#8220;do it for you&#8221;.</p>
<p>Whenever I talk about code or about possible ways to address these concerns, that talk is nothing more than presenting reference implementations as starting points for what <em>your</em> system will need. <strong>The middle-end is a pattern, not a package.</strong></p>
<h4>Steep mountain</h4>
<p>I consider myself pretty well-versed in PHP and application coding, from the UI down to the database. But when I started thinking about these ideas for the middle-end, I admit the most daunting task I could come up with is how to apply them to a CMS like WordPress.</p>
<p>What I know from the few times I&#8217;ve tried to customize WordPress is this: it&#8217;s great and easy if there&#8217;s already a plugin available, but otherwise, you&#8217;re in for some long head-scratching nights. It&#8217;s not that WordPress isn&#8217;t flexible &#8212; there&#8217;s lots of hooks in there and you can do a lot of stuff <em>if you know how</em> &#8212; it&#8217;s that the <em>knowing how</em> is quite a challenge because of how sophisticated the system is and how many different flexibilities it needs to accommodate for.</p>
<p>So, how might we take our first steps to climb this challenging mountain of a task?</p>
<h4>Preparation</h4>
<p>First, let&#8217;s make sure we are clear on what it is we want to do with WordPress CMS to adapt it to be &#8220;CVC-friendly&#8221; (that is, properly architected for a well-formed middle-end).</p>
<p>As I&#8217;ve mentioned before, a proper middle-end will give you complete and custom control over things like templating, URL routing, data validation, data formatting, etc. Moreover, I&#8217;ve posited that the middle-end is this interesting beast in that it straddles the fence between browser and server &#8212; many middle-end tasks need to be performed in both places. </p>
<p>And because there are many of these <em>shared tasks</em> between both environments, having to code solutions twice (once in JavaScript for the browser, a second time in your back-end language of choice&#8230; PHP in this case) is both time consuming and brittle. For many middle-end tasks, it would sure be nice if we could DRY (don&#8217;t repeat yourself) code the tasks once and use them in both places. That&#8217;s a big motivation for all my middle-end rattling.</p>
<p>But, does a WordPress blog really need to do all that? In some respects, no it doesn&#8217;t. A typical WordPress blog is not necessarily what I&#8217;d characterize as a full-blown web application. By far, the most important thing for a WordPress blog is usually the content, not necessarily the intricate user-interactions with that content.</p>
<p><strong>But that doesn&#8217;t mean a good middle-end is <em>unimportant</em> to your WordPress blog.</strong> In this case, the ability to control certain middle-end tasks for web performance optimization efforts is likely going to be our primary motivating factor. </p>
<p>For instance, let&#8217;s say we just want to gain more custom control over how resources (JS, CSS, etc) are packaged together and delivered to the browser. The reason this is so common a frustration in CMS&#8217;s like WordPress is the tendency of many individual separate plugins to all add their own script/css dependencies to the document in various strewn-about ways. There <em>is</em> a central system in WordPress that should make this easier, but many plugins don&#8217;t use it well. And even the central system itself is not quite good enough for what we really need.</p>
<p>So, rather than focusing so much on creating a server-side JavaScript driven middle-end whose code can run in server and browser alike, we&#8217;re going to take a step back and think about how we could architect our WordPress blog so that these tasks we want to do are easy enough to be practical and efficient without knowing all the intricate details of a very complex &#8220;hooks&#8221; and plugins system. <strong>Server-side JavaScript is one option we could choose for that task, but by no means required.</strong> Much more <em>importantly</em> will be that we focus on the easiest path to achieve a well-formed and flexible middle-end.</p>
<h4>Option 1</h4>
<p>Our first option is to get really familiar with how the internals of WordPress work. I know from personal experience that such a task can be both a blessing and a curse, both fruitful and frustrating. As I said before, my strong preference would be to find an existing plugin that does exactly what I want it to do. But with the overwhelming popularity of something like WordPress, that can truly be like finding the needle in the haystack.</p>
<p>Usually, when I decide I want to do something new on my WordPress blog, I go spend several hours searching and researching various plugins. Then I&#8217;ll pick one or two to download and try out. I install them, start messing with configuration, and usually find that it&#8217;s <em>almost</em> what I want but not quite. Could I settle? Sure. But I&#8217;m a coder, that&#8217;s not likely to happen!</p>
<p>So then, I may try a couple of other options, only to be similarly frustrated. I may then start trying to google and dig through WordPress documentation, comparing what I see in the code for the plugin to what I read about on the web. And, being a decently confident PHP coder (by no means an expert!), I may start trying to tinker with the code to tweak it to what I want.</p>
<p>And sometimes this will work out. But now I have a problem (that I won&#8217;t realize until a month later). I&#8217;ve customized a plugin&#8217;s code for my own needs, and I&#8217;ve now forever damned myself to having to remember those customization patches and re-apply them every single time that plugin notifies me of a new release. A number of my plugins update themselves quite regularly, so this becomes a real pain.</p>
<p>For instance, right now, I have 2 plugins that have notified me of an update, but I&#8217;ve resisted doing the update because I don&#8217;t want to spend the 10 minutes to go back in and refresh myself on what customizations I did. I know in this case the customizations I did referred specifically to our task of customizing how JS and CSS resources are packaged and loaded. But it&#8217;s still time and hassle that I don&#8217;t want to spend. And so I miss out on the benefits of the update until I pay that price.</p>
<p>I am not going to sugar coat it: <strong>this process sucks.</strong> Even if I <em>do</em> figure out how to customize a plugin for my own needs, which in and of itself takes a lot of effort, then I have to keep spending that effort over and over again every time an update comes out.</p>
<p>Bottom line: option 1 is possible, and it&#8217;s quite likely that for most middle-end tasks, you could figure out a way to hack around existing plugins to bend WordPress to your will. But unless you&#8217;re a WordPress guru (I clearly am not) and have the time and inclination to regularly hack on it, the benefits of doing so <strong>are probably not worth it.</strong></p>
<h4>Option 2</h4>
<p>Out next option would be to go to the other end of the spectrum entirely, and not do anything inside of WordPress. We could, for instance, set up a &#8220;proxy&#8221; server (of sorts) which all browser-initiated web requests get sent to first, and that &#8220;proxy&#8221; would then make a sub-request to WordPress to get the desired page/content.</p>
<p>What this approach would allow us to do is basically &#8220;post-filter&#8221; all the content before it actually goes out to the browser. For example, we could take the HTML of the page response, and parse through it looking for our &lt;script> and &lt;link> tags. When we find them, we could remove them from the HTML stream (just text at this point!), and then append to the HTML document a more optimized set of resource loading commands.</p>
<p>Basically, we could find all script tag references, open the .js files they refer to, concat them all together into a single .js file which we cache ourselves in our proxy&#8217;s control, and then add a single &lt;script> tag back to the HTML document referencing that new concatenated file. A similar process could be done for all our CSS resources.</p>
<p>You may even want to get more elaborate (as I would advocate) and instead of compiling like resources into a single file, compile them into 2 or 3 files, and use dynamic loading techniques in the browser to load them in parallel, even further speeding up the page-load optimization. One such dynamic loader you could use would be <a href="http://labjs.com">LABjs</a>, <em>the performance script loader</em> that I built.</p>
<p>But let&#8217;s not kid ourselves: this is a drastic approach. Setting up an entirely separate web server (or web server instance/VM) <em>just</em> so we can post-process some HTML markup!? I&#8217;m not saying this wouldn&#8217;t work for some people, but I am thinking that it&#8217;s probably something that has its own set of daunting challenges and extra &#8220;costs&#8221; (especially maintenance) involved. </p>
<p>Not only is it drastic, it&#8217;s also more brittle. No matter how good your coding skills are, parsing through arbitrarily generated and complex HTML markup and modifying it on the fly is <em>going to be difficult to do, at best.</em> And it&#8217;s quite easy for it to break if your HTML generation routines (your blog) change how they do things in a way your &#8220;proxy&#8221; was not expecting.</p>
<p>Bottom line: option 2 is also possible, but probably not exactly what we want or need.</p>
<h4>Option 3</h4>
<p>For our last option, let&#8217;s dial things back just a little bit and be a little more realistic. Let&#8217;s not try to fight against WordPress, but to work with it. What I mean is this: WordPress is very capable at doing what it does, and if someone has already built a plugin that suits your needs, by all means use it. But the other thing that WordPress does (and I think decently well) is let us <em>completely</em> control the ultimate output of our blog engine using the Themes (templating) system.</p>
<p>So maybe we could try this: let WordPress do what it does best, as a good solid CMS. But run it as essentially a &#8220;headless&#8221; black box application and practically ignore any presentational stuff that it wants to do. We can ask WordPress for content/data, but we can let the middle-end layer do what it is best suited for, which is handling these various middle-end tasks.</p>
<p>What I&#8217;m about to suggest may seem radical&#8230; but read the sentence a few times and let it sink in. <strong>Make a theme for your WordPress blog which does <em>nothing</em> of generating HTML markup, and <em>only</em> formats necessary data/content into JSON.</strong></p>
<p>That&#8217;s right! Reduce the templating/themeing system of WordPress to nothing more than a JSON serializer for the relevant content and data to construct your page. What data? How about an array of all the scripts and css files. How about meta data like the page title, etc. How about the raw content for the blog post the page displays.</p>
<p>What would we do with that data and content in JSON form? We could have a separate middle-end layer that took the JSON and did something useful with it. That middle-end layer <em>could be</em> server-side JavaScript. But it also could just as easily be more PHP (outside of and strictly separate from your WordPress blog engine). Or it could be some other language you are more comfortable with.</p>
<p>But whatever language your middle-end is written in, you would do some very basic things:</p>
<ol>
<li>Take the list of .js and .css resources in the JSON array properties, and perform the above suggested logic like concatenation, caching, etc.</li>
<li>Take any meta-data and properly &#8220;format&#8221; it for HTML use, such as converting special characters to HTML entities, etc. Or, perform &#8220;internationalization&#8221; formatting on your data/content.</li>
<li>Perform any other middle-end suitable tasks on the data and content as necessary.</li>
<li>Lastly, pass that data/content into your templating engine of choice, and then send the output directly to the browser.</li>
</ol>
<p>You see, we don&#8217;t <em>have</em> to change much about how WordPress does its magic to start having more proper control over the middle-end. And we don&#8217;t even have to venture into server-side JavaScript to do it. All we have to do is trick WordPress into giving us data and content in a friendly way that allows us to do what we want with it. </p>
<p>And the Theme/template system makes that really easy. Nothing about the state or complexity logic that WordPress is doing can&#8217;t be somehow down-formatted into data/content in JSON form, and so we&#8217;d practically lose nothing of the functionality of WordPress, but gain lots of control in the areas we need it most.</p>
<h4>Conclusion</h4>
<p>CMS&#8217;s are a fact of life on the web. They sit somewhere between a full web application and a basic content web site. As such, there are reasons why we can benefit from a more well-formed and properly architected middle-end. But it doesn&#8217;t have to take wholesale hackery on our blog engine to do so. There are ways to work with it to massage the content/data in such a way that we can layer in a middle-end without too much of a radical change to the architecture.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.getify.com/2010/07/middle-end-your-cms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Content Delivery Network via getiblog.2static.it

Served from: blog.getify.com @ 2010-09-02 22:04:14 -->