[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: succinctness = power



   Date: Sun, 26 May 2002 19:53:50 -0400
   From: Sundar Narasimhan <sundar@ascent.com>
   Precedence: bulk

      Perhaps their biggest weakness is that their initial
      proponents did not demand linguistic mechanisms that would help
      programmers integrate patterns into programs.

      On the other hand, Erich Gamma promised me a beer and an explanation
      for why such a linguistic encapsulation would be a bad idea.  I
      haven't had a chance to collect, but I imagine the argument might be
      that it would inhibit further discovery.  However, I think the Lisp
      experience suggests contrariwise.

   Shriram: I'll bite. Could you say more why you believe this?  I've
   always believed that patterns were useful precisely because they were
   NOT wedded to particular language hacks, and consequently more
   powerful in terms of mapping one programmer's mental constructs onto
   another -- especially when it comes to context-sensitive application.

I've been working for a few years on a product written in Java.  We
often use the "singleton" pattern; there are over a dozen of them, at
the very least.  We have an official coding style for our group, which
includes a template for singletons, and we laboriously make sure that
all our singletons are written based on this template.  (I use the
word "template" informally here; it's not a Java concept.  We just
have a sample singleton class, and when you write a new one you're
supposed to imitate it.)  A couple of times we changed the template,
and had to go find al the singletons everywhere and update them all.
THe junior programmers on the project sometimes forget, and during
code review we have to tell them to go look at the coding style
document and fix up their singletons to follow our conventions.

I would really have liked to have some kind of macro so that we could
say, in one place, "this is what singletons look like".