← Back to context

Comment by vjerancrnjak

2 days ago

I like how classes escape closures but then dependency injection frameworks have to work around that because now it is hard to think of construction as passing arguments to functions in the correct order.

I am so glad LLMs eliminate all of that and just call functions in the right order.

> I am so glad LLMs eliminate all of that

When LLMs do something, it's always because everybody was already doing it.

The noise you see online about it exists exactly because most people don't understand and can't use DI.

  • No, LLMs like NextJS style injection as much as anyone.

    There is nothing magical about topological sort and calling constructors in the right order, which is all DI is.

    I dislike it a lot, it is exactly like any other construct that allows you to throw code at anything in a way that sucks (Haskell lens, optics, monad transformers).

    It allows people to granularize the whole codebase to the point where you can’t do much about it. For most, they should just stick with functions, no one can build 100 levels deep function callstacks without it being cumbersome, but DI makes it a breeze.

    • I fell out of love with Java not because of the language, but because it got tied up with DI. Don't get me wrong, the allure of DI is really neat. Make all sort of interfaces and just call the function and it can be implemented by dozens of things. Perfect for a lot of use-cases. But then reality hits, and you eventually realize how complex the entire codebase is because it's pattern 1, pattern 2, p3, p4, etc... People are so obsessed with GoF patterns that they're not getting anything done other than spending the first month on a beautiful API.

      Then I got into Python and people were building useful server APIs in a day.

      Both have their place, but I think the problem with the first route is that EVERYTHING ends up with Spring or CDI and complexity overload even if only 1 thing will ever be "implemented".

    • > There is nothing magical about topological sort and calling constructors in the right order, which is all DI is.

      Lol... That's exactly the kind of thing we call "magic" in software development.

      Anyway, if your framework is entirely based on DI, everybody that uses the framework will use DI, and the LLMs will generate code for it that uses DI. That does not contest my point in any way.