Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.
This repository was archived by the owner on Apr 18, 2018. It is now read-only.

Not really an issue - but a design pondering #30

@jondot

Description

@jondot

Having trying forcing DDD onto Rails in the past, I'm wondering if you guys too bumped into the following impedance mismatch (from the code looks like you did).

The idea is, that instead of doing a static SomeRepo.save and statically swapping a data provider you should do a some_repo.save where some_repo is an instance of a repository instantiated and injected per X, where X might be:

  • session (request start, instantiate, throw away at request end. best practice)
  • request (everytime you want to do something to a domain object)
  • application lifetime (singleton, dangerous)

This enables the contract for the controller to just requires an instance that quacks like a repository, and the dependency isn't hard-coded as a static dependency. Makes easier testing, puppies happy etc.

These almost always requires incorporating IoC, which by popular opinion "isn't needed in a dynamic language such as Ruby".

This pokes any thought?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions