This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.
Message originally sent by slack user U712MPD2QOT
If there is a method in the public API of a pack that returns a value object, should the value object also be public in that pack? I could see the argument for it that changing the value object internals affects everything that depends on that pack.
If you expect the client code to directly use methods of the value object, then that value object feels like a part of the public API.
As a potential alternative, you can think of a way to limit the ability to call value object methods. You could create an intermediate public layer, that exposes a subset of the value object methods. It increases complexity, but hides internal details of the implementation. However, with the value object, I suspect that would be a bit of an overkill
I hope that’s helpful - I’m really interested in hearing other people’s opinions!