<!DOCTYPE html>
<!-- ========================================== kroc camen of camen design ============================================= -->
<title>code · Camen Design: Now With Added Forums</title>
<link rel="stylesheet" type="text/css" href="/design/design.css" />
<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=no" />
<link rel="alternate" type="application/rss+xml" href="/code/rss" title="Just code" />
<link rel="canonical" href="/code/forums" />
<!-- =================================================================================================================== -->
<header>
	<h1><a href="/" rel="index">
		Camen Design
	</a></h1>
	<nav><ul>
		<li><a href="/">all</a></li>
		<li><a href="/projects">projects</a></li>
		<li><a href="http://forum.camendesign.com">forum</a></li>
	</ul><ul>
		<li><a href="/quote/">quote</a></li>
		<li><a href="/writing/">writing</a></li>
		<li><a href="/blog/">blog</a></li>
		<li><a href="/photo/">photo</a></li>
		<li><a href="/code/" rel="tag">code</a></li>
		<li><a href="/art/">art</a></li>
		<li><a href="/link/">link</a></li>
		<li><a href="/poem/">poem</a></li>
		<li><a href="/audio/">audio</a></li>
	</ul><ul>
		<li><a href="/web-dev/">web-dev</a></li>
		<li><a href="/annoyances/">annoyances</a></li>
		<li><a href="/eve/">eve</a></li>
		<li><a href="/code-is-art/">code-is-art</a></li>
		<li><a href="/inspiration/">inspiration</a></li>
		<li><a href="/windows/">windows</a></li>
		<li><a href="/gift/">gift</a></li>
		<li><a href="/gaming/">gaming</a></li>
		<li><a href="/mac/">mac</a></li>
		<li><a href="/osnews/">osnews</a></li>
		<li><a href="/c64/">c64</a></li>
		<li><a href="/linux/">linux</a></li>
	</ul>
	<a rel="previous" href="/code/remarkable">
		older article →
	</a><a rel="next" href="/code/video_for_everybody">
		← newer article
	</a></nav>
</header>
<!-- =================================================================================================================== -->
<article><header>
	<!-- date published or updated -->
	<time pubdate datetime="2010-10-16T01:14:00+01:00">
		<sup>1:14<abbr>am</abbr> • 2010</sup>
		<abbr title="October">Oct</abbr> 16
	</time>
	<!-- categories -->
	<ul>
		<li><a href="/code/forums" rel="bookmark tag">code</a></li>
		<li><a href="/web-dev/forums">web-dev</a></li>
		<li><a href="/inspiration/forums">inspiration</a></li>
		<li><a href="/c64/forums">c64</a></li>
	</ul>
	<!-- licence -->
	<small>
		<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_GB">c</a>
		share + remix
	</small>
</header>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<section>
<h1>Camen Design: Now With Added Forums</h1>
<ol>
	<li><a href="#history">History</a></li>
	<li><a href="#goals">Goals</a></li>
	<li><a href="#code">Code</a></li>
</ol>
<p>
	<strong>Where I have said before</strong> that I <a href="/blog/hello#hello-iii">do not want comment threads on my
	website</a> because they promote thoughtlessness, I am not opposed to good old fashioned <em>discussion</em>. For
	me, e-mail and letting you write on your own preferred websites serves as the right medium for discussion of my
	articles, it’s a formal relationship whereby I serve you the content and you pass it about.
</p><p>
	Now for something completely different:
</p>
<figure>
	<a href="http://forum.camendesign.com">
		<img src="/code/forums/forum.jpg" alt="Camen Design forums, in a Commodore 64 theme" width="640" height="763" />
	</a>
	<figcaption>The new Camen Design forums, click image to enter</figcaption>
</figure>


<h2 id="history">History</h2>
<p>
	When I started out on the Internet in 1996 it was undergoing a generation shift;
	<a href="http://en.wikipedia.org/wiki/Usenet" rel="external">usenet</a>, the mainstay of message board systems was
	eventually brushed aside by the browser wars and the momentum of what became the dot-com bubble. With so many people
	getting online, and their first experience of the Internet being through content portals such as Compuserve and AOL,
	a new generation of (much hated) users were exposed to an Internet composed of just the web, rather than the more
	complicated usenet and IRC (with
	<a href="http://en.wikipedia.org/wiki/Bulletin_board_system" rel="external">BBSes</a> before that).
</p><p>
	This gave rise to the ‘<a href="http://en.wikipedia.org/wiki/Internet_forum" rel="external">Forum</a>’, a
	completely over-engineered hack-job of spaghetti code re-implementing a fraction of the capability of usenet in
	browsers that were never designed for the task. It worked, though, and it lowered the bar for entry so that
	everybody could participate. One of the early successors was
	<a href="http://en.wikipedia.org/wiki/Ezboard#ezboard_history" rel="external">ezBoard</a>, effectively the
	<a href="http://en.wikipedia.org/wiki/GeoCities" rel="external">GeoCities</a> of forums. By 2005, phpBB and other
	board software had taken over.
</p><p>
	Before Facebook, Twitter and all this ‘social’ junk, the forum was king. It was the way things got done on the
	Internet and I’ve spent more time in forums than just about anywhere else on the web. Having grown up on a diet of
	<a href="/writing/kroc_writes#tgp">ill-fated forum-based projects</a>, I of course wanted my own. In 2003 I
	embarked in a massively over-engineered project to build my own website, encompassing all my favourite things. A
	central database and shared functions was to provide forums for each of the differently themed sections of the
	website, one of which dedicated to the Commodore 64:
</p>
<figure>
	<img src="/code/forums/c64.jpg" alt="Commodore 64 themed web site" width="640" height="631" />
	<figcaption>Scrolling marquee and background music? Yeah, that would be 2004</figcaption>
</figure>
<p>
	The forums for this were particularly nice because nothing like this had been done before due to the complexity of
	existing forum software.
</p>
<figure>
	<img src="/code/forums/c64_forum.jpg" alt="Commodore 64 themed Internet forum" width="640" height="722" />
</figure>
<p>
	The irony of this being that this was possible because Internet Explorer had supported font-embedding since version
	4. Firefox was released in November 2004 and rapidly gained traction. I rewrote portions of my site to work with
	<del>Firefox</del> standards, and the Commodore 64 site was dropped because there was no font-embedding support in
	Firefox—a limitation that would take another <em>five years</em> for them to fix. Regardless, I never completed my
	website, having written too much code with no clear sense of direction and purpose.
</p><p>
	It was the modern, clean <a href="/blog/hello">HTML5 iteration of Camen Design</a> that completely turned me
	around. With the experience of failure before, I set myself the goal to write the most
	<a href="/blog/minimalist_is_not_the_right_word.rem">minimal</a> website I could finally complete. Since then
	I’ve always been striving for the most elegant and straight forward solutions to all problems without all the
	<a href="/art/if-i-designed-engadget">cruft</a> that is common everywhere I look. I now make my own decisions on
	what is actually necessary rather than following trends. I couldn’t be a more different programmer than I was
	before!
</p>


<h2 id="goals">Goals</h2>
<p>
	Modern forum software has become so bloated these days that it seems to have lost the goal of facilitating actual
	<em>discussion</em>. So many features are dedicated to massaging everybody’s bloody ego, it’s a joke. Signatures
	chock full of images, user ranks and badges, user profile pages, “social networking”. I wouldn’t be having any
	of this crap.
</p><p>
	In creating the forums, I set some primary goals in mind that would help keep the design focused and let me put
	together something that worked in the least amount of time.
</p>
<dl>
	<dt>No database</dt>
	<dd>
		Too much extra code to manage. Each discussion thread is a single file on disk. Want to delete a thread?
		Delete the file. Want to move a thread? Move the file. No code required.
	</dd>
	<dt>One format, one file per thread</dt>
	<dd>
		<p>
			Each discussion thread is itself an actual RSS feed; <abbr title="that is,">i.e.</abbr> <em>the
			data is stored as RSS</em>. Since there’s no database there’s no e-mail subscription feature,
			if you want to follow a thread add it to your RSS reader. That means that there’s no duplication
			on disk, whereby I have to keep a data store (like JSON) and then cache that out to RSS files when
			it changes. When you add a post to a thread, your post goes directly into the RSS file meaning
			that the change is seen instantly, no caching is needed (as the RSS file is static) and no code is
			needed to manage both data and RSS—they are the same thing.
		</p><p>
			It’s not as simple code-wise as using JSON, for example, but it’s worth it to not have the
			same content spread across more than one file.
		</p>
	</dd>
	<dt>No session, no login, no registration</dt>
	<dd>
		<p>
			Has no purpose other than to facilitate all the ego-features. RSS would serve for getting updates,
			so e-mail isn’t required. Anyone can sign up for a free / fake e-mail, so it doesn’t prevent
			abuse or spam.
		</p><p>
			I do respect that people prefer to stick to a particular name / alias / handle, and it wouldn’t
			be right to allow anybody to post under any name as they could reuse someone else’s name to
			cause trouble. For that reason, I have implemented a very simple system of name reservation that
			allows someone to keep their desired name and prevent others from using it.
		</p><p>
			When you post or reply on the forums, it asks you for a name and password along with your message.
			Your chosen name and password form a unique key that prevents others from using that name. You do
			not have to pre-register in order to post like most forums. The very act of posting forms the
			‘registration’. Just simply use the same name and password each time you post in order to
			re-use that name. You never have to log in through a dedicated login page beforehand every time,
			and there’s no session and no cookies so the forum never has to bother you about logging in to
			post. Get your web browser to remember your username and password and you won’t have to enter it
			again at all!
		</p><p>
			Users are stored as a text file in a folder. The name of the file is the hash of the user’s
			name, and in the text file is the hash of the password; neither are stored in clear text.
		</p>
		<img src="/code/forums/users_thumb.png" alt="The user folders, containing two text files" width="600" height="365" />
		<p>
			This makes user authentication blindingly simple:
		</p>
		
		<pre><code>$user = "users/".md5 ("C64:$NAME").".txt";
