← Back to context

Comment by RangerScience

8 years ago

> You missed the "created: 3246 days ago" bit, then? :-)

Tots did. Errr... welcome, travelling from the land of Lurk?

> You're right, it's not a clear distinction...

Still, does the naming sound right? Patterns that get "encoded" into the language, or made trivial by abstraction features within the language, are idioms?

> Have you read the Gang of Four book?

No :/ The closest I've come, weirdly, was tutoring a friend through a design pattern class. Each time she'd come up and say, "The name of this week's pattern is such-and-such", and from that, I'd get 90% of the way to knowing that pattern was. I've always wanted just a simple list of the names, maybe with linked single paragraph descriptions, but every prior time I've looked I haven't been able to find one.

> add methods and fields to an object or class at runtime

Yes! That's a favorite Ruby trick. Straight up tho - what is the formal name of doing that, specifically, the formal name of the category to which attr_accessor and has_many belong to?

> Patterns that get "encoded" into the language, or made trivial by abstraction features within the language, are idioms?

Yeah, that sounds like a reasonable term to use.

> The closest I've come, weirdly, was tutoring a friend through a design pattern class.

It's a bit old now, but I think it's probably still worth reading the GoF book - it's clearly written, and much better than most subsequent imitators. In particular, each pattern comes with a "when not to use this" discussion, that more people should pay attention to :-/

> I've always wanted just a simple list of the names, maybe with linked single paragraph descriptions

Would http://wiki.c2.com/?CategoryPattern do?

> what is the formal name of doing that, specifically, the formal name of the category to which attr_accessor and has_many belong to?

I'm not sure. Adding methods to a class at runtime is called "metaprogramming" (which has the more general meaning of "writing code that writes or modifies code"). I don't know of a name for a method that performs metaprogramming, though.