Hacker News new | past | comments | ask | show | jobs | submit login

Ah, I thought you were talking about _automatic_ DI. Apologies.

> Yep that is a more concise way of doing the same thing

Your interfaces still dictate a method name and signature that must be known by both parties. I would argue that this connection is the concern of the integrating layer. If either party changes, here's where the error should occur:

  const service = new ProjectService()
  const controller = new ProjectController({ 
    getProject: service.get.bind(service) // this is why I don't like js classes
    setProject: service.set.bind(service)
  })
Naturally, this needs some caution. If the boundaries aren't chosen well, the integration layer grows.

I think you're right that our fundamental difference is the desire to stick to a more standardized class-based architecture. I like js-classes to communicate that something is stateful. But conceptually, they're more hindering than helpful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: