Re: "Circular require considered harmful"
Leam Hall <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
On 9/21/18 6:04 AM, Andy Jones wrote:
> >
> This is pretty common mistake (I think) and is a signal that your code is too
> coupled.
> <
>
> This. In my case the thing that got me thinking clearly about dependency and coupling was POODR ("Practical Object Oriented Design in Ruby", by Sandi Metz).
>
> Short version: class B shouldn't really care whether that object passed as a method parameter is a class A object or not. It should only care that whatever the object is, it can behave in the right way...
Agreed. The issue came from moving everything into a module before I
really understood the full level of modularity needed. I've read POODR a
couple times but didn't "get" it; now that I have a need perhaps another
re-read is in order.
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>