Author Topic: One File VS Multiple Files  (Read 6553 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
One File VS Multiple Files
« 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.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: One File VS Multiple Files
« Reply #1 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.
« Last Edit: March 18, 2011, 02:46:13 pm by willrandship »

Ashbad

  • Guest
Re: One File VS Multiple Files
« Reply #2 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.

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: One File VS Multiple Files
« Reply #3 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.
« Last Edit: March 18, 2011, 02:47:53 pm by ruler501 »
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

SirCmpwn

  • Guest
Re: One File VS Multiple Files
« Reply #4 on: March 18, 2011, 02:46:20 pm »
I generally use multiple files for anything other than Pure TI-Basic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3913
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: One File VS Multiple Files
« Reply #5 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
I'm not a nerd but I pretend:

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: One File VS Multiple Files
« Reply #6 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.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: One File VS Multiple Files
« Reply #7 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.

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: One File VS Multiple Files
« Reply #8 on: March 18, 2011, 03:04:46 pm »
I like #include and import statements they make life easier.

Especially in Python
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: One File VS Multiple Files
« Reply #9 on: March 18, 2011, 03:26:00 pm »
I usually use many files, but it depends on the project, too.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: One File VS Multiple Files
« Reply #10 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?

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: One File VS Multiple Files
« Reply #11 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.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: One File VS Multiple Files
« Reply #12 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.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: One File VS Multiple Files
« Reply #13 on: March 18, 2011, 04:17:08 pm »
If I need to make something quick (a prototype) definitely one file.

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55926
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: One File VS Multiple Files
« Reply #14 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.
« Last Edit: March 18, 2011, 04:45:11 pm by DJ_O »