Xiong has asked for the wisdom of the Perl Monks concerning the following question:

I've been trying to get a coherent answer to a complex question; it's no surprise this is tough. It's a big question and requires a big answer; I no longer expect to get that answer in any PM node reply. I've been trying hard. Sometimes I think half of the SoPW nodes I've written have touched on this question; quite a lot of my study-up time has been spent in research.

Where do I put my files?

What I Have

I have several projects; all the files pertaining to each are kept in some ~/projects/someproject/ and broken into several subfolders. For purposes of this node, please let us say lib/ to mean ~/projects/someproject/lib/.

Most of my project files are tracked by Git; I have put a number of subfolders in hold/, which is untracked. (Formerly, I had several untracked folders but now I think it's simpler to keep anything untracked in a single top-level folder.)

I have many tests: unit tests, integration tests, author tests, user tests, good tests, bad tests. Some tests do not pass now but will later; some tests examine the execution environment and bail out of further testing if prerequisites are not installed. Some tests are useful during development but are strictly optional for user. Some tests are failed testing efforts; they may later become good tests or may stay in the junk box.

I have many notes files. Some document mainline progress on the project. Some are little snippets of CB in which somebody was kind enough to suggest a feature or level a criticism I ought to remember. Some are semi-formal documents outlining how I branch, when, and why. Some are specifically demanded by CPAN, such as Changes.

I have many tarballs. There are tarballs of related and unrelated modules, other author's stuff, that I want to poke around in. There are tarballs of the current project, one for each version released. I really need to keep tarballs in hold/, since Git does not respect mtime and I consider that little bit of metadata to be of some importance.

In fact, while I love most everything about Git, this tendency to reset mtime blandly, when switching branches, is a real annoyance. I rely on mtime to tell me something about a file; I think chronologically.

I have modules; currently, I keep them in lib/. Some of them are project modules; these are the important ones. Some are... other things. For instance, in the case of a module-testing project, there might be a "teddy bear" module which does nothing useful but can be hacked up in various ways, to act as an object of the project. I don't want to ship that.

I have scripts. For some projects, these may be CGI scripts. Another project has a script as the main command line point of entry. Some scripts are what-ifs for my own interest only; some are semi-public demos; some are utilities I expect other devs might use.

I have graphics files. Some are ready to serve on a web site. Some are graphical notes. Some are huge sets of workfiles.

This is by no means a complete list. I've tried, several times, to explain what I do currently and it's wasted effort. It's clear that I'm doing things in such a nonstandard way that it's just a confusing explanation. Please don't ask why I would have this or that; surely its enough that I do. Some of us use the Trash ruthlessly; some of us are pack rats. I don't like to throw anything away; it may become useful later.

Again, so there's no mistake: There's no point at all in addressing a single aspect out of all this. It's not of much importance how I do things now. I'm trying to find out how others do this stuff. I'm only describing this stuff in detail so you can understand exactly what kind of stuff I worry about.

Where Stuff Goes

If I just wrote stuff in the project folder and executed it directly from there, it wouldn't really matter how I organized it. But files need to move. I've identified at least six different places where a project may exist; in some sense, these are all copies of one another. A major issue for me is figuring out a structure that meets all needs or at least can be converted in straightforward fashion from one to the next.

  • Local development: This is the project folder we've been discussing.
  • Local deployment: Similar to user deployment but there may be some oddities.
  • Remote development: I run, say, a web application on remotehost and see what it does. It usually doesn't, so I edit a local file, upload that, and try again. I don't build a whole tarball and go through the entire install process remotely for each tiny fix.
  • GitHub: Periodically, I push my Git repo to GitHub. Now, I have to meet some minimal set of other people's expectations. I'm not even certain what these are.
  • CPAN tarball: Eventually, I want to wrap it up. I'm using Module::Build. This process requires a whole set of files that seem to have nothing to do with previous demands. And locations are important.
  • User deployment: I like to hope that my work will be of value to others. If so, well, it has to be organized just so.

Personal Quirks

There are things I like, some very strongly. I can bend on some but I'm looking for solutions that don't go too far out of my comfort zone. Please don't say these are silly quirks; all quirks are silly. My Pop wore bow ties to work every day of his life.

I don't like to mix files and folders inside a folder. That is, either let the folder contain only files; or only subfolders.

I like short identifiers, which includes path part names. I strongly dislike mixed case.

I want to keep like with like. Closely related items should be in the same subfolder. Loosely related items should be in subfolders of the same folder, and so forth.

I don't want to spend more time managing my project than I spend writing Perl.

I must avoid reshuffling my project organization; it's destructive. I need something stable.

I need a solution for each possible file transfer. Given the six states I show above, I conceive of about eight or nine possible moves.

I'm looking for the total package, not a series of roll-your-own components. I lack the experience to know what is meant to work with what.

Although I'm a solo developer, I want to keep firmly in mind a play-along attitude. I don't want to put off possible collaborators by doing things in a weird way.

Why So Tough?

I've gotten a lot of comments to the effect that here, here, and here are some ways of doing this and I can just pick what I want. But none of it makes any sense to me. This is Perl; one of the best things about this language is that all you need to do, to install a pure-Perl module, is drop it into some subfolder of /usr/bin/perl/lib/. Seems to me totally rational simply to tarball everything in my working tree, just as it is, and let the user fish out the module and put it where he likes. I'm completely clear that there are other requirements but I have no feel for them, so my judgement in this is worthless.

I have read so much POD over the last few months that my eyes are bloody. This is like barbecue sauce: Everyone has his own recipie and nobody wants to share his with anyone else. A million patent bottles of magic clamor for my business but they're all ingredients, not end products. There are plenty of vague generalizations and tantilizing glimpses but no complete end-to-end explanations. I'm looking for the exception.

Answers

I've been asking this same question, in different forms, since my first node. I keep getting answers that depend on unseen assumptions. I have no idea what you assume so these comments are useless to me. Sometimes they're worse than useless, since I'm led into a confusing dead-end, thinking I finally have a handle on it.

What I want is nothing less than a single, coherent guide to project management: How to organize files in my local project folder and how to get them from there to everywhere else they need to go. One word answers, such as "Try Dist::Zilla", are completely off the mark.

Please don't try to answer this question directly in a reply node. Unless you're willing to write at great length, the answer will be incomplete. I suspect the answer, even restricted to the choices of Linux, Perl, Git, and Module::Build, constitutes a whole, big, dead tree book. This is one time I don't want a toolbox; I want a running automobile. I don't understand the constraints of the process well enough to design and build my own.

So, the reply I seek contains a single reference to a comprehensive work on the overall topic. I can tolerate some choices among methods but they need to be clear alternatives. I'll open my wallet if I must but I do desperately want to get back to writing Perl.

Everyone on PM who regularly starts and finishes Perl projects has got a solution to these issues. I don't ask, How do you do it? I ask, How did you learn?


2010-08-16:

Strike most of the node. See retry.

2010-08-17:

<readmore>

We don't need the conch anymore. We know who ought to say things.... It's time some people knew they've got to keep quiet and leave deciding things to the rest of us.

Replies are listed 'Best First'.
Re: Project Structure Revisited
by Corion (Patriarch) on Aug 15, 2010 at 20:21 UTC
    What I want is nothing less than a single, coherent guide to project management: How to organize files in my local project folder and how to get them from there to everywhere else they need to go.

    You can make this as easy as you want, or as complicated as you want. You have been told previously to just take an existing distribution and modify it to suit your project. But you seem to want something else, yet haven't told us why. So you seem to search something more complicated.

    So, the reply I seek contains a single reference to a comprehensive work on the overall topic.

    It doesn't exist beyond what has been pointed out to you already.

    I don't ask, How do you do it? I ask, How did you learn?

    By looking at how others do it, and mimicing it, until I came up with a set of ways that worked my process.

Re: Project Structure Revisited
by BrowserUk (Patriarch) on Aug 16, 2010 at 01:35 UTC
    This is one time I don't want a toolbox; I want a running automobile.

    You're asking for far more than that.

    To stick with your anology--which just happens to be one of my favorites--what you are asking for is:

    A stylish 18-wheel, 7-seat, drop-head, hybrid, supercar. With F1 performance, Prius economy, Peterbilt carrying capacity, Porsche cache and Spyder exclusivity.

    And what you'll get if you try to meet that spec is a duck-billed camel with two legs, four wings and a blow hole.

    Even if you succeeded in evolving your perfect structure anytime soon--which is unlikely as evolution takes time--you'd get something that would work for one particular type of project, and no other. And in the process you'd set yourself up for for ongoing pain every time you had to work within the constraints of another's "perfect system"; or any pre-existing system.

    In an ideal world, there would be a one-size fits all, perfect development environment. But the world is far from perfect.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Project Structure Revisited
by oko1 (Deacon) on Aug 16, 2010 at 00:47 UTC

    Please pardon my stating the obvious, but it seems that there are only two possible categories of answers here: either you do it the way everyone else does - i.e., standard project management techniques appropriate for the level at which you do your work - or you do things your own way and invent your own methods. Following your own path is great stuff, but there are always costs to doing so, many of them unpredictable or at least invisible from the point where you diverge from standard practice. Take it from a guy who's climbed a lot of strange mountains and sailed many a mile of stormy seas, both literal and figurative, for the last few decades: when you choose to be different, you need to be very, very careful about picking your battles. E.g. - sure, you like doing this your own way - but what are you willing to pay for it in time, effort, money, and trouble? Figure out that limit, and revisit that decision once in a while.

    What I want is nothing less than a single, coherent guide to project management: How to organize files in my local project folder and how to get them from there to everywhere else they need to go.
    <advice += NaCl(1 gr.)>

    Expanding on and continuing what I've said above, I don't think that the answer you're looking for exists - at least not in any way that can be conveyed in a post (or even in a thick book); the situation is complex enough, and constrained by enough of your personal choices that the solution is going to be primarily social rather than technical.

    You could learn project management techniques - there are academic courses available for this - and design your own system (and continue to revise it until it's exactly what you want); this is perhaps the most scalable solution. Conversely, you could hire an experienced project manager (heck, there's probably tons of them starving at Dice.com) on a consulting basis, feed them your list of requirements, and ask them to design a system for you. Since you won't be the expert in the situation, *listen* to their advice about the pitfalls if you go this route; I understand that you want to do things your own way, but there are times when certain techniques are just B.A.D. (Broken As Designed) from word 'go', and need to be done away with.

    </advice>

    In any case, as one explorer to another, I wish you the best of luck. :)


    --
    "Language shapes the way we think, and determines what we can think about."
    -- B. L. Whorf
