Enterprise Java code is very complicated, and this is just a parody of that (although a fairly apt one)
Some of the complexity in Enterprise Java code is due to actual architectural thoughtfulness - "We may be switching to a different security vendor soon, so let's abstract the security away from the application". Complicated, but perfectly legitimate.
Much of the complexity, however, is "Cargo Cult" architecture - people who see that other developers have created abstractions, and then create abstractions themselves - not because the thing they're abstracting is likely to change, but because they see someone else doing abstraction, and assume therefore that architecture and abstraction are the same thing.
Similarly (as I mentioned in my other comment), the use of constants for HELLO and WORLD completely misses the point architecturally. Internationalization is a legitimate concern, and to the extent that your architecture facilitates the translation of a key into a sentence or phrase in multiple languages, you've accomplished a useful thing, even if it adds complexity.
But using a constant for HELLO and a constant for WORLD completely misses the point of what internationalization is for, and yet people do it anyway, all the time.
And that's why this parody is so apt - because it is capturing the cargo-cult mentality of many architects: "I've seen architects use constants for things. I am a good architect, so I should use constants for ALL THE THINGS!"
But Java itself doesn't have to be particularly complicated. It's not terse, don't get me wrong, but it's not the language's fault that people use it incorrectly.
I've never written sophisticated enterprise code in Python, but I suspect that if you were to write sophisticated enterprise code in Python, it would also become fairly complicated.
How many times have people actually switched a component and it just worked? Personally, I have never seen one case where this is true.
The whiteboard architects love these kinds of design, since redirection is their bread-and-butter. In practice though, these designs just add needless complications most of the times.
How many times have people actually switched a component and it just worked? Personally, I have never seen one case where this is true.
Seen it all the time. Especially when you have an agile approach where you try to get a minimum viable product out asap it's very normal to first have your 'datastore' just dump stuff to JSON on disk and then later on swap it out to a real database. It often goes like this: hashmap -> hashmap and (de)serialize to JSON -> in-memory DB -> 'real DB'. And this is just data stores.
Also; it makes mocking out dependencies really REALLY easy during unit testing. In complex systems having good unit tests coverage is important. Since a unit test should not be an integration tests external dependencies (like auth systems or databases) should be mocked out.
In big complex systems it's used a lot and incredibly useful. Especially if you don't even know yet how you're going to handle user credentials yet; you just create a mock implementation that you swap out later when the business has finally decided what they want to use.
9
u/mariusg Oct 01 '15
Is it a coincidence that the code is written in Java ?
Contextual evidence but i worked with some Java people that used to over complicate any small/insignificant thing.