{"action":"created","issue":{"url":"https://api.github.com/repos/rom-rb/rom/issues/142","labels_url":"https://api.github.com/repos/rom-rb/rom/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/rom-rb/rom/issues/142/comments","events_url":"https://api.github.com/repos/rom-rb/rom/issues/142/events","html_url":"https://github.com/rom-rb/rom/issues/142","id":56291156,"number":142,"title":"Remove descendants tracking","user":{"login":"aflatter","id":168,"avatar_url":"https://avatars.githubusercontent.com/u/168?v=3","gravatar_id":"","url":"https://api.github.com/users/aflatter","html_url":"https://github.com/aflatter","followers_url":"https://api.github.com/users/aflatter/followers","following_url":"https://api.github.com/users/aflatter/following{/other_user}","gists_url":"https://api.github.com/users/aflatter/gists{/gist_id}","starred_url":"https://api.github.com/users/aflatter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aflatter/subscriptions","organizations_url":"https://api.github.com/users/aflatter/orgs","repos_url":"https://api.github.com/users/aflatter/repos","events_url":"https://api.github.com/users/aflatter/events{/privacy}","received_events_url":"https://api.github.com/users/aflatter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rom-rb/rom/labels/core","name":"core","color":"395a9e"},{"url":"https://api.github.com/repos/rom-rb/rom/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"aflatter","id":168,"avatar_url":"https://avatars.githubusercontent.com/u/168?v=3","gravatar_id":"","url":"https://api.github.com/users/aflatter","html_url":"https://github.com/aflatter","followers_url":"https://api.github.com/users/aflatter/followers","following_url":"https://api.github.com/users/aflatter/following{/other_user}","gists_url":"https://api.github.com/users/aflatter/gists{/gist_id}","starred_url":"https://api.github.com/users/aflatter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aflatter/subscriptions","organizations_url":"https://api.github.com/users/aflatter/orgs","repos_url":"https://api.github.com/users/aflatter/repos","events_url":"https://api.github.com/users/aflatter/events{/privacy}","received_events_url":"https://api.github.com/users/aflatter/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-02-02T20:50:27Z","updated_at":"2015-03-05T15:34:52Z","closed_at":null,"body":"Opening an issue here to discuss the effects of descendants tracking and the removal thereof. Gerenally, I'd say that descendants tracking is undesirable because it's a class-level interface and hidden from the user. Currently it's used to populate the registries of relations, mappers and commands automagically.\r\n\r\nHere's a couple of points to discuss:\r\n\r\n* Is it currently possible to require ROM objects before calling `ROM.setup`?\r\n* Will issues arise when using multiple environments?\r\n* What's the consequences for the way readers are currently working? AFAIK, a chain of calls to the Reader simply builds a path of said calls, e.g. `users.with_posts.active`, that is then used to retrieve the appropriate mapper.\r\n\r\nThe alternative to using descendants tracking is to make registry explicit. Note that this won't bother users of `rom-rails` or similar integration gems as they would ship with support and conventions for location and name of those classes.\r\n\r\n```ruby\r\nrequire 'my_app/relations/users'\r\nsetup = ROM.setup(...)\r\nsetup.register_relation(:users, MyApp::Relations::Users)\r\n```\r\n\r\nThe advantages are the removal of a fragile technique, independence of load order and setup time, less hassle in the test suite and simplification of ROM core.\r\n\r\n/cc @elskwid @solnic @splattael: We already talked quite a bit about this. :)\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8231216-remove-descendants-tracking?utm_campaign=plugin&utm_content=tracker%2F155789&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F155789&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/rom-rb/rom/issues/comments/77385122","html_url":"https://github.com/rom-rb/rom/issues/142#issuecomment-77385122","issue_url":"https://api.github.com/repos/rom-rb/rom/issues/142","id":77385122,"user":{"login":"schmurfy","id":2983,"avatar_url":"https://avatars.githubusercontent.com/u/2983?v=3","gravatar_id":"","url":"https://api.github.com/users/schmurfy","html_url":"https://github.com/schmurfy","followers_url":"https://api.github.com/users/schmurfy/followers","following_url":"https://api.github.com/users/schmurfy/following{/other_user}","gists_url":"https://api.github.com/users/schmurfy/gists{/gist_id}","starred_url":"https://api.github.com/users/schmurfy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmurfy/subscriptions","organizations_url":"https://api.github.com/users/schmurfy/orgs","repos_url":"https://api.github.com/users/schmurfy/repos","events_url":"https://api.github.com/users/schmurfy/events{/privacy}","received_events_url":"https://api.github.com/users/schmurfy/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T15:34:52Z","updated_at":"2015-03-05T15:34:52Z","body":"Thanks for the explanations, that was just my first impression after coming back to the project after leaving it aside for some time (last time there only the DSL language, not the classes), I need to play more with it I think to see how things play.\r\n\r\nI did not thought about inheritance, does this means you could have a base mapper with specialized ones inheriting from it ?\r\nAnd since the name of the class means nothing, does it means the following will work the same for the mapper  ? or does the name still plays a role ?\r\n\r\n```ruby\r\nclass PolarBearMapper < ROM::Mapper\r\n  relation :users\r\n  register_as :entity\r\n\r\n  model User\r\n\r\n  attribute :name\r\n  attribute :age\r\nend\r\n```"}}