//create the user, if new
if (!file_exists ($user)) file_put_contents ($user, md5 ("C64:$PASS"));
//does password match?
if (file_get_contents ($user) == md5 ("C64:$PASS")) {
	⋮
}</code></pre>
		
		<p>
			Thus you can post under your desired name, also reserving it from others, without having to
			register, login or use JavaScript, a session, or cookies.
		</p><p>
			This is obviously not a system for preventing spam (confusing the problems of name reservation and
			spam is bad systems design). I have put in a very basic anti-spam feature via a hidden field but
			if the spam bots come along then I will probably integrate
			<a href="http://akismet.com/" rel="external">Akismet</a>, but any suggestions are welcome; they
			just have to work without a database, JavaScript, sessions, or cookies <samp>:P</samp>
		</p>
	</dd>
	<dt>Focus on discussion</dt>
	<dd>
		<p>
			As has been alluded to so far, I’ve cut a lot of crap that is standard in forums these days.
			There won’t ever be signatures or user pages, crowd-spam and the like. People’s “rank”
			should be known simply from their participation and generosity—their actual deeds, rather than a
			label. In essence the forums should let humans be humans.
		</p><p>
			I’m not against personal expression, I just don’t believe that bling is personality. As the
			code improves, I’m happy to add bbcode and other means to better express text, you can even draw
			PETSCII art using unicode and a proper interface for this would be good.
		</p><p>
			The forum is unique (I believe) by keeping the initial post of a thread at the top and paging the
			replies so that the discussion can hopefully remain on-topic by always displaying the initial
			post. I will have to see how this works out, but I think it a good addition.
		</p>
	</dd>
</dl>


<h2 id="code">Code</h2>
<p>
	The prototype for all of this was a programming exercise I set myself called “Few Lines As Possible”
	(<abbr>FLAP</abbr>). I decided to set myself the task to complete something in the most basic fashion to see what
	could be done. Programming, for programming’s sake. You can view the result of that exercise
	<a href="/code/forums/flap.php">here</a> (it’s 125 lines long).
</p><p>
	Of course, it had absolutely zero security (that I believe to be the fault of language design—why shouldn’t this
	code be secure by default?) but it showed that it was possible to simplify things a great deal by using files on
	disk as the data store.
</p><p>
	I have put the new forums together faster than just about anything I’ve ever made before. I have purposely forced
	myself to be untidy and unfussy in implementing it in order to get a basic but functional system out to you quickly
	and then improving from there rather than my usual habit of keeping things tucked away for years before releasing
	them.
</p><p>
	You can download the code <a href="http://github.com/Kroc/NoNonsenseForum/archives/master" rel="external">here</a>
	and <a href="http://github.com/Kroc/NoNonsenseForum" rel="external">view the source on github</a> where continual
	improvements will be baked into the code.
</p><p>
	Many thanks has to go to <a href="http://style64.org/c64-truetype" rel="external">Style64</a> for the high quality
	C64 font that made this possible. (The font I used on the 2004 design didn’t include the PETSCII graphics).
</p><p>
	I hope to see you <a href="http://forum.camendesign.com" rel="external">in the forums</a> soon!
</p>
</section>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
</article>
<footer>
	<nav><a href="http://forum.camendesign.com">‹ Discuss this in the Forum ›</a></nav>
		
	<a href="mailto:kroc@camendesign.com">kroc@camendesign.com</a>
	<nav>view-source:
		<a href="/code/forums.rem">Rem</a> •
		<a href="/code/forums.html">HTML</a> •
		<a href="/design/">CSS</a> •
		<a href="/.system/">PHP</a> •
		<a href="/.htaccess">.htaccess</a>
	</nav>
	<form method="get" action="https://duckduckgo.com">
		<input type="hidden" name="sites" value="camendesign.com" />
		<input type="search" name="q" placeholder="search…" />
		<input type="submit" value="Go" />
	</form>
</footer>
<!-- =================================================================================================== code is art === -->