More from Ralph Ammer
A large part of our civilisation rests on the shoulders of one medieval monk: Thomas Aquinas. Amid the turmoil of life, riddled with wickedness and pain, he would insist that our world is good. And all our success is built on this belief. Note: Before we start, let’s get one thing out of the way: Thomas Aquinas is clearly a Christian thinker, a Saint even. Yet he was also a brilliant philosopher. So even if you consider yourself agnostic or an atheist, stay with me, you will still enjoy his ideas. What is good? Thomas’ argument is rooted in Aristotle’s concept of goodness: Something is good if it fulfills its function. Aristotle had illustrated this idea with a knife. A knife is good to the extent that it cuts well. He made a distinction between an actual knife and its ideal function. That actual thing in your drawer is the existence of a knife. And its ideal function is its essence—what it means to be a knife: to cut well. So everything is separated into its existence and its ideal essence. And this is also true for humans: We have an ideal conception of what the essence of a human […] The post Thomas Aquinas — The world is divine! appeared first on Ralph Ammer.
About 2300 years ago, the great Chinese thinker Xunzi 荀⼦ wrote: “Human nature is bad“. But he wasn’t just having a bad day. The question—Are humans fundamentally good or bad?—is a major fork in the road. How you answer this question profoundly impacts your morals and how you live your life. Previous to Xunzi, another famous scholar had claimed that human nature was inherently good. Mengzi 孟子: Human nature is good The Ox Hill Mengzi had illustrated his idea with a story about a wooded hill. After the trees get chopped down and the sprouts are grazed by animals, the hill appears barren and unfruitful. He compares this hill to someone who can’t bring forth his good character under bad circumstances. For him, goodness is an integral part of every person’s nature. It merely requires the right circumstances to emerge. Goodness will grow forth naturally from every person if no one interferes. Willows and Bowls Someone suggested to Mengzi that a good character had to be forged from a man’s nature like bowls were made from a tree. Mengzi objected that a tree must be violated in order to be turned into useful bowls. He can’t accept the comparison between […] The post Xunzi vs. Mengzi – Are People (No) Good? appeared first on Ralph Ammer.
Should we just live in the moment? In “Matter and Memory” the French philosopher Henri Bergson claims that this is not even possible. 1. Perception is physical First of all: How do we perceive the “current moment” anyway? Bergson suggests that the whole point of perception is action. For example, when some single-cell organism touches an obstacle, it moves away. That is the whole point of perception: to move in the right direction, to find food, to not be food—to survive. Perception serves future action, not insight. Accordingly, our brain is fully embedded in the material world and responds to the movements around it. Bergson refers to such a purely physical reaction as pure perception. Yet he acknowledges that we are more complicated than single-celled organisms. The movements of our environment have to make their way through our complex sensory system with all its twists and turns. And this leaves us more options on how to act. So we don’t just react like a single-celled organism, we can choose from a range of potential movements. But how? We remember. 2. Memory is temporal Bergson distinguishes two kinds of memories: Some memories have become part of our body, they are a […] The post Bergson — Why we live in the past appeared first on Ralph Ammer.
To “animate” means to breathe life into things. In these 5 exercises we make stones come alive. Preparation To get started I suggest this simple setup for you to try at home: Ready? Let’s go! Thinking in time Stop-motion is simple: Take a picture, move the object, take the next picture, move the object, etc. Once you are done, you can play back all those images as a little movie. Tip: You can do the following exercises exactly as shown here or play around with them. Just make sure to have fun! Exercise 1: Timing Turn a stone into a bouncing ball. Start with a stone above the middle of the page and hit the record button. Then move it down a little, take the next frame, move it again, and so on. Once it has reached the bottom, gradually move it up again until it is back to its starting position. Tip: At first you will notice that our steps are too big. As a result the animation plays way too fast! Just start over and make the steps smaller. Another tip: You can make the movement more natural by varying the distances. And you can make the “ball” […] The post A quick beginner’s guide to animation appeared first on Ralph Ammer.
You are awake. You think and you feel. But what is it that is doing all this thinking and feeling? We call it “consciousness” and over 100 years ago the philosopher Edmund Husserl made a bold attempt to uncover its secrets. Subjective experience is private The thing is: Consciousness is not “out there”, it is “in here“. It is personal and subjective. When I say that I like squirrels or that my foot hurts, then you will have to take my word for it. You can’t know what it is like to be me, and I cannot know what it is like to be you. Consciousness can only be observed from the inside, not from the outside. Since we can’t see the world through other peoples’ eyes, their experience remains deeply mysterious to us. Thus we all see the world differently. And this can lead to bitter conflict. Science is based on objective insight One way to overcome such conflict is to take an objective position. We take a neutral view from outside and focus on the things that we can all agree upon. We have learned to see ourselves “from the outside”. In fact, we can build a whole […] The post Edmund Husserl — Consciousness appeared first on Ralph Ammer.
More in programming
Having spent four decades as a programmer in various industries and situations, I know that modern software development processes are far more stressful than when I started. It's not simply that developing software today is more complex than it was back in 1981. In that early decade, none
In previous articles, we saw how to use “real” UART, and looked into the trick used by Arduino to automatically reset boards when uploading firmware. Today, we’ll look into how Espressif does something similar, using even more tricks. “Real” UART on the Saola As usual, let’s first simply connect the UART adapter. Again, we connect … Continue reading Espressif’s Automatic Reset → The post Espressif’s Automatic Reset appeared first on Quentin Santos.
I started writing this early last week but Real Life Stuff happened and now you're getting the first-draft late this week. Warning, unedited thoughts ahead! New Logic for Programmers release! v0.9 is out! This is a big release, with a new cover design, several rewritten chapters, online code samples and much more. See the full release notes at the changelog page, and get the book here! Write the cleverest code you possibly can There are millions of articles online about how programmers should not write "clever" code, and instead write simple, maintainable code that everybody understands. Sometimes the example of "clever" code looks like this (src): # Python p=n=1 exec("p*=n*n;n+=1;"*~-int(input())) print(p%n) This is code-golfing, the sport of writing the most concise code possible. Obviously you shouldn't run this in production for the same reason you shouldn't eat dinner off a Rembrandt. Other times the example looks like this: def is_prime(x): if x == 1: return True return all([x%n != 0 for n in range(2, x)] This is "clever" because it uses a single list comprehension, as opposed to a "simple" for loop. Yes, "list comprehensions are too clever" is something I've read in one of these articles. I've also talked to people who think that datatypes besides lists and hashmaps are too clever to use, that most optimizations are too clever to bother with, and even that functions and classes are too clever and code should be a linear script.1. Clever code is anything using features or domain concepts we don't understand. Something that seems unbearably clever to me might be utterly mundane for you, and vice versa. How do we make something utterly mundane? By using it and working at the boundaries of our skills. Almost everything I'm "good at" comes from banging my head against it more than is healthy. That suggests a really good reason to write clever code: it's an excellent form of purposeful practice. Writing clever code forces us to code outside of our comfort zone, developing our skills as software engineers. Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you [will get excellent debugging practice at exactly the right level required to push your skills as a software engineer] — Brian Kernighan, probably There are other benefits, too, but first let's kill the elephant in the room:2 Don't commit clever code I am proposing writing clever code as a means of practice. Being at work is a job with coworkers who will not appreciate if your code is too clever. Similarly, don't use too many innovative technologies. Don't put anything in production you are uncomfortable with. We can still responsibly write clever code at work, though: Solve a problem in both a simple and a clever way, and then only commit the simple way. This works well for small scale problems where trying the "clever way" only takes a few minutes. Write our personal tools cleverly. I'm a big believer of the idea that most programmers would benefit from writing more scripts and support code customized to their particular work environment. This is a great place to practice new techniques, languages, etc. If clever code is absolutely the best way to solve a problem, then commit it with extensive documentation explaining how it works and why it's preferable to simpler solutions. Bonus: this potentially helps the whole team upskill. Writing clever code... ...teaches simple solutions Usually, code that's called too clever composes several powerful features together — the "not a single list comprehension or function" people are the exception. Josh Comeau's "don't write clever code" article gives this example of "too clever": const extractDataFromResponse = (response) => { const [Component, props] = response; const resultsEntries = Object.entries({ Component, props }); const assignIfValueTruthy = (o, [k, v]) => (v ? { ...o, [k]: v } : o ); return resultsEntries.reduce(assignIfValueTruthy, {}); } What makes this "clever"? I count eight language features composed together: entries, argument unpacking, implicit objects, splats, ternaries, higher-order functions, and reductions. Would code that used only one or two of these features still be "clever"? I don't think so. These features exist for a reason, and oftentimes they make code simpler than not using them. We can, of course, learn these features one at a time. Writing the clever version (but not committing it) gives us practice with all eight at once and also with how they compose together. That knowledge comes in handy when we want to apply a single one of the ideas. I've recently had to do a bit of pandas for a project. Whenever I have to do a new analysis, I try to write it as a single chain of transformations, and then as a more balanced set of updates. ...helps us master concepts Even if the composite parts of a "clever" solution aren't by themselves useful, it still makes us better at the overall language, and that's inherently valuable. A few years ago I wrote Crimes with Python's Pattern Matching. It involves writing horrible code like this: from abc import ABC class NotIterable(ABC): @classmethod def __subclasshook__(cls, C): return not hasattr(C, "__iter__") def f(x): match x: case NotIterable(): print(f"{x} is not iterable") case _: print(f"{x} is iterable") if __name__ == "__main__": f(10) f("string") f([1, 2, 3]) This composes Python match statements, which are broadly useful, and abstract base classes, which are incredibly niche. But even if I never use ABCs in real production code, it helped me understand Python's match semantics and Method Resolution Order better. ...prepares us for necessity Sometimes the clever way is the only way. Maybe we need something faster than the simplest solution. Maybe we are working with constrained tools or frameworks that demand cleverness. Peter Norvig argued that design patterns compensate for missing language features. I'd argue that cleverness is another means of compensating: if our tools don't have an easy way to do something, we need to find a clever way. You see this a lot in formal methods like TLA+. Need to check a hyperproperty? Cast your state space to a directed graph. Need to compose ten specifications together? Combine refinements with state machines. Most difficult problems have a "clever" solution. The real problem is that clever solutions have a skill floor. If normal use of the tool is at difficult 3 out of 10, then basic clever solutions are at 5 out of 10, and it's hard to jump those two steps in the moment you need the cleverness. But if you've practiced with writing overly clever code, you're used to working at a 7 out of 10 level in short bursts, and then you can "drop down" to 5/10. I don't know if that makes too much sense, but I see it happen a lot in practice. ...builds comradery On a few occasions, after getting a pull request merged, I pulled the reviewer over and said "check out this horrible way of doing the same thing". I find that as long as people know they're not going to be subjected to a clever solution in production, they enjoy seeing it! Next week's newsletter will probably also be late, after that we should be back to a regular schedule for the rest of the summer. Mostly grad students outside of CS who have to write scripts to do research. And in more than one data scientist. I think it's correlated with using Jupyter. ↩ If I don't put this at the beginning, I'll get a bajillion responses like "your team will hate you" ↩
Whether we like it or not, email is widely used to identify a person. Code sent to email is used as authentication and sometimes as authorisation for certain actions. I’m not comfortable with Google having such power over me, especially given the fact that they practically don’t have any support you can appeal to. If your Google account is blocked, that’s it. Maybe you know someone from Google and they can help you, but for most of us mortals that’s not an option.