Hi Reed,
with growing code bases of untyped languages like Ruby is, this kind of
stuff tends to happen. I discovered it myself a few times.
I would step away from such frameworks for two reasons:
1) You introduce an external dependency (an actual framework) to your
sacred inner code base
2) It kind of runs against the philosophy of untyped languages,
independent of your agreement with it :)
What I tried (and I found it to be OK) is the expression of intent by
calling explicit methods on the received instances. That gives you at
least a hint about the expected interface.
In addition to this we used a lot of Bound
(
https://github.com/neopoly/bound) for DTO and Request objects in the
last projects at my former employer. I felt this was a great success.
But it does not help with the problem of missing types when you pass for
example service or entity instances as injected dependencies.
Martin Fowler suggested a simple Haskell like type annotation in a
comment. Here is a simple example:
```
class StoreRequest; ... end
class UID; ... end
class Repository
# :: StoreRequest -> UID
def store(request)
end
end
```
I do like this approach as a very slick form of documentation, though I
never tried it on a code base myself.
Cheers
Jakob
--
Jakob Holderbaum, M.Sc.
Embedded Software Engineer
0176 637 297 71
http://jakob.io/
http://jakob.io/mentoring/
h...@jakob.io
@hldrbm