Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 5th, 2006, 2:37 PM   #1
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
how to create functions across projects?

hey all, long time no see.

i had to pick up VB programming again after i noticed a flaw in my previous masterpiece, went back to edit it and found that i had deleted the source files and everything. time to dust off the books and start over...

anyway, i'm trying to be a more efficient programmer this time around and use functions instead of subroutines to do repetitive work with different parameters.

i am about to write a function that will parse a long filename and shrink it down to the old DOS format. i can handle that much. what i need is some advice with how to properly set up such a function so that in the future if i ever need such a function again in a different program, i can easily pull it up and access it without having to vivisect the program i'm currently working on.

what would i have to do to go about this? from what i can tell modules have some part in this but i am unsure of how to set them up to do what i want to do here. do i make a new module for every specific function i may want to port?

thanks
chepfaust is offline   Reply With Quote
Old May 5th, 2006, 6:24 PM   #2
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Try to isolate it as much as possible. You don't need a new module for each function, rather, I'd recommend grouping all related functions in one module. So, in other words, put everything you're doing here in one module, and it can be called from anywhere else in the project.
niteice is offline   Reply With Quote
Old May 5th, 2006, 7:59 PM   #3
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
Quote:
Originally Posted by niteice
Try to isolate it as much as possible. You don't need a new module for each function, rather, I'd recommend grouping all related functions in one module. So, in other words, put everything you're doing here in one module, and it can be called from anywhere else in the project.
ok, thanks for the advice.

are there any drawbacks in actually going and making individual modules for every function i wish to possibly use elsewhere?
chepfaust is offline   Reply With Quote
Old May 5th, 2006, 9:56 PM   #4
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,193
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by chepfaust
ok, thanks for the advice.

are there any drawbacks in actually going and making individual modules for every function i wish to possibly use elsewhere?
Yeah, it's more work since each module is generally a separate file in many languages (not sure about VB before .NET).

If you're linking your modules statically, then (in theory) it would be most efficient to have every function in a module of its own, so the linker would link in only those functions referenced in your code (linkers include code on a module-by-module basis). In practice, however, many functions go together. For example, if you use a function to close files, it is implicit that you will also be needing a function to open files, and so these two can go in the same module, not to mention functions to handle the file reading and writing. Thus what niteice reommended: separate the functions into groups based on related functionality, and make a module for each group.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old May 8th, 2006, 5:19 PM   #5
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
interesting. thanks.
chepfaust is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:29 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC