Hey Laszlo, Dependency injection is a very powerful and useful tool/design pattern.
I don't think there is a particular reason for which Hive does not use DI framework apart maybe from the fact that we have lots of legacy code that existed before DI became that popular. I am open to ideas and suggestions about parts of the code that we could improve via DI. I would probably avoid big refactorings to core components of Hive for the sake of introducing a DI framework but I see no big issue using such frameworks in new code. As usual when we are about to introduce a new dependency to the project we should be mindful of all the implications that this might have. It's hard to make a generally applicable claim that we should use this or that framework since I guess it has to do a lot with personal preferences; we tend to prefer things that we have already used. I haven't used DI frameworks that much so don't have a strong opinion on which framework is the best so I am willing to follow the majority. Best, Stamatis On Tue, Apr 4, 2023 at 1:19 PM Laszlo Vegh <lv...@cloudera.com.invalid> wrote: > > > Hi all, > > I would like to start a conversation about introducing some Dependency > Injection framework (like Spring, Guice, Weld, etc.) in Hive. > > IMHO the lack of such framework makes the codebase way less organised, and > harder to maintain. Moreover, I think it also lead to introducing a huge > amount of static/utility methods and classes (which is highly discouraged > when using DI frameworks). When there is no DI framework, utility classes > with static methods often seem to be the simplest and best way to share code > across different Hive components/classes, but these constructs are really > killing testability. For example it is much harder to mock static method > calls, than mocking service/component instances. Poor testability is a major > issue on its own, but having a DI framework could have much more benefit, > like greater flexibility (modularity), better organised services, etc. > > > I’m interested if there’s any reason why there is no DI in Hive so far. I > know there’s no way to introduce it everywhere in a single step, but we could > start using it where it is easy to start, and continuously expand its usage > from class to class. If there is no strong reason why no to do it, I would > like to start an open conversation around this topic. (Possible benefits, > drawbacks, which framework to use, where to introduce it first, etc.) > > If anybody is interested in this initiative, please join the conversation, > and add your thoughts, ideas, doubts, anything. > > Thanks, > > Laszlo Vegh > veghlac...@gmail.com <mailto:veghlac...@gmail.com>