Programming Forums
User Name Password Register
 

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

View Poll Results: How many source files do you use in your projects?
Tons! 5 26.32%
A "medium" amount. 5 26.32%
A few. 3 15.79%
One or two. 6 31.58%
Voters: 19. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old May 25th, 2006, 7:53 PM   #1
Varrickmana
Newbie
 
Varrickmana's Avatar
 
Join Date: May 2006
Posts: 21
Rep Power: 0 Varrickmana is on a distinguished road
Multiple Source Files in a Project

I was wondering how many people use multiple sorce files in their programs, or if most people just stick with one...
__________________
Kids, every year, more than 400,000 people die from tobacco chewing, smoking, an-
MY GOD, HERE COMES A ZOMBIE PIRATE NINJA!!!!!!
Varrickmana is offline   Reply With Quote
Old May 25th, 2006, 8:07 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
If you have a project of any size at all, you'll have many source files. This isn't a question you would even think about asking in a real-world situation, particularly when larger projects are written by teams. Ever hear of CVS?

Even on a small, personal project you should have a source file for each functionally different area, break one up to prevent it from being too long (quicker compilation), or perhaps, as some like, to have one file per function.

Can you imagine recompiling thousands of lines of code when you change one line? Nahhhhhhhhh.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 25th, 2006, 8:08 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Depends on how big the program is. If there's too much to handle in one source file, split it up.

EDIT: DaWei beat me to it. Meh.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 25th, 2006, 8:19 PM   #4
Varrickmana
Newbie
 
Varrickmana's Avatar
 
Join Date: May 2006
Posts: 21
Rep Power: 0 Varrickmana is on a distinguished road
DaWei, why do you build me up, just to tear me down, baby? lol
__________________
Kids, every year, more than 400,000 people die from tobacco chewing, smoking, an-
MY GOD, HERE COMES A ZOMBIE PIRATE NINJA!!!!!!
Varrickmana is offline   Reply With Quote
Old May 25th, 2006, 8:45 PM   #5
msk420
Programmer
 
msk420's Avatar
 
Join Date: May 2006
Posts: 85
Rep Power: 3 msk420 is on a distinguished road
Your sounding a little gay "baby"... Get a life and stop hitting on DaWei
__________________
Code Forums
msk420 is offline   Reply With Quote
Old May 25th, 2006, 8:55 PM   #6
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Try not to call people gay on these forums. No matter what the argument is about, the person calling the other "gay", usually makes themselves look stupid. Everyone knows anyone calling someone gay really is gay themselves (that's a joke).

Ontopic: The most source files I've used in one program was 6. If you consider header files "source", then the most I've used was 12.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old May 25th, 2006, 8:56 PM   #7
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
"Takes one to know one" kinda thing, eh? :p
Jimbo is offline   Reply With Quote
Old May 25th, 2006, 9:04 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
DaWei, why do you build me up, just to tear me down, baby? lol
Just read the post, and think for yourself. If there's something there to learn, fine. If not, sorry. It could be you just never thought of things that way, before. I'm not here to pat butts and hand out binkys.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 25th, 2006, 10:01 PM   #9
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Maybe I am too anal and OO minded, but I don't write procedural C++ programs. So I have one header file and one source file per class. For really small classes, about ten to twenty lines, that are just utility classes related to a larger class I will include them with that classes sources. It is quite hard to follow someones code if they haphazardly group classes in source files. Now of course C is a whole other story.
Game_Ender is offline   Reply With Quote
Old May 25th, 2006, 10:17 PM   #10
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Since none of my projects has gone over 5000 lines, I generally stick with 1 or 2 (at the most) source files. :p
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 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:55 AM.

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