Thursday, May 8, 2014

It's Got What Projects Crave: It's Got Resources

I can't help meta-ing, aka thinking about what I do. And so I'm not totally happy with the below post, but what the. I'm thinking maybe I should describe what I think is good, instead of what I think is bad. Though maybe both are ok, maybe the one helps the other. And this text touches on one important facet of complexity, i.e. non-simple-ness, which I have some thoughts on; which thoughts may well materialize as text. Mental note to self: scale-free-ness. But the text is a bit un-simple in itself. Not well structured. Split-brained. Well so what, I'm not a professional writer. The text is at least trying to make a bunch of points. So let it. I can come back later.

---------

Last week I committed with a message like this: "Let's move test data resource files very far from the test source code files: Maven's src/test/resources/". It's an objective description of the change. Though with a small bit of snark. Sometimes, you're morally obliged.

I've been doing software development for a long time. I have, driven by discontentment or frustration, strived to develop at least an idea of what practices make developing easier, even somewhat possible. So my software developer sensibilities have been shaped for a long time. They may certainly need more shaping, but still.

Partaking in a Maven project, these particular sensibilities actually become a liability.

Maybe because the Maven sensibilities, anthropomorphically speaking, have not been shaped by time at all. They were pretty much set a long time ago, perhaps from the start (I'll have to look that up). But the non-existing sensibilities of a stupid tool can and will influence projects and people. Yes, not very difficult to tell Maven to also copy files from /java or whatever, but then half the point of using Maven gets lost, the setting of standards, some standards.

The test/main divide is bad enough, according to my humble sensibilities of course, but the resources/ divide is just sky high on the chart of badness, also according to these humble sensibilities. In fact, you can read 'taste' or something where I say 'sensibilities', it's a bit of a posh word anyway, isn't it.

Why was this layout chosen for Maven from the start? Well, there are some small advantages to it. For instance, you don't have to skip files that are not source-code when compiling. Maybe that was an important performance advantage back in the day, but that's hard to imagine.

Another is that you can have ".java" files be copied verbatim into the jar being built. This could actually be useful.

Polyglot projects could be having java/, scala/ etcetera. On the other hand, that's a bad taste again, it's not really polyglot if you have to have multiple folders, is it? All the source code should go into one source code folder..."src/{main,test}/src/"? "src/{main,test}/tobecompiled/"?

But what about script language source code, e.g. javascript? Well, there you go, it could be either.

This is the old arbitrary code vs. data divide thing living on.

It's also a duplication of structure, a structure that can be twenty folders deep no less.

It also makes it hard to reorganize your code and data together; and such operations AFAIK also are not supported by IDEs, so they can't help you either.

And there's a special wrinkle with Eclipse: it copies files in /java/ as resources, so you will, as I recently and not so recently have, end up with mysterious inconsistencies with tests working on Eclipse, but not in tools correctly following the Maven layout.

It's just so wrong. About 99% wrong.

No comments:

Post a Comment