The Right Taxonomy of Code

Published September 08, 2014
Advertisement
I've written before about how much I want to get away from the "code goes in files" model of programming. The more code I write, and the larger the project, the less it makes sense to organize everything strictly by file names.

Yes, folder hierarchies can be one reasonable way to group related code... but they're still file-based, and they still assume that you can find The One Right Taxonomy to describe your entire codebase. This is a dumb assumption and we should make it go away.

Right now, the Epoch IDE is set up to store code in... yes, sigh, flat files. However, files mean nothing - they are all lumped together equally during compilation. There is no implicit file-to-module relationship like in virtually every other language ever.

As an experiment, I'm thinking about removing this from the IDE entirely. I want to see what it would feel like to work on a large project - like the Epoch compiler, or the Era IDE itself - without the restriction of thinking in terms of files.

I can hear the protests already... how does one find code if there is no file grouping?

Well, one option - and certainly not the only or "best" option - is tagging. Each function or other top-level construct (like a structure or type definition) appears in its own universe by default. You can join this universe into other universes to make pockets of code, simply by tagging a function with some label. The IDE then displays a list of labels, and you can open them up as if the tagged content existed inside a single file. Behind the scenes, each "island" of code is a single file on disk.

I kind of like this for the sake of version control, because it allows naive version control software (i.e. basically all of it) to actually do function-level histories. I kind of also hate it because it means a large project may consist of tens of thousands of files when a few dozen would suffice.


I'll try and think of other options, but I'm open to suggestions. Basically I want to make the code-to-file mapping a little more modern and a little less stuck in 1970.
3 likes 6 comments

Comments

tufflax
September 08, 2014 06:17 AM
ApochPiQ
I've seen similar projects before in the past; but I can't shake the feeling that they just don't quite come close to the power you could get from first-class integration from language design all the way up through IDE.
September 08, 2014 04:40 PM
tufflax

Hm, I'm not sure what kind of language design you are talking about. A lot of languages don't care about files, just code. If all the code was in the same file, the compiler would not care.

About the tagging idea: Could be neat, but if one tries to decouple one's modules from each other, working in one file at a time is reasonable, so I don't see it yielding a huge boost in productivity.

And about IDEs: I use Vim, and I wouldn't like to use another IDE/editor if I couldn't edit the code like I can in Vim. I guess making a new IDE is kind of hard in that way - lots of work has already gone into existing IDEs that people don't want to just throw away. Probably easier to make a plugin for an existing IDE.

Overall, I don't think the benefits would be very large, at least I can't imagine them to be.

September 08, 2014 07:03 PM
ApochPiQ
Decoupling modules does not imply a taxonomy that is 1:1 between chunks of code and files. That's my entire point.

It isn't about making a "huge boost in productivity." It's about making code easier to navigate and more discoverable. Once you've worked in a codebase of several million lines, you'll have little trouble imagining the benefits ;-)
September 08, 2014 07:55 PM
tufflax

Maybe. :) I'm working on an MMORPG now, and it's like almost playable, yet only 3.5k lines, including map editor. I'm having trouble imagining millions of lines too. I guess it takes quite the project to reach millions of lines in a Lisp.

September 09, 2014 09:13 AM
Sporniket

This idee is interesting, but I fear that developper that cannot find the right taxonomy for naming it's class/function/whatever, will likely not tag it's code with the right taxonomy of tags.

However, it may be easier to do tag review and fix them than doing the same for class/method/whatever renaming.

September 10, 2014 03:31 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement