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?”
main method is similar to the
main 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]
Was 1900 a leap year and does every minute have 60 seconds?
Continue reading “Misconceptions about Dates and Time”
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.
Since many were not happy with it there was Joda-Time, which later became the basis for JSR-310 and is now found in the package “java.time”.
The keyword static is arguably a bad choice or 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”
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”
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”
You may wonder if double checked locking (DCL) works in Java. It does and it doesn’t. I explain why. Continue reading “Double Checked Locking in Java”
So Java has references. But what about pointers and pass-by-reference? References in Java are different to PHP, C# and other languages. And this can cause some confusion. Continue reading “What are References in Java?”
Java (both the language and the JVM) are not aware of constants. To reduce confusion it’s better to not use the term “constant” in Java code, unless it’s actually a universal constant. Continue reading “Java knows no Constants”
A language can’t be slow. Or how fast do you think English is?
And modern JVMs are highly optimized. Continue reading “Java is not slow”
Here’s some advice to all who have just begun learning Java. This also serves as an overview to my blog, where I write about all kinds of misconceptions and common problems with programming in Java. Continue reading “Dos and Don’ts”