News for hackers. Stuff that matters.
Re:Fizz Buzz: Enterprise Edition by MattRogish on Monday March 18, 2013 @01:31PM (#5395711)
I've often wondered - is it the language that spawns this or the mindset of the developer (or both?)

I see this primarily in Java or .NET shops - massive layer upon layer, code generation, factories, classes, etc. - when a simple architecture would be best. Why do we get these insane things to begin with? What's going on?

It feels sort of like premature scaling (what if we have millions of programmers - we need more abstractions!) combined with misuse/misapplication of design patterns.

You'll never* see stuff like this in Ruby on Rails, JavaScript, Python projects, etc. I'm curious how one goes from a simple, elegant program to over-engineered monstrosities.

* Hardly ever. I haven't in > 7 years.

Re:Fizz Buzz: Enterprise Edition by jfb on Monday March 18, 2013 @02:39PM (#5396237)
It's environmental, largely driven by a) the need for cost certainty, and thus the susceptibility of non-technical management to the allure of the Bag Of Magic Beans sales pattern (see also: the fungibility of skilled work fallacy); and b) the need for risk abatement in large organizations.

I've always found it most useful to think of this sort of garbage as an effort to hedge against terrible communication. Sure, it's likely to be a load of blood sweat and tears spent on useless tangential silliness; but one time in a hundred, the plastering of abstraction over ill-definied abstraction will allow a team to anticipate one step ahead in the chain of ever-shifting requirements, and thus, earn back a few hours and a tiny shred of dignity.

Nobody really likes this crap. But the life of the mean programmer is a grim one, indeed. Ultimately, the problem is that nobody really knows how to write software.

Re:Fizz Buzz: Enterprise Edition by norswap on Monday March 18, 2013 @01:44PM (#5395814)
I wonder too. I write a very atypical brand of Java (I like to think of it as "unencumbered Java"). I sometimes even use public fields instead of accessors (o, the heresy).

My best guess would be that you often need to refactor you code to include some of the patterns showcased in the repo (factories, for instance). So developers try to future-proof their project by using those patterns everywhere. This is obviously a terrible idea.

Now for the bitchy part, why does no one ever speaks about the good sides of Java?

Re:Fizz Buzz: Enterprise Edition by ajanuary on Monday March 18, 2013 @02:53PM (#5396328)

  So developers try to future-proof their project by using those patterns everywhere.
Something I've seen a lot (and been guilty of myself) is trying to fix the problems of past projects in new projects before they crop up.

A better solution is to not be afraid of refactoring (tests help here) so you can solve the problems when they become a problem, not create complication before.

Re:Fizz Buzz: Enterprise Edition by edwinnathaniel on Monday March 18, 2013 @03:08PM (#5396432)
> Now for the bitchy part, why does no one ever speaks about the good sides of Java?

Cause at some point most of them got tired to preach about Java and continue to do great work vs worrying what other people think.

Look around: NetFlix, Yammer, Twitter, Google are all using Java to power either their infrastructure or apps. Nobody blogs about it because "It Works" ;)

The rest blogs how they keep jumping between wagons :P

Re:Fizz Buzz: Enterprise Edition by metaphorm on Monday March 18, 2013 @03:29PM (#5396577)
this joke thing isn't really about Java as a language though. its about a very weird/bad and surprisingly common design anti-pattern. Java was used to do this joke because its utterly typical for this type of work, but certainly you can have this kind of disgusting enterprisey garbage in just about any programming language.

nobody makes jokes at the expense of well written Java software because its well written. we all know that the language is perfectly fine, and in alot of ways quite good, when it is used by sensible engineers.

Re:Fizz Buzz: Enterprise Edition by themstheones on Monday March 18, 2013 @02:11PM (#5396021)
Because people who know the good side of java have jobs.
Re:Fizz Buzz: Enterprise Edition by Leon on Monday March 18, 2013 @02:24PM (#5396142)
I generally go by the saying, baring any existing req's that abstraction patterns would help with:

'Code to use, Refactor to re-use'

Re:Fizz Buzz: Enterprise Edition by charleslmunger on Tuesday March 19, 2013 @02:53AM (#5399342)
Public fields for immutable objects are fine, but adding thread safety later is difficult if you use them.
Re:Fizz Buzz: Enterprise Edition by DrJokepu on Monday March 18, 2013 @02:12PM (#5396025)
Must be the mindset. I've seen plenty of straightforward, well written C# code with none of this garbage. I'm sure it's the same with Java. And you would see plenty of Ruby code written in this kind of style if Ruby was popular in enterprise software development.
Re:Fizz Buzz: Enterprise Edition by gjulianm on Monday March 18, 2013 @02:29PM (#5396165)
I agree with that. For example, Azure storage is pretty straightforward and simple to use [1]. Or LINQ, which is part of the .NET framework and is beautifully simple to use.
Re:Fizz Buzz: Enterprise Edition by DannyBee on Monday March 18, 2013 @01:40PM (#5395782)
Part of it is "customers want it", part of it is because people are taught "abstraction is good", rather than "abstraction can be useful".

So folks abstract everything, because they don't stop to think about whether it makes sense.

You know, just in case the day comes when they need to send requests using carrier pigeons instead of TCP. They never stop to think whether "in a world where we need carrier pigeons, would this app be useful anyway?"

Re:Fizz Buzz: Enterprise Edition by bitwize on Monday March 18, 2013 @01:52PM (#5395884)
Part of it is "customers want it", part of it is because people are taught "abstraction is good", rather than "abstraction can be useful".

"Object-oriented abstraction is going to change everything."

"Yeah, abstraction is good."

Re:Fizz Buzz: Enterprise Edition by tracker1 on Monday March 18, 2013 @06:06PM (#5397483)
Have to agree there... but without having to support/supplant multiple systems simultaneously, or in support of rigid testing, it doesn't make much sense.

In the former case, it's usually easier to rewrite than write a new, compatible abstraction... in the latter, with simpler more custom interfaces, testing can be smoother than a lot of frameworks for these things.

Re:Fizz Buzz: Enterprise Edition by Jamiecon on Monday March 18, 2013 @02:43PM (#5396275)
Not to defend the indefensible, but why not make a couple of discussion points...

If you have a huge application and a high staff turnover you want to minimise the amount of information in your developers' heads. Strictly architected code can do this to some extent, and can go some way to reducing need for that other 'enterprise bane' - documentation. This is less of a problem in a startup type environment were you can find out about a particular piece of code by walking over to the kid that wrote it and having a chat.

Code generation (mentioned elsewhere on the thread) is another example of something that is less necessary in a small environment. Matching an enum to the contents of a database table or whatever can be done by convention to begin with, but it's less practical if your development team is spread across three timezones. Better to invest the time in letting computers do the work.

Re:Fizz Buzz: Enterprise Edition by d4nt on Monday March 18, 2013 @01:58PM (#5395927)
I've worked on a couple of these systems over the years and I think it's a combination of the philosophy of those languages: http://steve-yegge.blogspot.co.uk/2006/03/execution-in-kingd...

And partly a correlation between the type of company that chooses a "proper", statically typed, "enterprise ready" language and the type of company that hires "safe pair of hands" programmers who value predictability over getting stuff done.

Re:Fizz Buzz: Enterprise Edition by tracker1 on Monday March 18, 2013 @06:01PM (#5397459)
Honestly, I'm not sure where it comes from... I tend to bypass/rip out this kind of obfuscated crap from projects wherever possible... "Microsoft Enterprise Library" is about the bane of my existence... I've only seen two projects in the 11 or so years of .Net development where it was a good use case.

Lately, for smaller one-offs, utility scripts etc.. NodeJS is my tool of choice. Even where it isn't the fastest choice, it tends to be one of the easier choices without going to a language the rest of the systems don't use (JS is used on the web, so web devs need to know it anyway)...

/fizzbuzz.js/ for(var i=1;i<=100;i++)console.log(!(i%3)&&!(i%5)?'FizzBuzz':!(i%5)?'Fizz':!(i%3)?'Buzz':i);

Re:Fizz Buzz: Enterprise Edition by derefr on Monday March 18, 2013 @01:50PM (#5395872)
I almost feel like, as a programmer, you can get "calibrated" to a certain level of architecture or designed-in flexibility, and then any time you have to code something "lesser", you end up adding architecture and boilerplate until it looks like the things you're familiar with.

Look at the HTML5 IndexedDB API, for example: obviously designed by someone "calibrated" to coding web browsers, not someone calibrated to doing web scripting.

Re:Fizz Buzz: Enterprise Edition by twerquie on Monday March 18, 2013 @02:59PM (#5396368)
It all comes down to testability. In statically typed languages like C# and Java, it's very hard to test a class in isolation without abstracting hard links between classes, segregating interfaces, inverting dependencies and so on.

You can write "simple" systems in those languages that have the code purity you're looking for, but they won't be very testable.

In the dynamic languages you mentioned, you have duck typing and testing is a walk in the park.

Re:Fizz Buzz: Enterprise Edition by jlgreco on Monday March 18, 2013 @03:53PM (#5396714)
"Nobody ever got fired for buying IBM."

If you are new to an organization, do you rock the boat and fight for code-reviews for nice looking code, or do you bite your tongue and and write enterprise code to make everything go smoothly, from an administrative standpoint? You are not going to be scolded and forced to defend yourself for the enterprisey code, even if it ultimately was the wrong choice.

Writing "enterprise" code is "safe".

Re:Fizz Buzz: Enterprise Edition by visural on Monday March 18, 2013 @03:22PM (#5396514)
From what I see it is usually well intentioned but not exceptional developers trying to write "good code".

They know some sort of abstraction is called for, but they end up picking abstractions which are actually a net negative for code complexity, rather than a positive. If you have enough of these developers then it devolves into code very much like the OP.

There is also a resistance to large refactorings which "clean house" of these sort of abstraction errors in enterprise teams and a lack of developers with the skill (and balls) to do it. So this cruft tends to accumulate.

Re:Fizz Buzz: Enterprise Edition by dbecker on Monday March 18, 2013 @02:12PM (#5396035)
It's a blind insistence on caution.

There are thousands of things one might want to do in the future, and many managers "prepare" for each and every change they can conceive.

Re:Fizz Buzz: Enterprise Edition by nahname on Monday March 18, 2013 @01:47PM (#5395844)
Sharepoint integration or it's ilk pretty much creates necessity for layers. Hide bad code behind layers is the enterprise motto.
Re:Fizz Buzz: Enterprise Edition by GhotiFish on Monday March 18, 2013 @04:20PM (#5396858)
Then angularJS dropped. Now we see it there as well.

[disclaimer: I am programming a service in angularJS for the client and SpringMVC for the server. My code looks exactly like this. I cry myself to sleep every night.]

Re:Fizz Buzz: Enterprise Edition by ank286 on Monday March 18, 2013 @01:57PM (#5395920)
I agree with you. It seems like Java programmers at enterprise ignore Cohesion vs Coupling tradeoffs. Every class and abstraction they write is so tightly coupled which causes issues when debugging or just trying to figure out how to add a feature enhancement without writing more classes. Working as a software engineer, it sucks looking at a 1000 lines of code to do something simple that can be done in 10 lines elsewhere --> means that OO is not the right way to go about things sometimes.
Re:Fizz Buzz: Enterprise Edition by marcosdumay on Monday March 18, 2013 @06:57PM (#5397722)
You need a certain mindset to start using a newer technology, and that mindset won't make you prone to write enterprizy code.

Or, in other words, the place that makes that kind of architecture won't allow the developers to touch anything that's not Java or .Net.

Re:Fizz Buzz: Enterprise Edition by epoxyhockey on Monday March 18, 2013 @02:16PM (#5396077)
I've seen this done in a PHP project (to the extent that it is possible), so I'm pretty sure it is the mindset of the developer.
Re:Fizz Buzz: Enterprise Edition by pekk on Monday March 18, 2013 @02:27PM (#5396159)
Dynamic typing is much maligned these days, but it allows you to abstract without nearly so much boilerplate.
Re:Fizz Buzz: Enterprise Edition by haakon on Monday March 18, 2013 @05:12PM (#5397157)
Boilerplate is not an inherent feature of static typing - just look at Haskell or Scala.
Re:Fizz Buzz: Enterprise Edition by recursive on Monday March 18, 2013 @02:58PM (#5396363)
Statically typed programs are longer because they contain more information.
Re:Fizz Buzz: Enterprise Edition by metaphorm on Monday March 18, 2013 @03:32PM (#5396592)
they don't contain more information. they contain more explicit declarations of that information. dynamically typed languages leave that information hidden because it is inferrable (or irrelevant).
Re:Fizz Buzz: Enterprise Edition by kyllo on Monday March 18, 2013 @05:16PM (#5397171)
>dynamically typed languages leave that information hidden because it is inferrable (or irrelevant).

So do good, high-level statically typed languages, i.e. the kind with type inference. Like Scala or ML.

Re:Fizz Buzz: Enterprise Edition by metaphorm on Monday March 18, 2013 @05:58PM (#5397440)
indeed. Scala's type inference system is truly beautiful. lets hope it catches on and becomes a widely adopted feature of the next generation of languages.
Re:Fizz Buzz: Enterprise Edition by tikhonj on Monday March 18, 2013 @07:42PM (#5397904)
If you want to see a really beautiful type inference, take a look at Hindley-Milner. Not only is it global (it infers all the types in your program) but it's also surprisinlyg simple--it's basically just a straightforward constraint satisfaction problem.

In particular, take a look at how it has been extended by real languages, especially OCaml. OCaml has some very cool sub-typing features but manages to maintain global inference, unlike Scala. (Largely by choosing structural rather than nominative sub-typing.)

So some languages have had better type inference for longer than Scala has been around.

Re:Fizz Buzz: Enterprise Edition by recursive on Monday March 18, 2013 @04:41PM (#5396989)
When the programmer is the one that has to be doing the inference you refer to, there seems to be a good argument that the speed advantage you refer to is only apparent in programs small enough to conceptualize in their entirety.