<!doctype html>
{% extends "template.html" %}
{% block head %}
    {{ super() }}
{% endblock %}
{% block content %}
{{ _date.date() }}
       <p><h1>Keep It Simple</h1>
       While studying architecture not only had I so little money that I ate spaghetti and pesto every day, I learned a thing or two about design principles as well. These principles hold true for every product or piece of engineering you plan out. It is the KISS principle. Keep it simple stupid, or to quote a guy Jony Ive is clearly a fan of <a href="#references" style="text-decoration:none">[1]</a>:
<blockquote>&ldquo;Good design is as little design as possible.&rdquo;<br>&mdash; Dieter Rams &mdash;</br></blockquote>
</p>
<p>
 Let&rsquo;s expand on it so far that it should be as simple as possible without being outright stupid. To expand even further, a compelling and useful design is not only measurable by the things you can do with it, but even more important are the things you don&rsquo;t have to do when you use it. 
</p>
<p>
As you craft something, you will inevitably communicate with everybody using your product. In proxy, any room, place or inanimate object created by a human speaks to the user. Even on an emotional level. Psychologists or product designers like computer and car designers are no strangers to this. Donald Norman wrote multiple books about it <a rhef="#references" style="text-decoration:none">[2]</a>, <a href="#references" style="text-decoration:none">[3]</a>. Some good reads. Schulz von Thun defined the <a href="http://temp.chpfeiffer.de/Four-sides_model.pdf">four-ears model</a> in which a sender&rsquo;s message is received on four different levels. These are Factual information, Appeal, Self-revelation and Relationship. This means it is helpful to think about the essence of the aspect you want to craft to communicate clearly and get the message across.

       <img style="float: right", alt="A functional lighter.", src="{{ url_for('static', filename='images/218px-White_BIC_lighter.png') }}">
</p>
<p>
<h2>Pesto Principles</h2>
<hr/>
What about this website's design principles? First and foremost, how you spent your time is important. Do you really need to wait for more than a few seconds to load a website? Then there should be a plausible reason for that. Should you wait more than 5 seconds to be able to read something a guy is rambling about on his blog? I highly doubt it. The layout should respect you and your time. Network traffic should be minimal.
</p>
Second, I don&rsquo;t want your data. No cookies, no statistics about you, no ad tracking of your surfing behavior. That is what you and I won&rsquo;t have to put up with. You may read my blog, or you don&rsquo;t. Take it or leave it. But I hope you will learn something by doing it or have a good time at least.
<p>
        There are some points to make this website work and make it accessible. To write entries, I will use plain HTML. For now, it is sufficient. HTML is a nice markup language. Use a <code>&lt;lang&gt;</code> tag and you got translation accessibility. Another one is the following line, making the layout respond dynamically to different screen sizes. More examples on <a href="https://perfectmotherfuckingwebsite.com">this beautiful website</a>.
<pre>
<code> 
&lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
</code>
</pre>
        This will be a blog about computers, for the most part, there will be code examples. Further, I want to keep the stylesheet small and maintainable. Monospaced fonts are not only a dead giveaway about this fact, a solid layout is created via the following line of CSS.
<pre>
<code>
.content{text-align:justify;}
</code>
</pre>
</p>
<p>
    To keep things in perspective, the date of publication will be the first line in each article. If the content may be of interest to you, knowing the date it was created is beneficial in evaluating its potential usefulness over time.
</p>
<p>
There is no harm in growing something like a website incrementally. You will never miss a feature you never had in the first place. You could aspire to get it if it is conceptually meaningful and makes some sense in the overall picture. But a feature that does not exist needs no maintenance, does not produce any bugs and needs no documentation.
<blockquote>&ldquo;The things you own end up owning you.&rdquo;<br>&mdash; Chuck Palahniuk &mdash;</br></blockquote>
<h2>Cordial Code</h2>
<hr/>
The website was created on a Saturday afternoon in Python and Flask framework. Six months down the line, I do not want to put much energy into grasping what I had done this weekend regarding to code structure. I want to put the least amount of time possible into extending and maintaining the framework of the site. It consists of a Python file, a stylesheet, a jinja template and an empty favicon file. The last one exists because I want to avoid any error possible displayed in the network console of the browser. Everything else is content.

