News for hackers. Stuff that matters.
Re:Indirection Is Not Abstraction by kovrik on Thursday November 01, 2018 @09:08PM (#18359939)
Can't see where this 'magic' comes from. IoC frameworks are not rocket science. Everything is very-well documented and pretty straightforward.

> dependency injection frameworks are an unnecessary and overcomplicated way of achieving it.

But why? I don't want to write my own DI framework for each new project.

I'd better add one dependency, put some @Autowired (and other well-documented) annotations and continue writing business logic.

Aforementioned 'magic' is basically creating a context, scanning all annotations, registering beans, instantiating them (calling constructors), then injecting them.

Re:Indirection Is Not Abstraction by smolder on Friday November 02, 2018 @09:14AM (#18362754)
As someone who recently worked on a spring project for the first time, it's pretty clear what magic we're talking about. I can't look at the code and know what the application does without first learning the meaning of a ton of different annotations and the behaviors connected with them. Annotations and the associated code are complex. Now that I understand what they all do, it's easy to reason about the app, but when I run it my mental model is still:

1. I launch the app

2. Spring does a bunch of stuff I only vaguely understand and can't understand from looking at the code

3. My actual code starts running

On top of that, all the spring stuff makes the memory footprint and startup time awful.

Re:Indirection Is Not Abstraction by drdeca on Friday November 02, 2018 @12:25AM (#18360691)
I wouldn't mind having things be created through autowiring and the like, if it didn't make it harder to make the things explicitly, without autowiring.

Ideally, making something automated should not make it harder to do the same thing manually.

Re:Indirection Is Not Abstraction by lmm on Friday November 02, 2018 @12:33AM (#18360720)
Modern Java does fix that much. If you look at the `Sample` class from the example, it's a normal class that you can instantiate the normal way (passing its dependencies into its constructor) and ignore the annotations on, unlike the bad old days of afterPropertiesSet().