Re: Project Structure Revisited
by aquarium (Curate) on Aug 16, 2010 at 03:51 UTC
    This seems to be more about pandering to your quirks than anything else. The real world comes with realistic expectations and tradeoffs. Your quirks seem very peculiar/personal, so I guess the only way is to roll your own personal solution.
    There's an old rule of thumb: spend 90% of time in design (and project management) and 10% coding....or otherwise you end up spending 90% time debugging. Sure, coding is nice, especially in perl..but it's essentially implementing already well thought out logic.
    the hardest line to type correctly is: stty erase ^H
Re: Project Structure Revisited
by dHarry (Abbot) on Aug 16, 2010 at 08:46 UTC

    A single reference? here you go: KISS

    For the record: I use the Eclipse IDE. It's not perfect but I got used to it. It can be extended with plugins. There are tons of available plugins, see for example Eclipse plugins, and it's not too difficult to develop your own plugins. An added bonus is that it's platform independent (I used it on Windows and Linux and currently on the Mac) and that you can use it for basically any programming language. Whatever tools and approach you use the keyword is consistency.

    It seems you are looking for perfection... Have no fear of perfection - you'll never reach it. Salvador Dali

Re: Project Structure Revisited
by locked_user sundialsvc4 (Abbot) on Aug 16, 2010 at 15:07 UTC

    It just seems to me that you want the community to ratify the approach that you have elected to take, when the simple answer is: TMTOWTDI.   Like everyone who has trod this path before or after you, you will strike upon an approach that works well for you and for the project ... and everyone who follows you (after you get smooshed by a camel driving a bread-truck) will look upon it with great puzzlement and say, “what the hell ...?”

    It so happens that certain approaches have gained favor over time, and each one has its detractors, too.   No one says that you must follow any of them; nor that any of them are right for you, for this project, right now.   This is a craft, not an art.

