views:

56

answers:

4

I want to code in our VB.net to be a little easier to follow both to improve readability and also make it a lot easier to know the best place to put a new bit of code/feature.

Essentially, I'd like to have a 10,000 foot "outline" of the code" with hyperlinks from the outline to the code.

It needs to be portable, so BookMarks won't do the trick (I think). I'm thinking maybe TODO comments. I'd like to create our own Todo style comment like "Outline" or something but that keyword would need to be in the config file for VS as well (but then it's just one thing to keep sync'd).

So something like:

TODO: 1 : App Starts

TODO: 2 : Read INI settings

TODO: 3: Show Splash screen

TODO: 4: Start Lesson (this is educational software)

TOOO: 5: Start Exercise

TODO: 6: Next Exercise

TODO: 7: End Lesson

TODO: 8: AppExit

Any other ideas?

A: 

Have you checked out the Rock Scroll plugin for Visual Studio. It has several of the features that you are looking for.

JaredPar
The logical, operational "flow" or sequence of the program is going to be different than the linear list of code, so this doesn't give me what I need. But thanks, it looks like a cool tool!
Clay Nichols
A: 

It seems like you could get quite far with a Whitehorse diagram (VS 2005 class diagram tool) with good annotations on it. I might even go so far as to suggest a sort-order-influencing name. If it's the only class diagram, a good VS dev will feel the pull to see what it has to tell them about the code model.

If the code doesn't lend itself to the object model with simple, good annotations describing flow... perhaps it needs to be refactored so that it DOES lend itself to that simple view?

Tetsujin no Oni
That won't work with our code because:1. a lot of it isn't in classes2. The flow order doesn't correspond to any order of the classes (alphabetical, etc.). E.g., you might have Registration.Validate, followed by SplashScreen.Start followed by Lesson.Begin, etc.3. There's no way to "highlight" the sections of the classes that are most important. I.e. if you only want to see the 10 most relevent sections of the code, there's no way to do that.
Clay Nichols
Definitely sounds like a target for refactoring. Creating classes that make the interaction clearer is definitely where I would attack this problem. Absent a look at the codebase you're trying to outline, I think that the description of the problems with using a class diagram as documentation of the interactions (perhaps of interfaces declared to provide only the interaction parts you want to outline...) highlight opportunities to improve the design.
Tetsujin no Oni
A: 

This may be obvious, sorry if I missed the essesence of what you are asking for, but would something like:

region "application start"

. .

regoin end

help at all?

MostlyLucid
If we created a bunch of regions like that ("Start", "Next Exercise", "End Lesson", etc.) is there one window where we'd see a list of only the regions that had been identified?
Clay Nichols
Sorry, been under a serious crunch on a project (need in production monday AM) -- I did not find a way to do that from within VS - however, this tool seems to show some promise:http://www.syntaxia.com/Syntaxia/HomePage.php--I will look around over the weekend - it is a interesting problem -
MostlyLucid
Maybe if you made the text bigger.
Nick Whaley
In case you missed this one:http://www.devexpress.com/Products/Visual_Studio_Add-in/index.xml
MostlyLucid
A: 

I was working in some old VB6 Code and thought of this method:

Create a Sub CodeOutline ( Order as Double, Description as string)

Then call it at various places in the code:

CodeOutline 1, "App Starts" CodeOutline 2, "Load Settings" CodeOutline 3, "Start Lession" (this is educational software to it has "lessons and exercises" CodeOutline 4, "Next Exercise" CodeOutline 5, "Lesson Finished"

Now you can do a couple of things:

  1. In the above Sub you can put a debug statement. (We have a "debug mode" we can put the app in where any debug message will be reported as a msgbox).

CodeOutline (Order as double, descr as string) SysMsg cstr(Order) & " -" & Descr, Msg_Debug end

  1. You can also put a breakpoint in the CodeOutline

  2. You can search on CodeOutline and get a list (often sorted by the Order paramater if you're using the MzTools's vb6 addin search function (far superior to the built in vb6). And the search results are hyperlinked.

EXAMPLE OF THE SEARCH RESULTS

Tutor
   Modules
      COMMON (COMMON.BAS)
         Sub Main()
            CodeOutline 1, "Startup"
            CodeOutline 6, "Checking Registration status"
            CodeOutline 4, "Loading Splash Screen"
         Public Sub CodeOutline(Order As Double, sDescription As String)
            Public Sub CodeOutline(Order As Double, sDescription As String)
            '   do a Search on CodeOutline  to see all the code outlines
            On Error GoTo CodeOutline_Error
            CodeOutline_Error:
            sysMsg "Error " & Err.Number & " (" & Err.Description & ") in procedure CodeOutline of Module COMMON" & ",," & Err.Description, MSG_LOG
      IO (IO.BAS)
         Sub APP_INITIALIZE()
            CodeOutline 2, "Initializine App"
            CodeOutline 3, "Exiting from App_initialize"
   Forms
      frmSplash (SPLASH.FRM)
         Private Sub Command2_Click(index As Integer)
            CodeOutline 4.1, "User Clicked button # " & index & " on Splash screen"
         Private Sub Form_Load()
            CodeOutline 5, "Exiting from frmSplash.Load"
         Private Sub tmrUnload_Timer()
            CodeOutline 6, "Preparing to unload the Splash Form, tmrUnload"
Clay Nichols