Programming and Kant
Published: 2023-04-04 15:40:54

---
title: Programming and Kant
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-04 15:39 +0000
---

I took out my laptop as I could sense the restlessness in the air that suggested it wouldn't rain. After paying for my coffee, I remembered the coffee ticket I had bought earlier. I should have presented it, but then again, it was probably from the neighboring shop.

When I read Yoshinori Sato's interpretation of Kant's Critique of Pure Reason, it seemed like a discussion about intuition and understanding using object-oriented programming to extract the appropriate data format from the data layer and manipulate it in the model layer. The data layer was an abstract concept from the computer's perspective and different from the actual physical existence. It appeared as if the other side of that interface was something like an entity that could never be reached. The entry point for obtaining data was intuition, the data format was in the form that intuition could receive, the understanding was in the model layer, and the class of the object that was manipulated by understanding was a category (or a diagram), while the composition power was like a business module.

Then, the limit of reason, which Kant criticizes in Critique of Pure Reason, is such a thing. Even if we consider only the classes as ideals and consider the relations between the objects based on them without actual data, we can always design a model that ultimately contradicts each other (antinomy). Transcendental dialectics is carried out over this issue. Rational theology, rational cosmology, and rational psychology are all questioned in this antinomy. Especially in rational psychology, the belief in "I," that is, Descartes' "Cogito, ergo sum," always comes into play in intuition but is one of the concepts of understanding. That is, if it is assumed that there is always a function to check data in the model layer, and that is "I exist," it becomes a function to censor data.

Although we fall into antinomy with reason alone, we still have to practice programming. Kant's Critique of Practical Reason is a practical method for that purpose (or so they say). Programming is practical, and it doesn't start with strict formality. However, what is important there is not the purpose of programming but rather the conventions (morality) as Kant says (please don't believe this).

This convention is something like coding rules, design patterns, and the DRY principle, but it cannot be moral just by each person following their own convention. This state is called "maxim." So, how can the maxim be sublimated to morality? This is the famous Kantian moral principle.

"Act only according to that maxim whereby you can, at the same time, will that it should become a universal law."

In other words, Kant is saying, "The way of programming that you are following should be meaningful no matter who does it." Don't ask why; this is a definitive command! (Like someone important told you to do it.)

Thus, writing code in this way does not promise to make programmers happy. However, a programmer who adheres to that rule should be happy. After all, if a good code does not make the programmer who wrote it happy, it cannot be called good in the first place!

In this way, the ultimate coding style that embodies the universal convention and brings happiness to those who follow it demands the "highest good." In other words, although there may not be a logical god in the display in the programming world, there may be a god (ethical god) that embodies the ultimate good code within our hearts.

It's obvious by now that the last Critique book, Critique of Judgment, is about beauty and organisms, or rather, about the beauty inherent in code.