The Artima Developer Community
Sponsored Link

Agile Buzz Forum
To Format, Or Not To Format.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
To Format, Or Not To Format. Posted: Dec 16, 2006 4:29 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: To Format, Or Not To Format.
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

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.

Read: To Format, Or Not To Format.

Topic: Bad Assumptions Previous Topic   Next Topic Topic: Tipping TDD

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use