PackageDescription: AsYouLikeIt


As You Like It

Last published: December 17, 2006 by 'tgriggs'

Defines 4 Classes
Extends 7 Classes


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.

You may not see a choice that you like there for formatting code the way you like it. That's fine, add your own. You do this by creating a subclass of RBFormatter and modifying as you wish and placing it in the CustomFormatters namespace. The RBFormatter is just a visitor pattern. Knock yourself out with all kinds of heuristics and special formatting tricks.

If you do add one, please publish the package back to the repository so that others may benefit from your efforts. There may be someone out there that likes code just the way you do. And they may not even know it until they get a chance to try yours out.

Please, DO NOT modify a Formatter that you did not author. If you like someone else's but just want to tweak it, clone the class (did you know there's a tool in the Open Repository that adds this as an option to the browser?) to your own and make the change (or subclass it). 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.

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.