On Thu, Nov 10, 2016 at 10:04 AM, Keisuke Miyako <[email protected]>
wrote:

> subform widgets kind of follow Demeter's law,
> there are supposed to work with as little context information as possible.
>
> if it must "know",
> you need to "tell" that information from the container object.
>

For those that don't know this term, I just ran into it a few days ago in a
couple of good pieces by Martin Fowler:

http://martinfowler.com/articles/mocksArentStubs.html

http://martinfowler.com/bliki/TellDontAsk.html

For those that don't know who Martin Fowler is, well, he's awesome. He's
one of the handful of people in the world that comments on OO analysis,
design, and programming in a way that's easy-to-understand, theoretically
coherent, and pragmatic. He's been at it for decades and is the guy that
made "refactoring" the word it is in programming today. (The book is
excellent, and not long, by the way.)

For those of us not working in an OO language:

* A lot of the underlying concepts of data hiding, grouping data & behavior
aren't exclusively OO. They're just good programming design that OO
absorbed and (in profound ways) simplified. So, the same ideas have merit
in a 4D context.

* Even if you don't follow a pattern like 'tell, don't ask', it's kind of a
great pattern to have in your mind as a concept. Sometimes it's really a
nicer design on a practical level in 4D, sometimes it means writing a ton
of little hook routines and is too much of a pain to justify itself. It
depends.

* Either way, it's always good to isolate program control data and access
it from a small, well-regulated, clearly named set of routines.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to