Re: Project Structure Revisited
by jdrago999 (Pilgrim) on Aug 16, 2010 at 17:42 UTC

    This is how you do it:

    Do the absolute least that you possibly can. If that doesn't quite solve your problem, do a little more.

    Perhaps you've missed the point of programming in Perl - easy things are easy, hard things are possible. If you want a system that's going to hold your hand through every conceivable little thing and think for you - then switch to C# and use Visual Studio. Everything just clicks together right out of the box and you don't have to think. Of course .Net + Visual Studio has its own problems (being from Microsoft and only runs on Windows being the root of them).

    There is no ONE TRUE WAY to do anything. You have to adapt to the situation at hand.

    If you are worried about doing things too difficult for others to understand, then try doing what everyone else does:

    • Use Git/SVN/CVS/whatever. Don't use something you invented.
    • Use normal folder structures (~/projects/someproject/lib etc t sbin whatever) is fine.
    • Perl has this great module installer thingy called "CPAN" - you may have heard of it. Don't install modules in your application's directory, as they may be out of date.
    • Use the simplest thing that could possibly work! Every additional requirement is just another flaming hoop you jump through. No hoops = no jumping.
    • Look at Padre - it's a large project and has many dependencies. It also installs quite nicely. Look at the project structure - it has many developers and everyone seems to get along just fine working together. It is a success - do what they are doing!
