[HN Gopher] A FactoryFactoryFactory in Production
___________________________________________________________________
A FactoryFactoryFactory in Production
Author : fragmede
Score : 23 points
Date : 2023-07-07 21:25 UTC (1 hours ago)
(HTM) web link (stevenheidel.medium.com)
(TXT) w3m dump (stevenheidel.medium.com)
| Sesse__ wrote:
| At my first project in my first job, there was a
| MockWorkerInfoServiceStubFactory. I think it was a factory for
| mocks of the stub for the worker info service, but it's never
| easy to know when to pop tokens from the start or from the end of
| such a name... (It was in C++.)
| ts4z wrote:
| I overlapped at LinkedIn at the same time as the author. While
| there, I wrote my first (and to date only) FactoryFactory.
|
| LinkedIn replaced its uses of Spring with a thing called
| Offspring. Offspring explicitly disavowed being a dependency
| injection framework, but it did a similar job for us. I rather
| liked it. Notably, you just wrote Java with it. Invariably, in
| Offspring, you'd have to write a FooFactory to construct your Foo
| object to inject it into some (other class. By convention, all of
| the factories ended in Factory.
|
| Well, I had a use case for a runtime class that needed to make a
| per-request factory to make little objects. So to make my Bars, I
| needed a BarFactory; and to construct the BarFactory, I needed an
| Offspring factory, thus BarFactoryFactory. There it was. I felt a
| little weird after that.
|
| I suspect the EventFactoryFactoryFactory code here was such an
| Offspring factory being used for dependency injection, but I
| can't explain why it produced a FactoryFactory.
| personjerry wrote:
| The story kinda ends at its climax, and abruptly ends upon
| reaching the `class EventFactoryFactoryFactory` and fails to
| explain why it was needed or what it did, concretely
| Tehdasi wrote:
| That's the punchline, nobody knows what it does or why it was
| needed.
| Nuzzerino wrote:
| * * *
| eximius wrote:
| I can understand how `InboundRequestContextFinderProviderFactory`
| comes about, hopefully due to a very mature, thorough testing
| environment where your `InboundRequestContextFinder` is injected
| via a provider and that provider needs to be constructed for
| different environments.
|
| Though it does seem like perhaps the Finder itself is possibly an
| unnecessary abstraction.
|
| Frankly, the longer I work, the more comfortable I am seeing
| these kinds of things. They can be misused, but they are also
| necessary for some really good things too. The absurd names are
| funny, but also somewhat standardized enough to be a signal on
| their own.
___________________________________________________________________
(page generated 2023-07-07 23:00 UTC)