Omnimaga

General Discussion => Other Discussions => Miscellaneous => Topic started by: Munchor on March 18, 2011, 02:40:12 pm

Title: One File VS Multiple Files
Post by: Munchor on March 18, 2011, 02:40:12 pm
Are you a multiple file user (Computer Programming or Calculator Programming)?

Or do you have 1000 lines in a single file?

What do you think is best?

Discuss.

----

I personally use a single file for pretty much everything, one file and print in each line debugging is for real man!
But organized code is best when using multiple files, I have to agree with that.
Title: Re: One File VS Multiple Files
Post by: willrandship on March 18, 2011, 02:45:04 pm
1000 lines is way too small for multiple files, IMO :P But if I'm doing it in a lang that lets me, I like to use multiple files, separated by their function.

Multi files also work better with others, for changes become easier to implement, and conflicts are less likely.
Title: Re: One File VS Multiple Files
Post by: Ashbad on March 18, 2011, 02:45:29 pm
I use multiple files for Java, but my source for TaNF is ~3000 axe lines long, I prefer not to split up files unless nessicary on calc.  multiple files can be quite messy.
Title: Re: One File VS Multiple Files
Post by: ruler501 on March 18, 2011, 02:45:35 pm
(Computer Programming: Python/C++)I usually have one file but I try to make multiple files so I can add features/debug easier.
I try to create very organized code but usually it ends up being chaos, but working chaos

EDIT:(Calc Programming)On my TI-Nspire with TI-84 Emulator I try to keep it to one file. I don't like having to call extra files.
Title: Re: One File VS Multiple Files
Post by: SirCmpwn on March 18, 2011, 02:46:20 pm
I generally use multiple files for anything other than Pure TI-Basic.
Title: Re: One File VS Multiple Files
Post by: aeTIos on March 18, 2011, 02:55:44 pm
If I create TI-Basic programs, I use multiple programs for subroutines to cut down the size
Title: Re: One File VS Multiple Files
Post by: z80man on March 18, 2011, 02:58:01 pm
Usually what I'll do for C++ is write everything in small multiple files, then before compiling I will copy and paste everything into one large file as it makes it easier to debug. And I can easily copy everything back because I use large distinctive headers for each file. Otherwise all those #include statements just seem to bug me.
Title: Re: One File VS Multiple Files
Post by: Munchor on March 18, 2011, 02:59:23 pm
My problem with using multiple files is that I don't know how to do it in most languages.

I know how to do it in Python and Java, TI-Basic and Axe, but nothing else.
Title: Re: One File VS Multiple Files
Post by: ruler501 on March 18, 2011, 03:04:46 pm
I like #include and import statements they make life easier.

Especially in Python
Title: Re: One File VS Multiple Files
Post by: jnesselr on March 18, 2011, 03:26:00 pm
I usually use many files, but it depends on the project, too.
Title: Re: One File VS Multiple Files
Post by: Munchor on March 18, 2011, 03:27:27 pm
I usually use many files, but it depends on the project, too.

That's right, if it's a simple projects, why would one use multiple files?
Title: Re: One File VS Multiple Files
Post by: jnesselr on March 18, 2011, 03:36:22 pm
I usually use many files, but it depends on the project, too.

That's right, if it's a simple projects, why would one use multiple files?
well, in TI-basic, subroutines.  I've used it once where a core engine had to be called from several different places before.
Title: Re: One File VS Multiple Files
Post by: AngelFish on March 18, 2011, 04:04:55 pm
I'll use multiple files if makes something significantly more efficient or easy to implement. However, in order to avoid forcing the user to install 50+ files (As some people do), I set a fairly hard limit of three files, with two being my normal limit.
Title: Re: One File VS Multiple Files
Post by: Munchor on March 18, 2011, 04:17:08 pm
If I need to make something quick (a prototype) definitely one file.
Title: Re: One File VS Multiple Files
Post by: DJ Omnimaga on March 18, 2011, 04:37:59 pm
I generally use one file except in the following cases:

-Memory constraints (good luck fitting Illusiat 13 in one file)
-Avoiding code repetition in TI-BASIC where speed is a must (otherwise you can include your sub-routines inside the main program)
-It's annoying to scroll 5 minutes through a TI-BASIC program to find a little mistake.
-1 page app limitation in Axe.

I think the most extreme case of memory constraint is Illusiat TI-81 Remake. Illusiat TI-81 Remake has 37 sub-programs and 3 matrices. One of the sub-program only contains the following code:
Code: [Select]
PrgmY:
Disp ""

By calling PrgmY instead of doing Disp "", I save about 35 bytes of RAM (the program is called 37 times in the game), because on the TI-81 you have to close quotes and program names won't count towards user RAM (There's no VAT). And I couldn't afford wasting these 35 bytes when this calculator only had 2400 bytes of user RAM.
Title: Re: One File VS Multiple Files
Post by: qazz42 on March 18, 2011, 05:05:19 pm
In C# I like to use many source files, but in TI-Basic I try to limit it >.>
Title: Re: One File VS Multiple Files
Post by: Deep Toaster on March 19, 2011, 03:41:41 pm
I generally use multiple files for anything other than Pure TI-Basic.

Same. I always keep everything for a BASIC project (data and all) in a single program.

