
Fizz Buzz: Enterprise Edition - geetarista
https://github.com/Mikkeren/FizzBuzzEnterpriseEdition
======
raganwald
This seems to be implemented in a single programming language without any
dependencies on legacy systems. A truly enterprise-grade system talks to
PL/SQL stored procedures. Or it would, if the DBAs had written the stored
procedures. But they haven't responded to your ticket request yet. And when
they do, it will be with a mostly irrelevant question delaying actual work for
another week. by which time their manager will be offsite at OracleWorld and
won't be able to approve the changes.

~~~
logn
Also it would be nice to configure the strategies with XML. Plus it would be
super helpful to have jar plugins for new strategies. And seriously, there's
no SOAP interface? This is hardly usable then. Also how the heck am I supposed
to build this without Ant and batch and shell scripts to call Ant? Plus once
you get ant files you can integrate it with Hudson. And package this as an EAR
and add some user authentication too, probably single sign on. Also needs some
log4j. And there are probably all sorts of unforeseen bugs and style issues,
so it needs Findbugs and Checkstyle integrated.

~~~
ivanmaeder
You're right. There are so many issues with this, on top of the ones
mentioned.

No serious enterprise-grade software today would do without leveraging Maven,
annotations, IoC, AOP...

And why isn't the UI decoupled from the business logic? What happens if one
day another team in the organization needs access to Fizz Buzz? Writing their
own Fizz Buzz would be extremely redundant (even dangerous), and if anybody
changed the logic of Fizz Buzz it would have to be changed in multiple places
at the same time: a simple change like making "Fizz" print every fourth time
instead of every third time would make every Fizz Buzz team go through
architecture, various change management meetings and at least one weekend
deployment. And all of this would have to be coordinated to make sure it all
happens within a single change window (assuming this could even be rolled out
in a "big bang" situation).

No problem. IT solves this problem easily with the seamless integration of
EJBs, or SOA (as mentioned), or a modern plug and play ESB. There are multiple
ESB vendors, each with their own advantages and disadvantages, so best
practice advises organizations to create a working group comprised of all the
stakeholders of the organization with the aim of reaching a consensus on the
best product to use and the best way to move forward with this (it's more than
likely the whole company will want to move to an ESB platform quickly because
everybody likes to leverage and everybody likes things that are seamless). The
team does not have to be very technical (the brochures and online PDFs explain
things very well). Plus anybody inside the organization who thinks they need
to participate should be involved.

On another note, the programmer who decided to take the initiative and write
this needs to have a one-on-one with his or her manager immediately. Even
organizations that value proactivity will find problems with this: there is a
strict violation of at least one of the basic principles of enterprise
software. I don't see any constants defined and everybody knows that "the
enterprisocity of an application is directly proportionate to the number of
constants defined."

<http://thedailywtf.com/Articles/Enterprise_SQL.aspx>

This would never get promoted through change management. Why hasn't anyone in-
house written an Eclipse plug-in for this yet?

~~~
logn
Thank you, yes, I forgot so many things. And most important, where is the test
suite for this? I'd expect at least 80% line coverage and would like to see a
coverage report to dive down into the specifics. Additionally, it would be
nice to have some performance numbers as a base line for sizing, and timing of
each method.

Further, what's the license on this? I'm afraid even if it's LGPL I can't go
near this.

------
trotsky
Startup edition:

    
    
        * provision one ec2 instance per number to check
        * assign numeric order based on uptime in msec using zookeeper
        * serve result via json
        * render it on the client.

~~~
emiljbs
Don't forget about the RESTful interface to the application.

~~~
rjzzleep
first of all restful and json are not really welcome. do your JAX-WS first and
then we can talk about these new silly things.

~~~
brightsize
Good point. Those fizzy SOAP requests need to be signed too. Enterprise
Security and all.

------
jconley
Amateur hour. Serious Business this is not. Where are the tests? The Inversion
of Control? The logging? The analytics system? Documentation? Architecture
diagrams? Someone should either fire or promote this engineer immediately.

