Code Crowd Control 
Author Message
 Code Crowd Control

So how does it work?

(1) stand along vb6 app with lots of forms, classes and modules
some forms, modules and classes have been brought in from a common source
library.
There are many public routines that are not being used.
Do they get ignored by the coimpiler?  i.e. no binary generated?

(2) ActiveX EXE.
ditto above?
Especially concerned here since many multiples of the same ActiveX EXE will
be running at the same time.

If the baggage is included, what is the best/easiest way to not have those
subs included?



Fri, 06 Apr 2012 00:16:01 GMT  
 Code Crowd Control


Quote:
> So how does it work?

> (1) stand along vb6 app with lots of forms, classes and modules
> some forms, modules and classes have been brought in from a common source
> library.
> There are many public routines that are not being used.
> Do they get ignored by the coimpiler?  i.e. no binary generated?

> (2) ActiveX EXE.
> ditto above?
> Especially concerned here since many multiples of the same ActiveX EXE
will
> be running at the same time.

> If the baggage is included, what is the best/easiest way to not have those
> subs included?

Depends on what you mean by "public routines".

Function/Subs declared Public or Private in .bas modules that aren't called
from anywhere are often excluded by the linker when compiled to native code
with full optimization.
Functions/Subs in .bas modules that are empty - no code, are also often
removed from the compiled executable.

Functions/Subs declared Public in Forms, Classes, UserControls, ... are
included whether empty or not, or whether called or not, as they are used to
define the "Public" or default interface for those objects. Unused 'Private'
Functions/Subs are often removed.

[Note the use of the modifier "often". While dead routines are usually
removed there are conditions with aliasing, parameter, and internal variable
types that will cause the linker to leave them. But these are obscure and
can generally be ignored.]

However, consider that while having this dead code causes the file/image
size to be bigger, and can lead to extra over-head and memory in the form of
additional paging and larger 'v-tables' per object - overall there is little
impact on the actual running of the program.

