This is more of a software-engineering question than anything else, but PM has some pretty good SE people. Thus:

I've written a lot of utility code for my own use. Some of it is probably genuinely useful to the rest of the world; some of it is a collection of reinvented wheels (although I like to think that my wheels are better suited to my style than what's already out there); and some of it is rather specialized to my toolkit and of limited interest to the rest of the world. A fair bit of this code is getting to the point where it should be shared between many of my projects, but I'm having trouble deciding how to divide it.

Right now, I have two major projects in usable states: a rather specific utility library (real-time 3d graphics; it's basically a wrapper around SDL and OpenGL with some extra features thrown in) and an application that uses said library. I have a few other projects that're just starting up, though, and some of the generic code in the library (things like logging routines, memory management, and so on) would be useful in those projects, although they aren't RT3D-related.

So what I have right now is One Big Library. It's useful for me, because it's easy to link to and stuff, but if I want to move my code to a different environment it all has to come along, and if I want to share my code with other people they may have to wade through a fair bit of unnecessary RT3D cruft to get the malloc() wrapper I used.

The obvious alternative is to break the One Big Library up into several smaller ones, each doing one thing (and, at least in theory, doing it well). That makes more sense from a distribution perspective, but it means that my build process gets a bit more complex, and that if someone needs all of my code they have more libraries to worry about. Breaking the code up into orthogonal, single-purpose chunks sort-of feels like the right thing to do, but it's going to add a lot of complexity.

Should I just bite the bullet and accept that I have a few weeks of refactoring ahead of me, or am I missing a third way? (And while we're at it, any pointers to papers, essays, or other literature on the subject would be greatly appreciated.)

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
% man 3 strfry


In reply to Code reuse and clean packages by FoxtrotUniform

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.