It is only a slight exaggeration to say that every good comment in a program represents a small failure of the language.
“
| — |
Charles Simonyi (via guillermonkey)
Oh, and this guy was responsible for a lot of the code written at Microsoft. Any questions?
|
Why Can’t Java Be More Like Python?
Sure, I’m spoiled by programming-language choice. And I appreciate that a lot of the complexities of Java arise from
- the desire to root out potential programming errors as early as possible—at compile time, if possible, rather than run time;
- the need for backward compatibility with code written for older versions of Java.
But I still can’t help considering the fact that the Java Language Specification, 3rd Edition, is well over 600 pages, while the equivalent Python language reference, even adding in the built-in stuff from the Library Reference, only works out to about 120 printable pages. And this in spite of all the extra cool features that Python provides, such as:
- Overloading of built-in operators;
- Much simpler and more flexible namespace management;
- More powerful functional constructs: dictionary expressions, list comprehensions, generator functions;
- Object-orientation is optional: you can declare a function all by itself, outside of any class, and functions are first-class objects. The closest Java can come is to let you create a Runnable object, which is just a little bit unwieldy;
- Functionality of ctypes that offers direct access to native libraries more simply than anything you can do in Java with JNI or anything like that;
- A much more rationally-designed standard library generally: compare how much easier it is to use POSIX select/poll/epoll calls with the select module versus the baroque, convoluted nightmare that is the java.nio.channels API.