I'm in a Shakespeare mood. One of the common mantras of the various "hot" methodologies is that teams use a common coding style. There's a raft of reasons why. And some evidence that it's a good idea.
That said, for an equally large raft of reasons, this ends up being a tough issue for some people and groups. So I threw together the package AsYouLikeIt which you can install from the Open Repository. I do not claim the original idea for this. At least not recently. I did think about it once upon a time for Squeak years ago. I was somewhat resistant to the idea this time, because of a (misplaced) concern about the implications of such a tool.
I think many people have thought of this idea, but I'm not aware of anyone ever doing it. And I'm curious what naivety I've overlooked that causes it to remain "just an idea." It's not hard.
What is this it? AsYouLikeIt is a package which has the following comment:
"This package is a partial response to endless debates over code formatting styles. It would be nice if we could all just agree, but in the case where that's not possible, this may be of some solace.
The basic idea is to basically modify the point where the browser fetches source for a method, and format the method to your liking. Thus the name of the package, and a hat-tip to one of my favorite authors.
Why not the RBConfigurableFormatter? Well, because I wasn't really aware of it. And many others aren't either. And I didn't want to write a settings tool (i.e. one that integrated with the VW settings framework) for that. And because I used it to play around, and wasn't able to do all of the crazy^H^H^H^H^Hdifferent things I hear about people doing with their styles. It just seems easier to let people create their own formats. This puts the onus on you the user to figure out how encodify your own heuristics.
I'd like to see more people add formats to this. Please DO NOT modify a formatter that you didn't add. But when/if you add one, please DO publish a new version. Other people may like your new format. I've added formatters based on how I know some of my peers at Cincom like to see code."
Despite my misgivings about enabling a team to continue to embrace their own little isolated universes, I must say that it only took me about 2 minutes to fall in love with this. The VisualWorks code base actually has quite a few different styles in it. And suddenly with this, they all look the same.
I always use the formatter too. So ctrl-o ctrl-s is a very common sequence for me. Format it. Save it. With this in place though... I just hit ctrl-s, because the effect is the same. I've got some finger muscle memory to untrain there. But I think it's a gain in the end.
One of the drawbacks to this is obviously that any code rendering tool has to be modifed to fetch formatted source instead of raw source. I only did the RB, but will do the others as need dictates.