~~~
camus
And he should have used a CHAIN OF RESPONSABILITY pattern instead of the
IF/ELSE to handle each case , and the FOR loop should have been handled by a
STATE PATTERN , finally the system.prints require a full BUILDER to decouple
datas from rendering triggered by COMMANDS , that work is indeed "amateurish"
, especially without a SERVICE LOCATOR.

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

~~~
norswap
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?

~~~
edwinnathaniel
> 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

~~~
metaphorm
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.

------
mosburger
This is obviously bogus. Where are the XML configuration files?

~~~
Terretta
This needs at least 70 maven dependencies.

~~~
jlgreco
It's just not enterprise if it's not relying on an internally modified version
of maven that drops compatibility with the outside world.

------
leothekim
Wow. There were pull requests that were accepted to this project:

[https://github.com/Mikkeren/FizzBuzzEnterpriseEdition/pulls?...](https://github.com/Mikkeren/FizzBuzzEnterpriseEdition/pulls?direction=desc&page=1&sort=created&state=closed)

The potential for more funny is great here.

~~~
SatvikBeri
My favorite:

 _Change <= to < and ==_

"One-liners lead to unclear code that has too much responsibility crammed into
too little space. It's better to do less per line and keep the code readable.
This changes the very complex and ambiguous operation <= into two separate,
easily understood operations < and ==."

~~~
kibwen
Last week my colleagues and I realized that the official, Zend-provided, XML-
based communication system that allows our PHP middle-end to talk to our RPG-
based backend doesn't allow you to return any character string that includes a
less-than symbol.

One of our routines returns a SQL string.

Sometimes SQL strings contain less-than symbols.

After much handwringing and an official bugfix that fixed nothing whatsoever,
we decided on the next-best solution: all instances of `where foo < bar` must
be generated as `where foo != bar and foo !> bar`. I shit you not, that is a
not-greater-than operator.

[http://pic.dhe.ibm.com/infocenter/dzichelp/v2r2/index.jsp?to...](http://pic.dhe.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.qmf.doc.ref%2Fdsqi2mst263.htm)

I may sound frustrated, but I'm not. We all had a good laugh at the workaround
and got back to work. This sort of thing is sometimes known as "job security".

~~~
sbmassey
why not just use 'where bar > foo'?

~~~
kibwen
Ugh, I really don't feel like explaining. :P

Long story short: bureaucracy.

------
edw519
_Please note that GitHub no longer supports Internet Explorer versions 7 or
8._

How ironic. This covers so many enterprise programmers with locked down
Windows PCs.

~~~
portlander12345
Of course, a really industrial-strength FizzBuzz would be in an SVN repo.

~~~
packetslave
Ha! You think any enterprise IT shop is going to trust an open-source product
like Subversion with their mission-critical source code? It would be in
Perforce or MS Team Foundation Server.

~~~
jlgreco
Eh, Perforce is too pleasant if we are really embracing enterprise; makes it
too easy to do sensible things like use a git client. No, it has got to be SVN
for maximum pain.

~~~
steveklabnik
If you think SVN is 'maximum pain' then you haven't tried out the full array
of actually bad VCSes. SVN is fine, if a little outdated-feeling.

~~~
kyllo
Three words: Microsoft Visual SourceSafe.

~~~
ttrreeww
Rational from IBM!

~~~
tacticus
I worked at uni that wanted to push this onto the CSIT students :| Such a
horrible dept

------
georgemcbay
This would be hilarious if it weren't so painfully accurate for some code
bases I've had the misfortune of working with.

~~~
fournm
This is my day job in a nutshell. Somewhere around the 5th folder click I
couldn't decide if I wanted to laugh or cry.

~~~
joshrotenberg
Cry. You wanted to cry.

~~~
skore
I did cry a little. Hit too close to what is sometimes home[0].

[0]
[https://plus.google.com/u/0/111011776153281260419/posts/GWdk...](https://plus.google.com/u/0/111011776153281260419/posts/GWdkoC4f1Gb)

------
sbmassey
Where is the Spring dependency injection stuff? You can't just hard code all
your Factories in FizzBuzz.java, you need to specify everything using XML so
you can switch Factories without going through a recompilation.

~~~
cgh
Exactly. No Spring, no Maven...I mean, come on. Plus, I'd like to see some
Camel routing defined for sending my crucial FizzBuzz results to various
endpoints.

Oh yeah, and what about when I want to run scheduled FizzBuzz? Obviously I
need Quartz, which requires...more XML!

Let's not get into the necessity of making a FizzBuzz OSGi bundle - we'll
tackle that in the next iteration.

~~~
portlander12345
Sounds like a typical Gemfile.

------
Aloisius
Can someone tell me why Java seems so to have developed into this kind of
chaos? It isn't just enterprise java, has anyone looked at the Apache java
projects lately?

Tens of thousands of lines of dependency xml (that often doesn't even work
because of incompatible common dependencies), three different built systems
(ivy, ant and maven), abstraction for classes that have just a single concrete
version, dependencies that are _old_ and no longer supported (I'm looking at
you Apache Gora). Hell, find the _download_ link on most Apache java project
sites. Now find the one for the source repository.

What madness has infected Java developers?

(Sadly, I've recently had to start doing a bunch of big data work with hadoop,
possibly the most fractured and poorly documented open source project ever
created)

~~~
ekimekim
Your fallacy here is that:

Enterprise programmer -> Java Developer

Java Developer -/-> Enterprise programmer

The correct question is: What madness has infected Enterprise developers (and
why do they all use Java)?

~~~
jlgreco
It is not as common these days, but the "enterprise bug" pops up with C++
sometimes as well. "Enterprise C++" doesn't look quite the same as "Enterprise
Java" (generally the build tools/system/etc are not particularly
enterprisified), but when you see it you'll recognize it as the product of a
similar mind by it's distinct smell.

------
grannyg00se
This is terrifying. It's like a docu-horror flick for programmers. I actually
felt depressed, anxious, frightened, and dispaired going through that code.

------
31reasons
I think a lot of programmers in the enterprise world are consultants and paid
by the hour or day. That means longer it takes to solve a problem and then
later support it the better. You are paid more for working on the project
longer. That naturally drives people to create elaborate schemes for simple
problems and make more money.

I give another example where goals and rewards are misplaced. India has a
serious Cow problem. Every city in india has thousands of cows roaming freely
on the streets. New Delhi, india's capital decided to solve this problem by
hiring workers who would take this cows from the streets , put them in trucks
and move out of the city. They get paid for the number of cows they collect
every day. Guess what happens ? They release the cows next day into the city
so that they can collect again and make money.

Anywhere there are goals and rewards misplaced, inefficiencies will creep up.

------
ambiate
This is how I learned Java in software engineering. Simplistic if/else logic
transitioned to enterprise madness. It left a bad taste for most of us in the
program.

If you are a teacher in this position, provide fleshed out source/examples of
enterprise software/requirements and have the students extend the
functionality. Using minimized examples to prove the concept leads to
rebellion/disgust.

------
fmstephe
I love this. I just wish it was a joke. This is a daily reality for so many of
us.

~~~
niggler
do you put .java. in your package names? That one stood out as really strange
(others were par for the course)

~~~
fournm
I've not seen it directly in the package names, but I've definitely seen
project hierarchies with source/java even though no other languages were used
(or going to be used, for that matter).

~~~
SixteenBlue
To be fair, src/main/java is often the default places build systems look for
code. I'd rather use that then complicate my build scripts.

There's also src/main/resources, src/main/webapps, and possibly other dirs
that can go in there that aren't other languages.

------
jxf
Funny, but a little too obvious.

What if you did a Poe's Law version of this? That is, try to create the most
contrived parody of a solution to FizzBuzz possible, but one which still fools
at least 50% of interviewers into thinking it's a legitimate response.

~~~
minimaxir
That would just be a script to Google for the FizzBuzz solution.

------
kayoone
Haha, i remember this new java guy at my (games)company that implemented his
version of a skill/weapon system and in the end had like 20 Different
Classes/Interfaces/Abstract Classes/Factories. It worked, but was horribly
over engineered and much harder to understand than a much simpler version we
made out of it.

Abstraction makes code harder to read, so use it wisely!

------
canadev
I got about 4 levels deep in the folder hierarchy before I got disgusted and
had to close the tab.

------
whichdan
If you want to turn this into a SaaS solution, I would be happy to donate the
domain FizzBuzzAPI.com to your cause. I think the community would really
benefit from being able to offload the overhead of solving FizzBuzz problems
to an external service.

------
samspot
IMO this doesn't make the cut because they didn't externalize the Strings
"Fizz" and "Buzz".

------
daeken
I had a bunch of fun coming up with terrible ways to write FizzBuzz a little
while back. My favorites, in Python
<https://gist.github.com/daeken/1e3c680c20da98c680c4> and C
<https://gist.github.com/daeken/15769d83b66974335f78>

~~~
Goopplesoft
That python code made me cringe. decorators, parsing, compiling and evals? You
win.

~~~
reinhardt
No metaclasses or descriptors though, still needs some work.

~~~
pcote
Oh, you want metaclasses? How about this?

print(type("",(),{"__call__": lambda self, start, end: [(n, (lambda x: ("fizz"
if x % 3 == 0 else "") + ("buzz" if x % 5 == 0 else ""))(n)) for n in
range(start,end+1)] })()(1,50))

------
paf31
I can't tell if some of the obviously missing patterns are accidental or just
representative of that usual type of code with all of the wrong patterns and
none of the right ones.

------
orangethirty

        *Ticket 23145gwy54fvdr*
    
        Variable names do not follow standard.
        Revise and submit to Q&A.

------
jonahss
It's rather cumbersome that you have to initialize all those factories in
FizzBuzz.java. You should probably be using an Inversion of Control system.

~~~
modarts
But what if you wanted to swap out your IOC container? I think you'd have to
inject your container using an InversionOfControlFactory pattern

------
jodrellblank
How is anyone supposed to tell this is a spoof when things like this

    
    
      '  sum = sum + i
      Array.SetValue( Text.Append( "GetSum", GetSum_Locals), "sum", Array.GetValue( Text.Append( "GetSum", GetSum_Locals), "sum" ) + Array.GetValue( Text.Append( "GetSum", GetSum_Locals), "i" ) )
    

\-
[http://wiki.smallbasic.com/Simulating%20Local%20Variables.as...](http://wiki.smallbasic.com/Simulating%20Local%20Variables.ashx)

unironically exist in a language "aimed at bringing "fun" back to programming.
By providing a small and easy to learn programming language in a friendly and
inviting development environment, Small Basic makes programming a breeze"

?

------
tomjakubowski
Just so I never have to answer it again for an interview, I wrote a
specification and implementation for FBaaS (FizzBuzz as a Service):

<http://github.com/tomjakubowski/fbaas>
<https://github.com/tomjakubowski/fbaas/tree/sinatra>

Accepting pull requests! I've had a couple mind-blowing contributions in
obscure languages, my favorite being a provably correct Fizzbuzz service
written in Coq:

<https://github.com/tomjakubowski/fbaas/tree/coq+hs+wai>

------
agibsonccc
Where's the xml configuration and dependency injection? (I'm a java programmer
primarily myself and thought this was hilarious)

------
Silhouette
It's all fine, you just need a better IDE. :-)

------
niggler
Where's the build script?

~~~
joeblau
Gradle build script of course!

------
Aco-
refactored:

class F{public static void main(String[]a){for(int
i=0;i++<100;)System.out.println((i%3>0?"":"Fizz")+(i%5>0?i%3>0?""+i:"":"Buzz"));}}

~~~
WayneDB
That's great, but we're here to make fun of "Enterprise" programming and
anything associated with it. Now you come along and give us this simple
example that works.

I bet it would still be better in Javascript or Ruby because those are the
only two languages that I know and everything is better as a web app anyway.

------
edmond_dantes
To truly be enterprise it needs a Maven build and JavaDocs.

------
rachelbythebay
Want to see this kind of stuff done entirely seriously? Search for solutions
to the "Thoughtworks rover" problem. When you see a class for each direction
you might be heading, you know you're on the right track.

------
gingerlime
my colleagues had to come round to my desk to see what it was I was laughing
about. Don't remember the last time looking at code made me laugh.

------
rcoh
This is missing Spring config! How could is possibly be considered a real
enterprise app without at least half of its logic encoded in XML!

------
kemiller
I'm disappointed. They could have removed the if/else blocks by dynamically
selecting the strategy and abstracted the loop. B-

;)

Tempted to send this to my Java colleagues.

------
rjzzleep
lol, cracked me up.

I met some c# guy who did the whole enterprise thing in his version, but it
wasn't tongue in cheek at all.

in my head I went, this is why the whole ms enterprise stack sucks balls. the
sad part is that they actually think it's good to abstract away something
really simple.

EDIT: removed the link, sorry for offending you dude

~~~
WayneDB
_"in my head I went, this is why the whole ms enterprise stack sucks balls."_

Brilliant. So, if some random programmer built some way-over-complicated
Javascript solution, would you think that the entire web platform "sucks
balls"?

 _"the sad part is that they actually think it's good to abstract away
something really simple."_

Who is _they_? Microsoft, this random c# guy or all c# programmers? If you
answer anything but "random c# guy", I'd like your evidence please.

Also, let's see some of your code please. Not fizzbuzz. I wanna see some of
your real life code.

~~~
pekk
The problem isn't random programmers, it is a culture and tool ecosystem which
says that this is the right way to do things. If it were just one random
programmer, there would be nothing to complain about.

If some guy decides to write his website in his own dialect of Visual Basic,
that isn't really being inflicted on anyone but his employees. The deeply-
nested StrategyFactory stuff is an infection which worst affects languages
like Java and C# (recruiters call it "OOP") because those communities do not
strongly reject it.

~~~
WayneDB
So, you should be able to show me dozens of tools that are the default choice
within these ecosystems, that make programmers build things in this way.

Can you please name some tools and tell us how they say this is the right way
to do things?

~~~
raverbashing
Really?

Eclipse, Netbeans, Maven, JUnit, JLog

J2SE libraries - pretty much _all_ of them

Apache libraries

Hibernate

J2EE libraries

The list is endless

Even Google App Engine manages to be way more convoluted in Java than in
Python or Go, it's not even funny

~~~
sukuriant
I use Netbeans[1] and Eclipse all the time, and I don't write Java code like
that. Then again, I write GUI's by hand in swing, so .... there is that.

[1] edited from Netflix. I use Netflix all the time, too!

~~~
raverbashing
Netflix? I think you mean Netbeans maybe =)

