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

Re: LFM + LFSP = LFE?



Robert Feldt <feldt@ce.chalmers.se> writes:

> Are there any real-world examples on when the latter (lisp-way) of
> extending the syntax has also benefitted long-term maintainability (or
> examples where it has been harmful)?

Eaton Vance, the investment management company where I work, has an
application called the Monitored Stock List.  It's about 20,000 lines
of BRL/Scheme code plus about 2,000 lines of stored procedures in
Transact-SQL.

An idiom that kept coming up in the MSL code went something like this:

[(if (> growth 1)
     (brl ]Congratulations!  The stock you picked has grown a lot!
           You've made millions for the company.  Remind us to give
           you a T-shirt.
[) "")]

Especially with longer stretches of code, or nested inside a loop, the
extra punctuation seemed like something that should be eliminated.

[(brl-when (> growth 1) ]
  Congratulations!  The stock you picked has grown a lot!
  You've made millions for the company.  Remind us to give you a
  T-shirt.
[)]

A function wouldn't work here because of eager evaluation; it had to
be a macro.

This was a trivial macro; the denizens of comp.lang.scheme wouldn't
have batted an eye at it.  Nonetheless, it enabled better
readability...not that I've actually gone through and changed the
above idiom everywhere, but newer code uses it, and I like it a lot
better.  Interestingly, it has the side effect that every single use I
make of the sql-repeat macro ends up closing with exactly three parens.

The problem with real-world examples is that there's usually no
attempt to scientifically measure maintainability improvements.
Instead, I'll just give you an anecdote that's only a few days old:

On Friday I was heading to the airport.  I got a call from work that
some changes needed to be made due to a key database moving from one
host to another.  I told them where to find the files and stored
procedures, then caught my plane.  When I called back later, it was
all taken care of.  In fact, Dino (a coworker who has done MSL
enhancements in the past), added some global defines and changed pages
to use them so that it would be less work the next time such a move
happened.

Dino works mainly with MSFT products, but I introduced him to Scheme
and BRL last summer so he could make some MSL enhancements while I was
working on something else.  I couldn't give him work fast enough; he
kept finishing things quickly.  I think this belies the idea that you
need to hire a specialist in a particular language.

-- 
<brlewis@[(if (brl-related? message)    ; Bruce R. Lewis
              "users.sourceforge.net"   ; http://brl.codesimply.net/
              "alum.mit.edu")]>