All posts tagged #programming-languages all posts RSS-feed

What is async/await?

I've been pretty active on Hashnode and inactive here lately. So I'm going to repost an answer I gave on Hashnode here, because I'm lazy like that... This is a conceptual explanation, not a beginner tutorial. Yes, async/await a way for the thread to not sit idle while waiting for something (usually IO like files, database or network). When you read a file synchronously, your code does not do anything while the disk is busy. This means that for programs... full post»

Some reasons I do not like javascript

It is no secret that Javascript isn't the most well-designed language, and these points have probably been made a billion times, but now it's my turn! Note that this isn't a criticism about a lack of expressiveness. You can create great things with javascript. But you can also footgun yourself very easily, which is what I'm criticizing there. Most languages are expressive, but good ones help you avoid mistakes instead of making them. You can pass more or fewer arguments... full post»

Visitor pattern and dynamic dispatch

The Design Patterns book by the infamous Gang of Four contains 23 object oriented design patterns. Some of them are kind of obvious (Adapter), or have become common knowledge since the book was published in 1994 (Iterator). My personal favourite is Visitor. Visitor "represents an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operations" [except you need to add an... full post»

Analyzing a single, trivial Java statement

Java isn't a bad language, but it is also not great, and it's age shows. Let's look at this simple Java statement: if (!Boolean.TRUE.equals(getIsRequired())) { It's very simple and common, and yet it includes a lot of the things I don't particularly like about Java: We need a getter for a trivial property access. I like the Python way with @property, or the Kotlin way with getters and setters being called implicitly. It is not explicit that getIsRequired is a... full post»

Java primitives conversion & operations

First, booleans Booleans cannot be assigned to any other types, and you can't do any arithmetic on them. So true doesn't count as 1, nor does 1 count as true. No truthy and falsy in Java. Converting: a = b Some types can only be converted if you cast explicitly. These are usually the cases where a type with a wider or different range is converted to one with a narrower range. If you use explicit casting, you might be... full post»