But a good programming practice is to remove as much dead code as possible.
This is essentially a manual task.  A tool like MZ-Tools can help to
identify dead code.
(http://www.mztools.com/v3/download.aspx)

In those case where you are not sure if code or routine is used or not you
can bracket the routine with compiler conditionals and compile and test. Go
back later and delete when you confirm the code is not needed.
   #If 0 Then
        Public Sub SomeRountine()
            ....
        End Sub
    #End If

Be aware that removing Public methods or members from Classes and Forms
*may* impact binary compatibility. It all depends on what your are doing.

-ralph



Fri, 06 Apr 2012 02:02:06 GMT  
 Code Crowd Control
So ... Then I might consider the following.
For example
To minimize maintance, have one code module with all the code.
Use
#If Proj1 or Proj2 Then
   code for project 1 and 2
#End If
and leave all code that applies to all out of the #If #End If areas.
etc.
Still a little messy.
Quote:

> So how does it work?

> (1) stand along vb6 app with lots of forms, classes and modules
> some forms, modules and classes have been brought in from a common source
> library.
> There are many public routines that are not being used.
> Do they get ignored by the coimpiler?  i.e. no binary generated?

> (2) ActiveX EXE.
> ditto above?
> Especially concerned here since many multiples of the same ActiveX EXE will
> be running at the same time.

> If the baggage is included, what is the best/easiest way to not have those
> subs included?



Fri, 06 Apr 2012 05:06:19 GMT  
 Code Crowd Control


Quote:
> So ... Then I might consider the following.
> For example
> To minimize maintance, have one code module with all the code.
> Use
> #If Proj1 or Proj2 Then
>    code for project 1 and 2
> #End If
> and leave all code that applies to all out of the #If #End If areas.
> etc.
> Still a little messy.

Managing "shared" code has always been messy with VB. The platform was never
designed for it, as each project assumes it has total and single ownership
of all source modules it uses.

I've seen it managed in multiple ways, but in the long run the easiest most
common solution starts with chopping down any *large* module into multiple
modules, each module containing just one or a few routines. Include the
multiple modules within a single VSS/VB project for control.

-ralph



Fri, 06 Apr 2012 07:43:17 GMT  
 Code Crowd Control

- Make a backup first. Open the VBP file in Notepad to see the paths to the
files in the project.
- Using MZTools, you can assign a shortcut to "Procedure callers".
- Go to the module in question, and press Ctrl+Down arrow, then the shortcut
for Procedure callers.
- Repeat the above step and remove unwanted procedures until you are done.



Fri, 06 Apr 2012 09:21:02 GMT  
 Code Crowd Control
MZTools is annoying.
How do I turn off the MZTools window snap???
Working on a laptop and the small screen makes life more difficult when I
try to move a MZTools window and it snaps.
Quote:

> So ... Then I might consider the following.
> For example
> To minimize maintance, have one code module with all the code.
> Use
> #If Proj1 or Proj2 Then
>    code for project 1 and 2
> #End If
> and leave all code that applies to all out of the #If #End If areas.
> etc.
> Still a little messy.


> > So how does it work?

> > (1) stand along vb6 app with lots of forms, classes and modules
> > some forms, modules and classes have been brought in from a common source
> > library.
> > There are many public routines that are not being used.
> > Do they get ignored by the coimpiler?  i.e. no binary generated?

> > (2) ActiveX EXE.
> > ditto above?
> > Especially concerned here since many multiples of the same ActiveX EXE will
> > be running at the same time.

> > If the baggage is included, what is the best/easiest way to not have those
> > subs included?



Fri, 06 Apr 2012 10:02:01 GMT  
 Code Crowd Control


Quote:
> MZTools is annoying.
> How do I turn off the MZTools window snap???
> Working on a laptop and the small screen makes life more difficult when I
> try to move a MZTools window and it snaps.

View-->Toolbars. This turns off the entire thing. But you could go to
MZTools options, and in Toolbar tab, disable all the buttons that you don't
use so it doesn't take much screen space.


Fri, 06 Apr 2012 10:07:40 GMT  
 Code Crowd Control

Quote:
> But a good programming practice is to remove as much dead code as possible.
> This is essentially a manual task.  A tool like MZ-Tools can help to
> identify dead code.
> (http://www.mztools.com/v3/download.aspx)

I see that MZ-Tools finds non used variables, but it doesn't identify
non used procedures (may be there is a configuration to enable this?).

I found "Aivosto Project Analyzer":
http://www.aivosto.com/project/project.html

that also finds dead procedures, but this tool is not free. In the demo
version you can only work with 10 modules (forms, classes, etc).



Fri, 06 Apr 2012 18:22:27 GMT  
 Code Crowd Control

Quote:

>> But a good programming practice is to remove as much dead code as
>> possible.
>> This is essentially a manual task. A tool like MZ-Tools can help to
>> identify dead code.
>> (http://www.mztools.com/v3/download.aspx)

> I see that MZ-Tools finds non used variables, but it doesn't identify
> non used procedures (may be there is a configuration to enable this?).

It won't find them if they are public, as there are ways they can be
called that MZTools can't easily detect

--

i-Catcher Development Team

iCode Systems



Fri, 06 Apr 2012 19:17:14 GMT  
 Code Crowd Control

Quote:
>> I see that MZ-Tools finds non used variables, but it doesn't identify
>> non used procedures (may be there is a configuration to enable this?).

> It won't find them if they are public, as there are ways they can be
> called

Even in a standard exe?

 > that MZTools can't easily detect



Fri, 06 Apr 2012 19:36:51 GMT  
 Code Crowd Control

Quote:

>>> I see that MZ-Tools finds non used variables, but it doesn't identify
>>> non used procedures (may be there is a configuration to enable this?).

>> It won't find them if they are public, as there are ways they can be
>> called

> Even in a standard exe?

>  > that MZTools can't easily detect

Yes. for classes, untyped (ObjecT) references and callbyname, for
modules, AddressOf. Neither of which apply to private procedures.

--

i-Catcher Development Team

iCode Systems



Fri, 06 Apr 2012 20:03:52 GMT  
 Code Crowd Control
for the record.
i found that holding the ctrl key while dragging an MSTools window keeps it
from attaching to anything it passes.
that's better!

also, the MS communities / newsgroups at least for VB is dead.

Quote:

> MZTools is annoying.
> How do I turn off the MZTools window snap???
> Working on a laptop and the small screen makes life more difficult when I
> try to move a MZTools window and it snaps.


> > So ... Then I might consider the following.
> > For example
> > To minimize maintance, have one code module with all the code.
> > Use
> > #If Proj1 or Proj2 Then
> >    code for project 1 and 2
> > #End If
> > and leave all code that applies to all out of the #If #End If areas.
> > etc.
> > Still a little messy.


> > > So how does it work?

> > > (1) stand along vb6 app with lots of forms, classes and modules
> > > some forms, modules and classes have been brought in from a common source
> > > library.
> > > There are many public routines that are not being used.
> > > Do they get ignored by the coimpiler?  i.e. no binary generated?

> > > (2) ActiveX EXE.
> > > ditto above?
> > > Especially concerned here since many multiples of the same ActiveX EXE will
> > > be running at the same time.

> > > If the baggage is included, what is the best/easiest way to not have those
> > > subs included?



Sat, 07 Apr 2012 04:51:01 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. RTP crowd dunks Delphi experts!!!

2. Create custom control in form using code (code wizard adding ocx to form)

3. Sending Printer Control Codes (Escape Codes)

4. Coded Events lost link to Control when copying to a Tab Control

5. applying code to all controls within a control

6. Controlling TSP200 with Print control codes

7. VB source code control and version control with PVCS

8. VB for Dummies Crowd*Newbies:let's meet.

9. get label control NAME back in code...

10. Checking controls through module code in Access 97

11. Adding Control Source Values for a Textbox in Code

12. Control name of subform from code behind subform

 

 
Powered by phpBB® Forum Software