I don't write java code like that as well (and I don't use swing) but
sometimes is unavoidable due to the ways the libraries are structured.

------
capkutay
He forgot to mavenize the project...

------
brightsize
This may be Enterprise Quality but without UML diagrams our Architects are not
going to be able to understand or use the code.

Are you offering support contracts? MegaCorp Management requires that we have
paid support, the more expensive the better.

------
jrabone
Nothing new here...

[https://groups.google.com/forum/?fromgroups=#!msg/alt.humor....](https://groups.google.com/forum/?fromgroups=#!msg/alt.humor.best-
of-usenet/DRfqzWlNUbQ/iPlJIjfaiN8J) [1997]

------
Tichy
So can this automatically be distributed to multiple servers? Impressive.

------
habosa
Can you get this into a Maven repo? I'd like to include it via my pom.xml, I
have some numbers that need FizzBuzzing and they always say great developers
never repeat the work of others.

------
ffn
God... this is particularly painful because I remember first seeing this in a
thread on boards.4chan.org/g/... and now, several months later, here it is on
hacker news.

------
stugrey
So, so good. I hope it includes at least one undocumented legacy code
nightmare for true authenticity.

------
Mahn
Needs more Internal Frames.

------
ttrreeww
Please open your issues at
[https://github.com/Mikkeren/FizzBuzzEnterpriseEdition/issues...](https://github.com/Mikkeren/FizzBuzzEnterpriseEdition/issues?state=open)

And contribute your fix.

