News for hackers. Stuff that matters.
Re:Didn't see this coming: The Goldman Sachs Github Account by jlarocco on Saturday May 19, 2012 @11:00PM (#3997768)

  ...
  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.
Re:Didn't see this coming: The Goldman Sachs Github Account by ecopoesis on Saturday May 19, 2012 @11:29PM (#3997845)
Why? Because Java has good, built-in, worldwide namespacing that always works? Or because Java has IDEs that pull in imports automatically so developers don't have to think useless shit?

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.

Re:Didn't see this coming: The Goldman Sachs Github Account by jabr on Sunday May 20, 2012 @01:46AM (#3998064)
I can't speak for jlarocco, but my concern is not directly the import statements, but rather, what those import statements imply.

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?

Re:Didn't see this coming: The Goldman Sachs Github Account by mkramlich on Sunday May 20, 2012 @02:41AM (#3998141)
Yep. Don't forget Aspects!

"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.

Re:Didn't see this coming: The Goldman Sachs Github Account by arcdrag on Sunday May 20, 2012 @11:28AM (#3999006)
"I don't want to learn how to use an IDE" is the same argument as "I don't want to learn how to use vi". There are a lot of reasons to hate Java...I don't want to use a bloated IDE is a pretty weak one in an age of 8 core processors and 32 GB of ram.

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.

Re:Didn't see this coming: The Goldman Sachs Github Account by mkramlich on Sunday May 20, 2012 @08:46PM (#4000755)
The vast majority of dev workstations in the real world have far less than 8 cores and 32 GB of memory. Also it's not about "bloat" in some abstrance sense, I've found, but rather about the noticeably slower interactivity, the mysterious delays, the mysterious crashes, and the overwhelming surplus of unnecessary visual/cognitive vomit occupying the screen real estate at any time. Oh and Byzantine IDE configuration option panels. And the always-harder-to-automate nature of GUI interfaces. And the local drive bias. And every other "feature" they add that you're supposed to appreciate as some new gift from the gods turns out to be something you could already do, for free, on the command-line or with a vi/emacs-style terminal-friendly UI. I have a lot of experience working in both paradigms and I know which one I've found to be better. I think the last fast/simple/non-crashy/non-visual-vomit IDE I experienced was TurboC in the early 90's. It's been mostly downhill ever since.

I think a lot of shops that think they need 200 developers, and thus it's easier to get Java than Python developers and thus should use Java, etc., may have made a base assumption after which all following deductions are dependent. If instead of starting with assumption you need 200 developers you instead think we only want a few smart/elite developers, then you can have a smaller total headcount, a less enterprisey tech stack, and less mindless process and makework. I've seen and heard of small teams that run circles around large bloated enterprise shops for just these kinds of factors.

Also I guarantee you that in the vast majority of real world programming situations needed by large companies the software is mostly not CPU-bound but rather IO-bound, and any greenfield or maintenance development is mostly bug-bound or developer-hour-and-quality-availability-bound and bureaucracy-bound. CPU time is cheap and lots of ways to parallelize, defer and cache. Software developers are not cheap. Well, worse software developers can be "cheaper" superficially but end up being more expensive due to being slower, dumber or less knowledgable of implementation options, and needing much more of them. CEO salaries and their royal court are extremely NOT cheap.

Re:Didn't see this coming: The Goldman Sachs Github Account by UK-AL on Sunday May 20, 2012 @08:52AM (#3998646)
Many people find those patterns help them understand the code. I often see terrible bespoke code, where half the problems could fixed using a design pattern where those problems have already been considered.

It works both way, there are many acceptable times to use a design pattern, and many non-acceptable times.

Re:Didn't see this coming: The Goldman Sachs Github Account by runn1ng on Saturday May 19, 2012 @11:34PM (#3997855)
I hate auto-generated code by IDEs.

It always produces stuff like... that.

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @01:43AM (#3998054)
I never use an IDE to edit Java, and that's pretty much what it looks like. 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.

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.)

Re:Didn't see this coming: The Goldman Sachs Github Account by irahul on Sunday May 20, 2012 @06:23AM (#3998432)
> I never use an IDE to edit Java,

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).

