News for hackers. Stuff that matters.
Re:Your DI framework is killing your code by hcarvalhoalves on Tuesday September 29, 2015 @09:33AM (#10296112)
Spot on. You replace your "anemic way" with first-class functions and namespacing, it ends up being the same thing.

With currying, you do away with OO and parameter initialization altogether.

    @curry
    def SMTPSender(host, message):
       ...

    emailSender = SMTPSender(host='localhost')
    # partially evaluated fn with `host` fixed
    emailSender(message=message)
Re:Your DI framework is killing your code by buffoon on Tuesday September 29, 2015 @10:30AM (#10296517)
This is pretty much how we deal with this in a DI framework anyway. The constructor of the transport takes the host and the send method takes the message.

   emailSender = SMTPSender(host='localhost') # in container
   emailSender.send(message)                  # in implementation
The consumer of the SMTPSender only interacts with the send() method.