5 ms·
Being verbose is one of the biggest negatives a programming language can have. When you’re working on a team with other programmers and reading someone else’s c
by BMorearty 5y ago
Being verbose is one of the biggest negatives a programming language can have. When you’re working on a team with other programmers and reading someone else’s code, verbose code takes much longer to read and grok because you have more boilerplate code to read.
- grishka 5y agoBut reading terse code requires a lot more prior knowledge, which you might not have. You learn to recognize patterns in the boilerplate and just glance over it, taking no additional time.
- weatherlight 5y agogarbage collected programming languages are for people, not computers. Kotlin isn't terse.
- BMorearty 5y agoIt 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.
- edoloughlin 5y agoI think I could make the same argument for terse code.