News for hackers. Stuff that matters.
Re:Be a Good Jedi: Build Your Own Blog by jrockway on Sunday December 05, 2010 @11:31PM (#1973922)
I did this. It's taken me three revisions and 5 years and I still haven't gotten anything I like.

A few pieces of insight that I think I'm right about:

- blogs are not dynamic. no code should run when someone visits your site. (or requests your atom feed.)

- content management is just linking. a blog is a graph. a site depends on pages. the main page depends on pages. each blog post depends on a template. the template depends on javascript, css, images, and content. the content also depends on images. once you resolve the links and generate a bunch of files that a web server can understand, you have the One True generic CMS.

Some day I will figure out the right abstraction for this. But not today :)

Re:Be a Good Jedi: Build Your Own Blog by jacques_chester on Sunday December 05, 2010 @11:55PM (#1973972)
I run a modest little blogging network (http://ozblogistan.com.au) and I disagree. Blogs are quite dynamic. My users want, inter alia:

* Comments on stories that appear seconds after posting

* Latest-comment lists (this one is a performance nightmare for anything other than the simplest cases)

* Navigability by category, author, tag, date

* Twitter integration

And so on and so forth.

There are, basically, two platonic models of web applications. The first is the compiled, the second is the dynamic. Compiled web applications perform all computations in advance and reduce to static resources. Dynamic web applications perform all page rendering on-the-fly and only a small subset of a page is static (JS, CSS and images, mostly).

Naturally, most apps fall in between on the continuum. For example, Movable Type used to have a simplistic compilation scheme that would rebuild large portions of the site due to small changes. For a while one of the selling points of Wordpress was that it updated instantly. But that too came at a price, and now on any busy site using it, Wordpress is usually chaperoned by a bodyguard of caching systems.

My personal thinking is that the sweet spot will be in managing changes to a site through queueing and selective compilation. This is what we have in practice, but I want to move the key queue from GET -> cache -> app -> db to being POST -> db -> app -> cache.

Re:Be a Good Jedi: Build Your Own Blog by nzmsv on Monday December 06, 2010 @02:02AM (#1974301)
If I were writing a blog engine right now, I think I'd do something different: make the post itself static, and pull in any dynamic content via AJAX. That way old browsers still get a readable compatible page (just don't load any fancy stuff), and for everyone else the blog works like any dynamically generated one. And fine-grained caching can be had for free.
Re:Be a Good Jedi: Build Your Own Blog by jrockway on Monday December 06, 2010 @03:10AM (#1974446)
I agree here. It's especially nice things like "posted x minutes ago". Murder for caching, but easy for Javascript to compute.
Re:Be a Good Jedi: Build Your Own Blog by JoachimSchipper on Monday December 06, 2010 @04:17AM (#1974610)
I've been thinking about using Disqus on my "blog". Which is, indeed, a bunch of HTML files built from Markdown input - using Disqus would, I imagine, consist of adding a single <script> tag.
Re:Be a Good Jedi: Build Your Own Blog by mburns on Monday December 06, 2010 @01:09AM (#1974162)
All those sub-page widgets can be pre-computed and, thus, cached.

The first web request (at worst) should initiate all those, but you shouldn't be fully computing every query, for every section of code on every page you send for each request.

Re:Be a Good Jedi: Build Your Own Blog by jacques_chester on Monday December 06, 2010 @01:35AM (#1974244)
> All those sub-page widgets can be pre-computed and, thus, cached.

That's broadly what I mean by changing the pipeline to be post-focused. When the site has a change pushed to it, the relevant parts should be re-rendered down to HTML for a fast HTTP server to dish up.

The current model works the other way. Until somebody does a GET, the system may or may not have the rendered HTML in a cache. Even if it does, it may or may not be a verifiably up-to-date copy.

This seems hit-and-miss to me.

I've sort of sketched design ideas around this area (using, for example, PostgreSQL triggers and NOTIFY to prompt rendering). Maybe I'll write a blog post, but it's basically pointless without code.