Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 comment and code formatting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shawnee6d
New Member

USA
3 Posts

Posted - Dec 06 2007 :  11:52:53 PM  Show Profile  Reply with Quote
So I started a new project about 6 months ago. The bulk of the work has been to evolve a tangle of sloppy code into something maintainable, readable, etc. Probably nothing that most of the folks on this forum haven't had to deal with at one time or another.

VAX is extremely helpfull in producing readable code, which for me roll's in a boatload of commenting, consistent and regular formatting, and a bunch of other nit picky things that really have nothing to do with crafting a solution to a problem. Throughout the bulk of the work, I've so wished there were a tool available that would let me specify basic document properties, maybe a template for what a class should look like, max column length, where member functions belong, member variables, a consistent comment style, then having defined my formatting template or requirements let me apply it to an arbitrary module.

I've written similar solutions for lawyers in and around seatle helping them to go from one template to another, walking a document to make changes given a set of circumstances. It's inevitably an error prone process and I've always been the first to state this up front. However, the reality is it saves a boat load of typing and makes sticky situations usually quiet easy to identify and deal with. Visual studio has a Format Selection option, but truthfully I've never found a way to indicate to it just what Format I want.

I've considered putting together some kind of macro or set of macro's to do most of this kind of work for me, but it would be really cool if VAX had some feature like this. Just a thought.

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - Dec 07 2007 :  03:42:17 AM  Show Profile  Reply with Quote
Templates: Autotext or VA Snippets as they're now called will go a long way to help you there. Unfortunately they can be used on new code only, not applied to existing code*. Maybe VA Snippets' functionality could be extended for them to be applied to existing code?

Otherwise, feline will surely point out VA's policy to let the formatting tools manage the formatting. While I totally agree that something in the line of what you describe would be incredibly helpful, I can also understand that VA rather concentrates on other stuff and makes it work as good and reliable as possible.

Since your task is refactoring, maybe some of the functionality you're asking for could be implemented inside VA as a refactoring operation? Just remember VA is not about formatting, it is about creating and reorganizing structured code.

Operations that would fall into the area of expertise of VA would be:

- reordering class methods either according to the order inside the header file or just alphabetically
- group attributes and/or methods by visibility
- create basic comment lines or blocks on all attributes and/or methods that fulfill certain criteria (e. g. visibility: public)

I am sure, looking at you project, you can think of more examples that do not revolve around reformatting, but refactoring or creating (comments mostly, I assume from your description).


P.S.: * that's not quite correct, Autotext *can* be applied to existing code in the context of refactoring operations.

Edited by - sl@sh on Dec 07 2007 03:45:06 AM
Go to Top of Page

shawnee6d
New Member

USA
3 Posts

Posted - Dec 07 2007 :  05:33:35 AM  Show Profile  Reply with Quote
hey sl@sh,
that's what I kind of figured. From a business perspective, it's kind of pointless to create a tool that simply won't be able to handle the general case (because the variety is limitless). I think VA is awesome at what it does. I wouldn't consider working without it. However, as I find myself plundering into older code bases I run into the same problem over and over again. Most of it is formatting work, not really code so much as formatting of code. For me, even a poor solution is at some point going to be likely necessary, though when I'll have time to craft one is mmm not certain.

VA snippets does allow me to customize what I'm writing and even has some crafty ways to let me grab something existing to make it look pretty, ie. $selected$ but there are finer adjustments I'd like to make. Like take a sloppy bit of comment:

/// commetn text some . more.

and turn it into:

/********************************
comment text some more.
********************************/

or the like. Trying to manually do that for several thousands of lines of code is a pain, however, it turns out to be a huge boost to maintainability. Something neat, clean and well ordered is easy on the eyes, and reflects some effort. It also encourages similar code when it's time to really refactor, or add something new. :) It's arguable as to whether that qualifies as creating or refactoring structured code. I'm preaching, sorry. Anyways, thanks for the reply.


Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18947 Posts

Posted - Dec 07 2007 :  3:33:53 PM  Show Profile  Reply with Quote
Some for of code formatting comes up fairly reguarly, but you are a big step beyond "simple" formatting here. For reference the code formatting FAQ is:

http://docs.wholetomato.com?W147

which links go GC: http://sourceforge.net/projects/gcgreatcode/

which might be of some help to you, once you have it configured.

Code ordering, have you checked out VA Outline yet? One of its features is the ability to drag and drop items, thus re-ordering the file quickly and easily.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000