A FactoryFactoryFactory in Production
After I graduated from college made a promise to myself: I would never take a job where I got paid to write Java code for a living. I had seen the light with the functional programming paradigm and languages like Haskell.
I started working at LinkedIn in 2014 when my primary development language was Scala. Scala is a fantastic language, but LinkedIn had trouble scaling it across the organization. Therefore I had to go back on my promise to myself and I started writing Java for a living. Surely it can’t be that bad, right?
Well, I’ll be the first to admit that Java 8 is a huge improvement over previous versions, and you can actually write some decent code with it. The problem is that Java’s shady past still shows up.
Take a look at this real class I had to work with:
class InboundRequestContextFinderProviderFactory
What does this even mean? Why does the context need to be found, provided, and factory-ed? The implementation of the class itself is 1 line of actual logic surrounded by 22 lines of boilerplate.
Or look at this other class I found (emphasizing again that this is real code currently running on production):
class EventFactoryFactoryFactory