<bigFatRant>
My job has led me to be involved in the creation of numerous small websites. I now have loads of code scattered about on 5 different machines and despite my strongest skills, wills and desires I have completely failed to benefit from code reuse, in fact I have suffered a detrimental effect from my attempts. On a couple of occasions I've chosen to write again, the same piece of code, I wrote less than week ago, because the context was slightly different and it would take me ages to dig out that old bit of code. Even if I had found that bit of code then I'd only be copying and pasting it anyway, violating DRY. What's the point? Perhaps I shouldn't consider myself a fool for doing this any longer. Perhaps DRY is a lie.
Subversion is certainly an absolute crock. Seriously people, why are you using that?! It's rubbish for what it's intended for. The only thing it is good for is what we did for the throw down, which is keeping remote workers synced in a rapidly updating small environment where programmers can easily inform each other of their changes.
I spent ages devising this scheme for how I'd use it with branches, tags, externals definitions etc. etc. I had this whole 600 word guideline document set out with how I was going to manage it all. It was marvellous.... in theory. The minute I started to use it I realised it was totally unworkable! One little mistake where I type the wrong thing in an external would require something like 7 steps to undo, waiting after most of them. You can't afford to make mistakes because they are so complex to undo, you fear making them. And then you get confused and your whole code is broken and scattered all over the place. The experience is emotionally draining and distressing. Subversion is also useless as a deployment tool - the second you get a conflict (which is easy to do with externals) on your production server your whole site is down, the PHP code immediately invalidated by Subversion's diff markup, until you fix it, that's bloody great that is.
Granted, I think my situation is unique; I'm trying to achieve an environment where you can share code across multiple projects, clearly, Subversion wasn't up to the job. I'm interested in trying GIT. The author (some of you might know him) feels as strongly as I do, as this youtube video will show. His unclouded non-conformist nature is what I needed to release that Subversion is rubbish.
Whilst I've learnt how to write good object oriented code that is loosely coupled, embeddable, generalised, unit tested and all that jazz - it takes <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> ages to do it! Frameworks and libraries are the one area where it does pay off to put all that effort in. Why? Because the whole world can benefit. For the purpose of small company it's pretty pointless and big ones are full of too many idiots to actually do a good job, they should both stop, they'll save a lot of money. I always wondered people I considered lesser programmers than myself were able to get more done, it's because they weren't on this mad goose chase I was.
Bleak, isn't it? Yes it is but there is hope. What can we do?
- Stop worrying about that website you haven't updated to use the latest version of this or that. Web code doesn't have much use beyond 2 years usually anyway.
- Consider meta programming. I had this idea to create a website where you could download customised class hierarchies. Before download you would choose what functionality you wanted. So you could turn off the stuff you don't need and benefit from the simplicity. That kind of thing is going to be really useful for making libraries more accessible and contextual.
- Packaging, Package Management, Dependency Resolution, Behaviour Driven Development (evolution of TDD), Aspect Oriented Programming, combined will go a long way to make libraries easier to manage and more get-at-able.
- More dynamic languages. You guys really don't know what your missing until you've looked at modules and mixins in Ruby. I'm not completely sold on Duck Typing just yet though but we'll see.
- Domain specific languages. There's almost no desire to reuse code here. Think about regular expressions and XSLT. The only time you ever reuse code here was when someone was doing something you couldn't do yourself. Actually they mean that people have to know more languages to get things done, this leads to more rounded programmers.
We're probably 5 to 7 years away from getting all this sorted. Till then don't stress yourself out, like I did, trying to achieve the impossible.
</bigFatAunt>