by jlarocco · 14y ago · 0 comments
...
import com.gs.collections.impl.block.factory.Comparators;
import com.gs.collections.impl.block.factory.Functions;
import com.gs.collections.impl.block.procedure.CollectionAddProcedure;
import com.gs.collections.impl.collection.mutable.AbstractCollectionAdapter;
...
Gees, I feel sorry for people still stuck using Java.Or is it because you're fanboi who dislikes Java merely because it's Java and choose any opportunity, not matter how inappropriate, to disparege it.
Java is by no means perfect, but let's at least pick on it for the things it actually does poorly rather then just picking on it because it's no longer considered cool.
That repo has 1,290 files. Excluding file pathnames containing 'test', there are 601 files. Of those, 430 are .java files.
Java is complicit in that crime, but Enterprise Java is the bigger culprit. The library makes doing a map on an array cleaner for me, but behind the scenes it is using a dozen "factories", a bunch of "builders", several "strategies", and a handful of "visitors", "bridges", and "proxies".
And guilt by association is valid here. We bleed over whether semicolons are needed in some languages, but Java is off limits for needing 10-fold more (auto-generated?) boilerplate code for something most languages handle out of the box?
"But, but... a good IDE can make all this boilerplate be less painful!"
Of course, you could just not have the boilerplate, abstraction and over-complexity to begin with, use a simpler language & ecosystem like Python, and just code in vi.
Also, many Java shops do so because few other languages are an option when you need 200+ trained developers, as few cities even have 200 experienced Python devs. Then there's performance, as Java performs an order of magnitude faster than Python for many operations.
It works both way, there are many acceptable times to use a design pattern, and many non-acceptable times.
It always produces stuff like... that.
It's basically like that in every other programming language, though others are less opaque. In Perl, you get a variable called %:: that holds the symbol table, and you can directly manipulate it. That lets you write something like "use all" and use every CPAN module at once. In C, you can include arbitrary source files at arbitrary places, making it possible to import every library with one statement. But in both languages this is considered terrible practice, with most style guides wanting one use or include statement for each library. Exactly the same as Java.
If you were going to complain about the API, you might complain about the "impl" in every import. That's a silly convention that wastes typing. (Also, Google puts their collection classes in the "collect" namespace, saving a few letters over calling it "collections" like Goldman.)
What do you use? I find it extremely painful to write Java in Vim, even though I have been using Vim for quite some time and am very comfortable using it. Text based completions and re-factoring doesn't cut it for Java/C#, so I use eclim to use what eclipse is good at which comprises of smart auto-complete, auto-imports, generating getters and setters, implementing interface, auto-correct code for trivial cases etc.
> To use a class in Java, you must import it first. To import it, you type "import " and then the fully qualified name of the class. From there, you can use the unqualified name.
That's similar in Python. I think the parent post wasn't complaining about namespacing but the way project is structured and named(impl, factory).
Java and C# are both heading into a territory where it is getting less reasonable for a human to write them without tooling support - is this what people really want? If we have such sophisticated tooling why bother dropping to low level text? Wouldn't it make more sense to manipulate and compose more expressive objects than text?
The end game is you obsolete the languages and they become targets of more expressive languages.
It highlights a potential design flaw in the composition model of the language and/or the libraries.
Should for example C/C++ include the generated assembler in pragmas to guide compilation? Always? Visible to the programmer?
But hey, at least you have a fancy, complicated IDE keeping track of all the "useless shit" for you, right?
import com.gs.collections.impl.*;
Just out of curiosity, how are imports done in your language of choice?That repo has 1,290 files. Excluding file pathnames containing 'test', there are 601 files. Of those, 430 are .java files.
Java is complicit in that crime, but Enterprise Java is the bigger culprit. The library makes doing a map on an array cleaner for me, but behind the scenes it is using a dozen "factories", a bunch of "builders", several "strategies", and a handful of "visitors", "bridges", and "proxies".
And guilt by association is valid here. We bleed over whether semicolons are needed in some languages, but Java is off limits for needing 10-fold more boilerplate code for something most languages handle out of the box?
As an example, with Google's collection library (Guava), you might create a set like:
import com.google.common.collect.ImmutableSet;
ImmutableSet<Foo> foos = ImmutableSet.of(bar, baz, quux);
This is simple syntax for a simple operation, which is the point of libraries.(Goldman also has a lot of mutable data structures. I don't think I've used or created a mutable data structure at Google ever :)
If so, how do they look like?