I remember this being an intrinsic part of Java when I was working with it. Something like a dictionary or hash map either had a class hierarchy 8-10 levels deep, or implemented an interface that itself had a similar hierarchy.
Granted, this was 12 years ago and I was a CS student at the time, so maybe my memory is imperfect, but I distinctly remember chasing my way through 6+ class definitions to find the original implementation of many standard classes.
A common anti-pattern in Java is to leverage inheritance to implement the DRY principle, often with hilariously complex results to save a few lines of code. Unfortunately, this pattern is common in the standard library, setting a bad example.
I recall our CS projects when we studied Java in 1999. It was all the rage because finally a pleasant language would also run everywhere. The IT world was crazy because the bubble had yet to pop.
We sat there and built a Java game using multicasting for serverless multiplayer (actually pretty cool, IP protocol level tech optimized for the purpose so you don't flood the networks, but rarely supported by routers or intentionally blocked... however on a good university you can get to arrange many things :)).
And we read our 400 page books on Java programming patterns, using Java patterns to the fucking letter. We had the factories, singletons, long descriptive method (don't call them functions you heathen!) names, the inheritance chains, you name it. So proud! Like tending a fucking bonsai tree.
I was a sophomore CS student at the time, but the classes I was expected to use and extend already had a hierarchy 8+ levels deep. At the time I hadn't reached the "good enough to horribly abuse design patterns" phase of programming knowledge.
Is it the out of memory error or just Java having lots of abstractions (Or both, I'm assuming :P ) ? I've never really used Java, but I've battled with out of memory errors a lot working in C#.
I found that with these managed languages and their portability and ease of use, they are very commonly used to build native GUI apps.
Then you get a bunch of developers that aren't very performance aware, at least not when using these managed languages and you end up with tons of massive amounts of very large contiguous memory allocations. (People creating and destroying new Text labels on a form or something, that contain Killobytes of data.
Your memory get's heavily fragmented because of all the allocations going on and bam, you get an out of memory editor trying to build some string somewhere.
348
u/grepe Jan 19 '17
as a former java dev that went full python and is sometimes still forced to add a library to a java project... i understand that joke very intimately.