You can find the site as a repository on <a href="https://git.stefan.works">my git</a>. 
<p>
A directory named <code>blog</code> contains all entries released as well as the ones I am working on. Metadata about subdirectories and the corresponding content is gathered inside a &lt;key&gt;:&lt;value&gt; structure. An entry is seen as valid and stored in the dictionary as soon as an index.html file is found. Who knows what might be added in the future. It will be added to a list of values. For now, metadata is solely the date of the blog articles. It is added to the RSS site automatically as well. The code snippet contains the dictionary.
</p>

<pre>
<code>
meta_data = {root[len("./templates/blog/"):] :
            datetime.fromtimestamp(os.path.getmtime(os.path.join(root,"index.html")))
            for root, dirs, files in os.walk("./templates/blog") if "index.html" in files}
</code>
</pre>
Routes are set by the use of decorators. The landing page is declared in the following snippet. After the dictionary is sorted by date, <a href="https://flask.palletsprojects.com/en/2.0.x/api/#flask.render_template"><code>render_template()</code></a> returns a string. The result will be interpreted by the browser in HTML/CSS format.
<pre>
<code>
@app.route('/')
def index(_paths=meta_data):
    sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
    return render_template("index.html", _paths=sorted_meta_data)
</code>
</pre>
The main page, like every other page, extends the general jinja template. It contains a list of all articles found.
<pre>
<code>
&#x7b;% extends "template.html" %&#x7d;
&#x7b;% block head %&#x7d;
    &#x7b;&#x7b; super() &#x7d;&#x7d;
&#x7b;% endblock %&#x7d;
&#x7b;% block content %&#x7d; 
  &lt;p&gt;Welcome to my website&lt;/p&gt;
  &lt;span class="index"&gt;
  &#x7b;% for name,_date in _paths.items() %&#x7d;
  &lt;p&gt;&lt;a href="&#x7b;&#x7b; url_for('blog', blog_item=name) &#x7d;&#x7d;"&gt;&#x7b;&#x7b; _date.date() &#x7d;&#x7d;&emsp;&emsp;&#x7b;&#x7b; name &#x7d;&#x7d;&lt;/a&gt;&lt;/p&gt;
  &#x7b;% endfor %&#x7d;
   &lt;/span&gt;
&#x7b;% endblock %&#x7d;
</code>
</pre>
URLs originate from the meta_data dictionary keys. These are the blog entries&rsquo; directory names. Flask&rsquo;s <a href="https://flask.palletsprojects.com/en/2.0.x/api/#flask.url_for" ><code>url_for()</code></a> returns the articles if you want to visit the site. It handles URL encoding as well. This is pretty neat since there are spaces in the names.
<pre>
<code>
@app.route('/blog/&lt;blog_item&gt;/index.html')
def blog(blog_item, _date=meta_data):
    return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
</code>
</pre>
<h2>Digestif</h2>
<hr/>
Incidentally, this turned out to be not only an opener for my blog but code documentation for myself as well. Maybe, I&rsquo;ll need to pick it up in six months, who knows&#8230;.
As a closure, at least from my experience, the most feature-rich application seldom reaches its set goals. The one with a clear and precise target, fulfilling its minimal scope, most likely will.
<p>
<a href="https://www.bonappetit.com/recipe/best-pesto">This is how you make pesto, by the way.</a> Bon Appetit!
</p>
<p id="references" class="references">
<h2>References</h2>
<a href="https://www.bookfinder.com/?isbn=9783899555844">[1] Less and More: The Design Ethos of Dieter Rams, 2015, ISBN:9783899555844</a><br>
<a href="https://www.bookfinder.com/?isbn=9780465051366">[2] Emotional Design: Why We Love (or Hate) Everyday Things, 2005, ISBN:9780465051366</a>
<a href="https://www.bookfinder.com/?isbn=9780465067107">[3] The Design of Everyday Things, 2002, ISBN, 9780465067107</a>
</p>

{% endblock %}
