4 ms·
It definitely does not take “no” additional time to read verbose boilerplate code. As for prior knowledge, that argument doesn’t fly. A lot of the verboseness
by BMorearty 5y ago
It definitely does not take “no” additional time to read verbose boilerplate code.
As for prior knowledge, that argument doesn’t fly. A lot of the verboseness of Java could be addressed VERY easily with clear syntax that doesn’t require a lot more prior knowledge. An example is getters and setters, which are very easy to understand in languages that have built-in support for concise syntax but Java has somehow ignored the advantage of concise syntax for 25 years.
Besides, if your argument is that Java doesn’t require “prior knowledge,” I beg to differ. E.g., correct usage of arrays vs. ArrayList.
- skneko 5y ago> E.g., correct usage of arrays vs. ArrayList. Arrays vs lists is a thing in all languages, not Java. They just have different names (list, vector, sequence...)
- kayodelycaon 5y agoI don’t think Ruby or Python have linked lists, only arrays.
- skneko 5y agoArrayList is not a linked list, it's an array-backed list like List in C# or other languages, like the name implies. Linked list is `java.util.LinkedList`.
- mattnewton 5y agoRuby and python only have an equivalent to Java’s “array list.” It’s not in the standard library, but you can trivially make linked list nodes yourself if the problem calls for it; I don’t remember encountering a need for the data structure over the built in array-list type outside of interview questions anyways.
- grishka 5y agoHeh, getters and setters. An unpopular opinion, but imo you don't need them most of the time. Usually, a getter just returns a field and a setter just assigns it. If that's the case, and unless you're writing a public API of a library, just make the field public. Make it public final if it's read-only. The difference between arrays and ArrayList is simple: an array has a constant size known at the time of allocation.