LOLWUT: a work of art in a DB team

Original author: Salvatore Sanfilippo
  • Transfer
The author is Salvatore Sanfillipo aka antirez, one of the main developers of the DB Redis, an employee of Redis Labs. Article published September 12, 2018 The

last few days have been very tense. One of the arguments in the dispute about replacing or not replacing the words used in the Redis replication code was the following: is it worth doing work that does not give any technological result? [Speech on the replacement of the terms "master / slave" in replication - approx. trans.]

In the process of cleaning up the Redis source code from a certain word, where it is possible, I thought that I like to write code even without measurable technological effects. Replacing words is too routine work, it is simply annoying, even if along the way there are worthy technological problems. But there is another kind of code with a special quality, which I would call “hack value”. He may not solve any problem, but still it is a worthy task. There are several reasons. Sometimes the process of writing code is useful in itself. Sometimes technically advanced ideas are used to solve not the most important problem. And sometimes the code is written simply for aesthetic reasons.

Stupid, chaotic and heated discussions of the last days on Twitter prompted the idea that now we are very far from the first hackers of the 60s. Every year it is harder and harder to discuss technology from a hacker point of view - without ready-made ideas and problems, where the goal is pure research. For everything around developed "best practices". For each idea there is a taboo. To this new world, I say LOLWUT, because I do not feel part of it, and it is not at all hacker, at least in my vision. So the idea was to spend some time on a technically useless idea to explore something from the 60s.

I immediately remembered one of my favorite works of computer art - Schotter engravel from Georg Nys. The author wrote in ALGOL a program for a plotter that generated works of art using chaos (random numbers). [Gradually, the slender figures in the picture become more and more chaotic - and vice versa, chaos is systematically ordered into an organized structure, if you rotate the picture by 180 ° - approx. trans.] . This gravella is gorgeous in its simplicity and deep meaning that the viewer can understand. Under the cover of complete tranquility, chaos lies deep inside the order. If you turn the picture upside down, it looks like the sea during a storm. Chaos rage on the surface, and in the depths the sea remains calm.

Is it possible to turn a work of art into a DB team? This is quite difficult, because Redis is mainly used from the command line. Nowadays, consoles are more sophisticated than in the past, but displaying decent graphics is difficult. On the other hand, we have a huge advantage of real-time computing — the picture can become dynamic and change with each generation.

Before proceeding, I’ll show you the final result:

Albeit in very low resolution, but the original idea has been preserved. Here I applied the trick that many programs use to show various interesting things in the text console. The first part of the solution is to use Unicode braille to generate a pixel matrix with a higher resolution than individual console characters. In particular, for each character you can make a grid of 2 × 8 pixels.

The second part is the parameters for the picture:

You can generate several versions of the picture by changing the number of squares and the output resolution. Finally, I wanted to write the source code as an example of literate programming - in a form that looks more like a textbook with a detailed description of each step, and not just a black box generator. The code is here .

Starting with Redis 5, the LOLWUT command will become standard. In each major major version, its functionality will change completely. Only the rule set remains unchanged:

  1. She can't do anything useful.
  2. It should work quickly so that it can be safely called on servers in production.
  3. The result should be interesting in some way.

I wrote the first version for Redis 5. In the next version I’ll ask someone else from the Redis developers who wants, otherwise I’ll write it myself (I hope I don’t have to do it). The LOLWUT team should remind us that our work - programming - exists not only for good. Initially, it was mainly about exploring opportunities . I hope that LOLWUT will also remind the Redis community that computers are made for people, and that it’s impossible to reason sterilely, thinking only of technological consequences. There are living people who use systems that build systems and so on.

Also popular now: