Peter Stuifzand

Design = Beneficially Relating Elements

Inspired by the “Benificially Relating Elements” phrase of Kent Beck, I started out creating a builtin weblog for my webshop platform. The nice thing about the idea is that it helps you find relations between elements that you already have.

I started with the “What is a weblog?” A weblog is a chronological list of pages. By answering this way, I can reuse two elements that already are supported in the webshop: collections and pages.

Collections are lists of products and other collections. Nothing more nothing less. By increasing the scope of collections a little bit, I can also include pages.

A page is a piece of text that can be shown in the webshop. It has an url. By making a weblog post to be a page, I can reuse all the infrastructure of pages for weblog posts. This includes: creating, editing, saving and showing. The only thing missing from a page is the creation date, which is needed to sort the weblog posts chronologically.

The other two things that simplified the weblog feature are plug-ins and routes. Plug-ins are small packages of code that are loaded on start of the request and connect to rendering and loading and saving code.

Routes are ways to convert urls to controllers. The latest release made it possible to create routes based on regular expressions and all urls are parsed using this. This allowed me to use the names of the pages in the urls.

By relating the pieces, I created a new feature, that is useful in itself without having to write a lot of new code. Now when I add ‘comments’ as a feature to the weblog, I will also automatically add comments as a feature to pages, because they are the same thing.

Two features for the price of one. I like it.

© 2023 Peter Stuifzand