For most computer projects, I also keep it in a single file unless they should be separated for practical reasons (such as to create a public class in Java). Same with my ASM projects, mainly because they're mostly really small.

But for Axe, it's completely different. I split the source up into insanely small portions -- Contra is currently at 21 subprograms, each of which is around 100-150 bytes. (I think XDE was at 15 or so.) It compiles a bit slower, but it's much, much easier to find and rewrite portions of the project, especially considering the way I compress my source x.x
Title: Re: One File VS Multiple Files
Post by: ztrumpet on March 19, 2011, 03:44:05 pm
I generally use one file if I'm programming on the computer, but multiple files if I'm programming on-calc.  If I'm in Basic, I combine all of my files into one before the final release. ;)
Title: Re: One File VS Multiple Files
Post by: Munchor on March 19, 2011, 03:50:33 pm
I generally use multiple files for anything other than Pure TI-Basic.

Same. I always keep everything for a BASIC project (data and all) in a single program.

For most computer projects, I also keep it in a single file unless they should be separated for practical reasons (such as to create a public class in Java). Same with my ASM projects, mainly because they're mostly really small.

But for Axe, it's completely different. I split the source up into insanely small portions -- Contra is currently at 21 subprograms, each of which is around 100-150 bytes. (I think XDE was at 15 or so.) It compiles a bit slower, but it's much, much easier to find and rewrite portions of the project, especially considering the way I compress my source x.x

The shoot-em-up game you make had 6 files if I remember :S
Title: Re: One File VS Multiple Files
Post by: calcdude84se on March 19, 2011, 05:15:42 pm
I'm going to agree with Sir's general opinion here. TI-Basic, for small programs, is not, IMO, a good idea because you can only edit one program at a time, so when you switch sub-programs you have to scroll. It also fills the programs menu and the arch/del one too. Of course, that's not practical for larger programs, and in that case you might be working on a sub-program for long enough to make switching not a concern. The same general idea goes for most calculator things, I think.
As for computer languages, you can edit multiple files at once and using multiple files is generally painless. It provides for more organization and is simple enough to do, so why not? As for the many files problem, source (for non-interpreted languages) can be packed in an archive (like .zip) or put in a separate folder, and, in the case of Java, .jar files put everything into one file.
There's my two cents :) (This isn't meant to attack any others' posts, just to be certain :P)
Title: Re: One File VS Multiple Files
Post by: willrandship on March 19, 2011, 05:38:39 pm
Well, it's nice to see everyone agreeing on something :P
Title: Re: One File VS Multiple Files
Post by: Munchor on March 19, 2011, 05:45:10 pm
I'm going to agree with Sir's general opinion here. TI-Basic, for small programs, is not, IMO, a good idea because you can only edit one program at a time, so when you switch sub-programs you have to scroll. It also fills the programs menu and the arch/del one too. Of course, that's not practical for larger programs, and in that case you might be working on a sub-program for long enough to make switching not a concern. The same general idea goes for most calculator things, I think.
As for computer languages, you can edit multiple files at once and using multiple files is generally painless. It provides for more organization and is simple enough to do, so why not? As for the many files problem, source (for non-interpreted languages) can be packed in an archive (like .zip) or put in a separate folder, and, in the case of Java, .jar files put everything into one file.
There's my two cents :) (This isn't meant to attack any others' posts, just to be certain :P)

Unless if you program Basic/Axe on the computer like me.
Title: Re: One File VS Multiple Files
Post by: calcdude84se on March 19, 2011, 05:54:44 pm
Ah, yes, I forgot about that. Then nothing wrong there :)
Title: Re: One File VS Multiple Files
Post by: Munchor on March 19, 2011, 06:09:04 pm
Ah, yes, I forgot about that. Then nothing wrong there :)

But it's also boring to put *all* files on Wabbit.
Title: Re: One File VS Multiple Files
Post by: Darl181 on March 19, 2011, 06:12:09 pm
You can just send them all in one go, just hold ctrl while you click on the files to send then drag. ;)

Myself, it depends on what type of project it is.  Levels, definitely outside file, also I tend to split level editors from the games if they don't fit together.
I prefer to keep it to one file, tho--less stuff in the program list.
Title: Re: One File VS Multiple Files
Post by: DJ Omnimaga on March 19, 2011, 11:58:40 pm
Ah, yes, I forgot about that. Then nothing wrong there :)

But it's also boring to put *all* files on Wabbit.
Yeah that's one of the reason why I prefered to code on-calc.
Title: Re: One File VS Multiple Files
Post by: Jonius7 on March 20, 2011, 12:20:48 am
In most cases, it's better to have a single file, however if it is a major program, maybe up to 8 files are ok if each of them are major sections of the program. If there are levels, I'd prefer to have all levels in 1 file, but this may depend as it could be better if each level had a separate file. It's important to find a balance between 1 program or several programs.
(taken from my experience using a Casio CFX-9850)
Title: Re: One File VS Multiple Files
Post by: DJ Omnimaga on March 26, 2011, 04:31:27 pm
Didn't the 9850G use like 2-4 bytes per BASIC token by the way? I remember hearing something about how 9850G programs were twice larger than 9860/PRIZM ones.