|
-
Apr 5th, 2006, 05:09 PM
#1
Thread Starter
Lively Member
Debugging Tools and Add-Ins For Visual Studio/VB?
I must take over for two progammers that are no longer around. There are about 10+ applications that were developed. Most of the functions have little or no comments and lots of "temporary fixes" and magic numbers. I was wondering how I should approach understanding the applications, any advice? Also are there any tools for Visual Studio that will map out source code or create a visio-style flow chart? That would be extremely useful. I know that certain event-oriented objects cannot be mapped linearly, but it would be nice to see how the program flows from the startup form and once a certain action (button click, timer) occurs. Please lend me your advice, it will be greatly appreciated?
Thanks!
-
Apr 5th, 2006, 07:42 PM
#2
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
For the Visio thing, i would suggest stepping through the code and getting a feel for how it runs through.
Hopefully Variables and the like are named in a way that is memorable?
-
Apr 5th, 2006, 10:36 PM
#3
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
I started a job exactly like that (but replacing one programmer who had 6 months total programming experience when he left) in November. I'm still wading through constructs like
VB Code:
If Not rs.EOF <> Not (True) Then
and SQL statements that are a few hundred characters long and all on one line.
There's only one way to walk through thick mud up to your hips that I know of - painfully.
I guess I'm lucky, though - this, regardless of how he tortured it, is fun stuff to work on, so there's a little compensation for the pain.
-
Apr 6th, 2006, 02:04 AM
#4
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by Al42
I started a job exactly like that (but replacing one programmer who had 6 months total programming experience when he left) in November. I'm still wading through constructs like
VB Code:
If Not rs.EOF <> Not (True) Then
and SQL statements that are a few hundred characters long and all on one line.
There's only one way to walk through thick mud up to your hips that I know of - painfully.
I guess I'm lucky, though - this, regardless of how he tortured it, is fun stuff to work on, so there's a little compensation for the pain.
Isn't that the same as
I feel sorry for you both.
-
Apr 6th, 2006, 07:28 AM
#5
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
It's actually a triple negative, so:Crazy
-
Apr 6th, 2006, 07:34 AM
#6
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by brianafischer
I must take over for two progammers that are no longer around. There are about 10+ applications that were developed. Most of the functions have little or no comments and lots of "temporary fixes" and magic numbers.
Been done that road before, and there really isn't an easy way to wade through it.
 Originally Posted by brianafischer
I was wondering how I should approach understanding the applications, any advice?
One routine at a time. It really gets to be "fun" when you have Subs calling Subs calling Functions and returning to the original Sub only to do it all over again.
 Originally Posted by brianafischer
Also are there any tools for Visual Studio that will map out source code or create a visio-style flow chart?
What language are these programs written in?
How much programming experience do you have?
-
Apr 6th, 2006, 07:39 AM
#7
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
VS2005 has teh ability to view the "class diagram" of the code - might be helpful (assuming the code has a sensible class structure at all)
-
Apr 6th, 2006, 09:20 AM
#8
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by bushmobile
It's actually a triple negative, so: Crazy 
Exactly. EOF is a boolean so there's no need to create a boolean return against True or False - If EOF and If Not EOF work just fine - and they're human readable.
Some days I refuse to write code - I just go through his code, cleaning up the pleonasms, quintuple (yep) negatives, endless SQL statements, putting in parentheses where it makes the code more readable, or where VB doesn't guarantee order of execution (you have to know your compiler), msgboxes returning integers that only get tested once, and are defined only for that one use. Some people shouldn't be allowed near computers.
I'm lucky in that my immediate superior is a tech type, so he understands that a day spent cleaning up my predecessor's code may result in not wasting a week trying to understand some spaghetti.
(Now if I can convince him that an hour spent reading posts here saves a week trying to figure out how to code something, when one of you geniuses posted a way of doing it last year. Two lines to create and populate an Excel spreadsheet? Thanks to whoever posted that one - saved me who knows how much trial and error.)
-
Apr 6th, 2006, 09:23 AM
#9
Thread Starter
Lively Member
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
I have been programming part-time in VB/VBA for about 6 years now. I have been using .NET for about 1 year. I have a lot of experience in data processing, not GUI design though. Unfortunately, none of the code is OOP or class-based. The main processing is in 10-12 functions of spaghetti code with lots of magic numbers and "this doesn't work yet" comments (which don't mention how it should work)...
What methods/techniques would you suggest to get over the hurdle of learning the applications? I am working on taking small pieces of the application, but it seems that it may be faster just to re-write the code. The problem with that approach is that nobody knows what the programs are supposed to do!
Thanks for the advice!
-
Apr 6th, 2006, 09:30 AM
#10
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by brianafischer
The problem with that approach is that nobody knows what the programs are supposed to do!
Isn't anyone at your company using them? Hopefully, they would know what they are supposed to do.
 Originally Posted by brianafischer
I am working on taking small pieces of the application, but it seems that it may be faster just to re-write the code.
Many times this is true, and often to the betterment of the program.
As it stands now, you have responsible for these programs. Do you have requests for updates and/or modifications for any of them, or are you just looking to figure out how they work?
-
Apr 6th, 2006, 10:30 AM
#11
Thread Starter
Lively Member
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
I will be using the applications for future projects and am expected to include all current functionality and to improve upon this. I have two challenges:
1. The existing code is not OOP, so using it as a library upon which to build more functionality is extremely difficult. Changing function X to do Y will break function Z.
2.
Isn't anyone at your company using them? Hopefully, they would know what they are supposed to do.
The applications were used by previous customers or the developers themselves. The previous "group" was pretty much independent. Thus, only a few people here know what they were used for, but none know how they actually did the task or how to use the application.
-
Apr 6th, 2006, 10:48 AM
#12
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by brianafischer
The applications were used by previous customers or the developers themselves. The previous "group" was pretty much independent. Thus, only a few people here know what they were used for, but none know how they actually did the task or how to use the application.
Well, I don't know anything that will tell you what an application does.
 Originally Posted by brianafischer
I will be using the applications for future projects and am expected to include all current functionality and to improve upon this.
Expected by whom?
I'm having a hard time grasping the fact that you have been given a set of programs that no one knows how to use, and are expected to make changes to them. If no one knows how to use them, how are you expected to know?
Even doing rewrites would be functionally impossible if you don't know what the current code does and how it does it.
However, we have some pretty darn good "code detectives" that prowl the cooridors of this site. If you run into a brick wall with a Sub or a Function, post it, post how it is called, and we will see if we can't figure out what it is doing and how it is doing it.
-
Apr 6th, 2006, 11:49 AM
#13
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by brianafischer
I will be using the applications for future projects and am expected to include all current functionality and to improve upon this.
Am I hearing that you have a boss who's a non-technical type, but who wants you to use current code in future applications - probably because he thinks that trashing it all is some kind of "waste of resources"? (Some "resources" have no better use than to be trashed.)
If that's the case, learn to say "yes" while ignoring yourself. If he wants to tell you what code to write he should have hired a typist, not a programmer. Learn as much from the current code as you can (it'll probably be mostly "how could they have hired such a moron?") about what it was supposed to do, so you can "emulate" all the mistakes they're used to. Then slowly introduce them to properly designed software - the stuff you normally write.
I've started getting my people used to the fact that every app I write will have a menu item that says "On Top" or "Not On top", depending on the mode it's in, that the last place on the screen you closed the program will be the place it opens next time and that the size you close it at is the size it opens at. Not everyone wants my Magnum Opus to be on top, but some people do. Some like a little form to be fullscreen, some don't.
My attitude is that these people - the ones I work with - are my paying customers, so I give them my best effort. Even if what they're used to is trash. If the code you have is useful, use it, but if it's going to take you a week to make a simple modification, but 3 days to rewrite it from scratch, rewrite it - that's the best use of your time. And it's less frustrating.
-
Apr 6th, 2006, 12:14 PM
#14
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
These sorta things happend more often than we would want them to... But there is nothing to be frustrated about too - it's part of our job to be able to read someone else code regardless.
Refrasing Hack's "One routine at a time" I would say take one app at the time.
If there is any db connection then make sure you change it to point to test db (if available). Then run it and see what it does, lookup changes in the db itself and so on. Try to get the most of it and make some comments to existing code as you go along. Also, debugging is your friend.
I guaranty that if application is relatively small then you'll learn it in no time.
Good luck.
-
Apr 6th, 2006, 12:16 PM
#15
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
 Originally Posted by RhinoBull
These sorta things happend more often than we would want them to...  But there is nothing to be frustrated about too - it's part of our job to be able to read someone else code regardless.
Refrasing Hack's "One routine at a time" I would say take one app at the time.
If there is any db connection then make sure you change it to point to test db (if available). Then run it and see what it does, lookup changes in the db itself and so on. Try to get the most of it and make some comments to existing code as you go along. Also, debugging is your friend.
I guaranty that if application is relatively small then you'll learn it in no time.
Good luck.
Actually I prefer to start at the routine level and work my way up to the application level, but, difference in approach and style I guess.
Anyway, speaking of debugging, are you familiar with how to set break points and watchs?
-
Apr 6th, 2006, 01:32 PM
#16
Thread Starter
Lively Member
Re: Debugging Tools and Add-Ins For Visual Studio/VB?
Anyway, speaking of debugging, are you familiar with how to set break points and watchs?
Yes, i know the basics of debugging (breakpoints, step-into/over, and watches).
I think the main point of this thread is to find out if there are any tools to make this process easier? Anyone have techniques of writing to the console, or some canned code that will output/log the state of variables every "x" seconds or button_click?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|