Re: Project Structure Revisited
by locked_user sundialsvc4 (Abbot) on Aug 17, 2010 at 03:29 UTC

    True experts do not “starve.”

    They always have more work than they can do.   And, people wait in line to have them do it (or direct it).

    And I will also opine this:   in thirty years of doing this crazy computer-programming thing, I have never in my life seen quite such a company of bona fide experts, “all in one place,” as is found right here.   And I do not presume to count myself among their number.

      ++ however there were a lot of out of work PhDs around when I was a kid in rural New Mexico; the proximity of the Sandia and Los Alamos National labs. LSD was $4 a tab, at most, because some of the unemployed were chemists.

      Expertise can't always overcome personal choices or quirks. An expert with an inconvenient personality tick or unusually strong ethics will have a much harder time finding work. One easy example: Deciding against working for the US government as a conscientious position can cut a huge swath right through the available jobs. Hell, your very expertise can count against you if you're engaged in a field that is highly regulated or political. People who know exactly what they are doing can be a burden or even a legal liability in those situations.

      (I'm pro-expertise and highly pro-work, I just has to calls 'em like I sees 'em.)

        Your Mother++ # for taking a shot at a small part of the underlying task in CB earlier.

        I'm reckless enough to throw many hours into reading dense tomes, most of which I know in advance (based on prior experience in kind) will prove but tangential to my immediate needs; I'm flush enough to throw dollars away on books that I'll read twice, store for five years, and then give away. Somewhere, I know, will be the book that speaks directly to my needs and which I will thumb over to destruction. I may as well take oko1's advice and wave cash in the air, if that's what it takes to shake the fruit from the tree.

        So, I'll offer first to the Monastery the US$100 contract to produce a recommended reading list on the topic of project file and folder management. Any Monk is welcome to submit a two- or three-line bid showing you understand what I seek. If the bid is accepted, I'll PayPal in advance, in full. I propose fulfillment in a month but I'm flexible. If the bid is rejected, I'll explain why unless you expressly request I not. The work-for-hire: the reading list; becomes my property and I will publish it here under the same terms as PerlMonks itself.

        We don't need the conch anymore. We know who ought to say things.... It's time some people knew they've got to keep quiet and leave deciding things to the rest of us.

      I agree that Monks seem to know more about writing Perl, in almost any imaginable scope, than any other group I've seen. I suspect I'm incompetent to judge the full extent of the group's competency. :)

      That's why I'm so interested in Monks' opinions -- enough to dodge considerable opprobrium in hopes of getting a few.

      We don't need the conch anymore. We know who ought to say things.... It's time some people knew they've got to keep quiet and leave deciding things to the rest of us.
Re: Project Structure Revisited
by Xiong (Hermit) on Aug 17, 2010 at 23:48 UTC

    The task in this node is to link to resources and cite books or articles that a medium-grade Perl newcomer might study to address a specific project management task.

    The specific project management task is:

    Given: A project of some defined scope and nature (e.g., a utility module or a web application); and the ongoing process of creating files within it (e.g., code and documentation); and anticipating the needs to transfer, publish, and deploy this project.

    Considerations: The project is developed on a Linux system and written primarily in Perl; Git has been chosen as VCS; and Module::Build as build/test/install tool. Targets include localhost, remote web host under author's control, GitHub, and CPAN.

    Primary Goal: To organize those files into a working tree by good choice of filename and by nesting them within folders (directories) and those folders possibly within subfolders, also with well-chosen names.

    Secondary Goal: To identify specific strategies for dealing with specific cases where it may be unwise or inconvenient to replicate working tree structure exactly when the project is transfered, deployed, copied, or published.

    Dummies of appropriate content (not content of replies but content of resources; $$stuff not $ref):

    Put all tests that actually execute (passing or failing) under the top-level folder t/. You might have a test for a feature not yet implemented; put that in a subfolder t/unimplemented/ and add it to MANIFEST.SKIP. Push it to GitHub but don't release it to CPAN.

    Say you have a file config.txt that contains configuration data to be read by a web script upon startup. According to the discussion given previously (on page 167), that file should be stored in remotehost's path as ~/.config/myproject/config.txt. However, you do not want to keep that file there on localhost, since that would be outside of the project's enclosing folder. So, keep the file in file/config/myproject/config.txt and, for local development, employ the Wazoo workaround. Include file/config/myproject/ in your repo and in CPAN tarball releases. Also, add a rule to your JimminyCricket file (deploy.jimminy) that will cause the file to be copied out during the build to the appropriate deployment location. See JimminyCricket docs for more info on how to construct deviant install rules.

    Feste: Misprison in the highest degree. Lady, cucullus non facit monachum. That's as much to say as, I wear not motley in my brain....
A reply falls below the community's threshold of quality. You may see it by logging in.