When should we use this annotation? How can we prevent heap pollution?
Continue reading “@SafeVarargs and Heap Pollution”Category: Misconceptions
Common misconceptions on programming and computer science in general.
I try answerings questions in a facebook group and often stumble over the same misconceptions. These are merely my thoughts on the topic and not a substitution for a proper text book. A good book can sometimes leave out certain details but it would not lead you to a complete misunderstanding of the topic.
No, ChatGPT can’t replace human programmers
ChatGPT and other bots aren’t even general artificial intelligence. Those who claim they could replace human programmers are wrong or lying.
ChatGPT and other bots aren’t even general artificial intelligence. They don’t understand anything. Some people are now pushing the misconception that the large language models we have now are already AI and can replace human workers.
Continue reading “No, ChatGPT can’t replace human programmers”It’s about RTFM, not BOMDAS!
Different results can both be correct. This depends on the grammar used to parse the expression. Some handle implied multiplication with higher precedence, others don’t.
There’s this meme on the internet about two calculators (or phone calculator apps) with different results. This is a common misconception and therefore a perfect topic for my blog.
Continue reading “It’s about RTFM, not BOMDAS!”What is a Variable?
For beginners it is difficult to understand what a variable is. They are used in nearly all high-level languages and therefore vital for a good understanding of programming
Continue reading “What is a Variable?”Bad Defaults in Java
Many misconceptions in Java and similar languages stem from the bad default behaviour. I’ll explain some of them.
Continue reading “Bad Defaults in Java”Is Java easy?
Java isn’t easy. It’s often more complex than needed. But being easy for beginners shouldn’t be a design goal with high priority.
Should a programming language be easy?
I don’t know why so many educational establishments use Java to teach programming. They often start with Java in the first semester. Even the Oracle tutorials expect the reader to already know some basics. Java was designed for programmers who already know C/C++ as seen in this example.
Continue reading “Is Java easy?”The
main
method is similar to themain
function in C and C++; it’s the entry point for your application and will subsequently invoke all the other methods required by your program. [Lesson: A Closer Look at the “Hello World!” Application]
Misconceptions about Dates and Time
Was 1900 a leap year and does every minute have 60 seconds?
In Java we have a new API for Date and Time since Java SE 8. Before that, there was already an API with mutable dates and fore some reason there was a date just for SQL.
Many were not happy with the old API. There was Joda-Time, which later became the basis for JSR-310 and is now found in the package “java.time”.
Misnomer: static Keyword
The keyword “static” is arguably a bad choice of naming.
If you look up “static” in a dictionary you find many meanings, none of which explains its use in programming languages. So why is it used in Java, and how is it misunderstood?
Continue reading “Misnomer: static Keyword”Set-theoretic explanation of IEEE 754
Why is 0.1+0.2 not equal to 0.3?
The IEEE Standard for Floating-Point Arithmetic is confusing for beginners. Here I try to give an alternative explanation. It’s not my goal to make it easy. It simply isn’t easy. But this might help understand some aspects of floating point arithmetic.
Continue reading “Set-theoretic explanation of IEEE 754”Encapsulation
In my blog I write about misconceptions. Encapsulation is something you learn when you study Java and OOP. But it seems that most books fail to truly explain the problems you want to solve with it and those you get by using it. Often it’s just a short chapter or even just a small part about the important concepts of OOP. This is leading to misconceptions and poor understanding of OOP.
(Note: I wrote this before the release of Java 10. Expect that some things are somewhat outdated.)
Continue reading “Encapsulation”