Re:Didn't see this coming: The Goldman Sachs Github Account by jordyhoyt on Sunday May 20, 2012 @02:01AM (#3998080)
But, if you're using a modern IDE, removing impl or going from "collections" to "collect" isn't saving anyone any time. Or, at least, it shouldn't be.
Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @03:26AM (#3998204)
Sure, but it's always nice when imports fit on a single line without wrapping. Essential, no, but nice.
Re:Didn't see this coming: The Goldman Sachs Github Account by arcdrag on Sunday May 20, 2012 @12:29AM (#3997943)
You realize that any modern language is nothing more than an abstraction layer to automatically generate code in a lower level language right? The only difference here is that if you view the .java file in a plain text editor, you'll actually see that block. You won't see it in modern IDE's though. It gets automatically collapsed, as it is an aid to the compiler more than the developer.
Re:Didn't see this coming: The Goldman Sachs Github Account by hermanhermitage on Sunday May 20, 2012 @01:28AM (#3998035)
One viewpoint is such noise doesn't scale - both for tooling or human consumption.

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?

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @01:46AM (#3998063)
I disagree. It's the concise model that can't scale without tool support. Imagine you import foo.∗, bar.∗, and baz.∗. How does someone reading the code know where the Quux class comes from? They can't, without checking all of the namespaces that were imported. But if you just "import foo.bar.baz.Quux", then you know exactly where Quux comes from.

This whole thread sounds like a lot of non-java-programmers complaining about Java.

(Note: incorrect * used above because HN's parser sucks.)

Re:Didn't see this coming: The Goldman Sachs Github Account by hermanhermitage on Sunday May 20, 2012 @02:35AM (#3998128)
I'm not too fussed with the namespaces - I dont think you will find anyone arguing against that.

What is at issue is the over specialization of class or framework components because of language limitations.

A language that leads to degenerate boilerplate or mounds of endless repetition (but in user land code and libraries/frameworks) can be viewed as having a serious abstraction problem.

Do you really think java will be looked at in 100 years as the pinacle of language evolution or some horrible dead end? Like cobol or basic?

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @03:37AM (#3998224)
This library looks bad because it is bad.

(I just wrote a long rant about this, but on my internal blog, so I'll summarize here. They have 12 classes implementing immutable lists. A class for an empty list. A class for a list with one element. A class for a list with two elements. That continues to 10 (!!!!) elements. Then there's a class for lists greater than size 10. This pattern is repeated for all the other types. That's going to be messy in any language. Google seems to survive with 0-, 1-, and n-element classes.)

Re:Didn't see this coming: The Goldman Sachs Github Account by arcdrag on Sunday May 20, 2012 @01:40PM (#3999431)
Do you think that 100 years from now, anyone other than programming language researchers will have heard of any programming language used today?
Re:Didn't see this coming: The Goldman Sachs Github Account by DanBC on Sunday May 20, 2012 @01:44PM (#3999448)
Do you think 40 years ago people would have thought that people would still be using C (and derivatives)?
Re:Didn't see this coming: The Goldman Sachs Github Account by hermanhermitage on Sunday May 20, 2012 @10:36PM (#4001002)
Yes a very interesting point. You could even replace C in that sentence with Algol and it rings fairly true.

In C it always feels like the pillars were speed of implementation and speed of execution on low cost hardware and without sophisticated compilation technology.

Ignoring syntactic issues there are only a few things I wish it had as part of the specification (when viewing it as a (if used in a certain manner) portable minimum viable language where assembly language meets high level languages):

1. A better implementation of Landin's J operator than setjmp 2. Compile, Link, and Load time reflection 3. Portable dynamic code generation (at runtime) operators (to allow late binding and JIT style optimization).

Java can be also viewed as a reworking of Algol but this time with design pillars centred on working in a VM, modularity for large code bases and simplification principles.

It always feels to me like the simplification was intended to reduce complexity (originally: signed ints, no function pointers, no lambda, no manually managed memory objects) but unfortunately this has just pushed huge complexity into code bases. Whilst I can accept this in C (minimum viable human readable and writable portable code), for some reason because Java sits on a huge stack of runtime code and tooling I dont like it. What Java did really bring to the mainstream is the whole VM thing (although some of us will remember BCPL or UCSD p-code), but I think the VM brings too much Java-ism into it and a smaller and better VM lies within.

Re:Didn't see this coming: The Goldman Sachs Github Account by bradleyjg on Sunday May 20, 2012 @01:57AM (#3998077)
The very best chess teams consist of a computers and a humans cooperating with each. The computer insures perfect tactically play while the human concentrates on overall strategy.

Why should programming be any different? The very best IDEs in the hands of a skilled programmer should produce code better than a similarly skilled programmer who insists on using a dumb text editor. If the resulting code can only effectively be modified by a similar computer/human team - well that's a small price to pay.

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @03:54AM (#3998244)
I made a vow to myself to never reply to a comment that used both "tactics" and "strategy" in the same sentence, but here goes...

Why should programming be any different? The very best IDEs in the hands of a skilled programmer should produce code better than a similarly skilled programmer who insists on using a dumb text editor. If the resulting code can only effectively be modified by a similar computer/human team - well that's a small price to pay.

That's true, but show me an IDE that lets someone write better code than someone without the IDE. The reality is that IDEs provide very superficial features that help beginners be more productive, but don't help experienced programmers much. (The most cited feature, symbol completion with docstrings, is available in pretty much every text editor. It's nice confirmation that your mental model matches the tags table, but hardly essential.)

All I can say is: Java got a lot easier for me when I stopped trying to make Eclipse useful. It turns out that Eclipse doesn't really do anything except sleep(5) after every keystroke.

Re:Didn't see this coming: The Goldman Sachs Github Account by eliasmacpherson on Sunday May 20, 2012 @06:37AM (#3998459)
The speed and manner in which the full version of Visual Studio allows you to debug container objects and jump JIT to the code currently executing to look at the call stack and inspect variable values, is not superficial. As a text editor, code writing tool, sure it's not much better than a standard editor. As an IDE with a debugger it allows an experienced developer to debug faster and write better code more quickly. Even experienced developers have to debug their code, and it is time consuming even for them.

Eclipse is not Visual Studio though I've heard good things about IntelliJ IDEA.

Re:Didn't see this coming: The Goldman Sachs Github Account by edwinnathaniel on Sunday May 20, 2012 @08:17PM (#4000661)
Visual Studio is not Eclipse either.

IntelliJ is on par with Eclipse. Period. Let us put a stop into that topic.

Re:Didn't see this coming: The Goldman Sachs Github Account by arcdrag on Sunday May 20, 2012 @08:30PM (#4000705)
The refactoring tools in IntelliJ make it possible to catch a lot of things that would be very difficult to do with emacs of vim. For example, I know a certain utility method exists in several different classes, so I want to extract that method and utilize it throughout my project. The IDE will search the project for any block of code that meets this pattern and will ask you if you want to replace it with this new utility class instead. For smaller projects (<25k LOC) this isn't a big deal, as any major dev will have seen every line of code. For very large projects, I can't imagine going back.

Also, if you're basing your IDE experience solely on Eclipse and Netbeans, give IntelliJ a try. Both Eclipse and Netbeans pretty much seem unusable after you use IntelliJ for a while.

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @10:11PM (#4000951)
I don't think "very large" means what you think it means :) I work on a codebase that recently passed commit number 30,000,000. I don't know how many lines of code that ends up being, but it's a lot :)

Basically, my experience with IDEs at Google is that none of them can handle our repository. Even managing the transitive closure of a single project, Eclipse randomly freezes while typing. I don't know anyone that uses Eclipse anymore. Most of my team uses IntelliJ, but even then, the codebase is just too big for it. People type something like com.google.commons.collect.L and see no results (when the right answer is "Lists"). I haven't debugged this, since I don't have any interest in using IntelliJ, but the number of times a day I'm brought to someone's desk to "watch this", I don't think it would work for me. I'd rather have consistent limitations than random failures. Emacs won't iterate over every Java file in Google's repository to complete "Lists" as above, but if I've used it in another file, it will.

The good news is, we have an internal code indexing system that provides an RPC API for many of the IDE features, including completion and duplicate code detection. (But most of the Java chores that people love their IDEs for are handled in other ways at Google. I don't think I've ever written a getter or setter, for example, because every class I've written has been immutable with private internal state. When your objects aren't dumping grounds for other objects, you don't need to get or set anything! :)

Like I've said in other comments, I would never do Java outside of Google. But since I'm here, I have nice tools available to me and using Emacs for Java is no problem at all.

Re:Didn't see this coming: The Goldman Sachs Github Account by bradleyjg on Monday May 21, 2012 @04:37PM (#4004803)
The great-grand parent's original point was that a language that needs tools to be written effectively is a flawed language. If I diverted that into a meaningless argument about what type of tools are best, then I apologize.

I stand by my original point though. I wouldn't want to write in any programming language without tooling and the availability of sophisticated tooling (of many different styles) for a given language is a strength not a weakness.

Re:Didn't see this coming: The Goldman Sachs Github Account by kiba on Sunday May 20, 2012 @03:13AM (#3998191)
The very best chess teams consist of a computers and a humans cooperating with each. The computer insures perfect tactically play while the human concentrates on overall strategy.

Except, we're using computers to help assist us with a terrible codebase that is unnecessary complex and verbose.

Why should programming be any different? The very best IDEs in the hands of a skilled programmer should produce code better than a similarly skilled programmer who insists on using a dumb text editor. If the resulting code can only effectively be modified by a similar computer/human team - well that's a small price to pay.

Vim and emacs not "dumb text editors". They are very powerful tools in the hand of a skilled programmer.

Re:Didn't see this coming: The Goldman Sachs Github Account by irahul on Sunday May 20, 2012 @06:16AM (#3998427)
> The very best IDEs in the hands of a skilled programmer should produce code better than a similarly skilled programmer who insists on using a dumb text editor.

The very best IDEs produce code at the skill level of dumbest programmers - generating getter-setter, or importing, or wrapping something in try-catch...From the top of my head, I can't think of a single instance where the code produced by IDE can be considered semi-intelligent, let alone at par with code produced by skilled programmer.

And code produced by a skilled programmer using a dumb text editor? A skilled programmer using notepad, eclipse and vim produces different code in all 3?

Re:Didn't see this coming: The Goldman Sachs Github Account by FuzzyDunlop on Sunday May 20, 2012 @07:37AM (#3998544)
When I think about this, I think it's actually correct that an IDE produces fairly unintelligent code.

The smarter and more intelligent it gets, the harder it is for the less skilled programmer to edit it.

The skilled programmer can still improve the unintelligent code.

Re:Didn't see this coming: The Goldman Sachs Github Account by unimpressive on Sunday May 20, 2012 @11:44AM (#3999058)
>The skilled programmer can still improve the unintelligent code.

In my experience, fixing a crap piece of code (Usually called refactoring.) takes longer than just writing a correct implementation from scratch. In most cases.

Re:Didn't see this coming: The Goldman Sachs Github Account by eropple on Saturday May 19, 2012 @11:44PM (#3997871)
And then hides it. Which I'll agree is a little stupid, but you never really see it in practice.
Re:Didn't see this coming: The Goldman Sachs Github Account by sevenstar on Sunday May 20, 2012 @11:57AM (#3999095)
Does Eclipse do that?
Re:Didn't see this coming: The Goldman Sachs Github Account by jlarocco on Sunday May 20, 2012 @12:21AM (#3997932)
If it's "useless shit", why have it there at all?

But hey, at least you have a fancy, complicated IDE keeping track of all the "useless shit" for you, right?

Re:Didn't see this coming: The Goldman Sachs Github Account by ntkachov on Sunday May 20, 2012 @12:27AM (#3997938)
I think you missed the "computer" part in "computer programming language". It's there because it needs to be for the JVM. It resolves naming conflicts so that having two "component.java" files in the same project don't end up blowing the whole thing apart.
Re:Didn't see this coming: The Goldman Sachs Github Account by crumblan on Sunday May 20, 2012 @09:58AM (#3998769)
Actually, it looks like he was picking on it for something he thinks it does poorly.
Re:Didn't see this coming: The Goldman Sachs Github Account by arcdrag on Saturday May 19, 2012 @11:15PM (#3997801)
No Java devs actually type any of that. Java IDE's are very good at generating this sort of code...for this very reason. No one would still be using Java if they actually had to remember full package names.
Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @03:40AM (#3998232)
That's not true; many of us still use Emacs and Vi and do remember package names.
Re:Didn't see this coming: The Goldman Sachs Github Account by laluser on Saturday May 19, 2012 @11:10PM (#3997790)
You don't have to be so explicit:

  import com.gs.collections.impl.*;
Just out of curiosity, how are imports done in your language of choice?
Re:Didn't see this coming: The Goldman Sachs Github Account by jabr on Sunday May 20, 2012 @01:43AM (#3998055)
I can't speak for jlarocco, but my concern is not directly the import statements, but rather, what those import statements imply.

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?

Re:Didn't see this coming: The Goldman Sachs Github Account by jrockway on Sunday May 20, 2012 @01:51AM (#3998068)
This has nothing to do with Java. I thought the same thing until I started working for Google. There, I saw correctly designed APIs that are pleasant to use, all while still being standard Java.

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 :)

Re:Didn't see this coming: The Goldman Sachs Github Account by koko775 on Saturday May 19, 2012 @11:08PM (#3997785)
Why? It's pretty good, all things considered.
Re:Didn't see this coming: The Goldman Sachs Github Account by pjmlp on Sunday May 20, 2012 @01:03AM (#3997995)
So does your favourite language use modules to help organize large scale applications?

If so, how do they look like?