Who owns my code?
As a *NIX systems administrator, I write a lot of utility code. Backup scripts, configuration scripts, that kind of thing. I run my own personal Linux servers and workstations at home, and because I work and play in very similar computing environments, much of what I do at work applies to what I do at home and vice versa. I learn how to configure my mail server to handle multiple domains at home and apply that knowledge at work. I learn how to set up DNS at work and apply that knowledge at home. (In fact, I have so many different domains at "home," my home setup is often more complicated than work... sometimes I think there's an imbalance between things learned on the job and things learned on my own time, and it leans in work's favor.)
But in the course of doing all of this, I inevitably write code in one place that I have a use for in the other. Case in point, I have a bunch of remote backup scripts I wrote to backup my server and all my workstations to local disk, keeping N days worth of changes, etc. I worked out the whole scheme on my own time, have tested it extensively on my own systems and have been using it for over a year. When I needed to back up my new work laptop in the same way (because it's the only machine I have at work now and it's never on the "work" network when the backups run), the obvious solution was to just copy over the software I'd already written, tested, debugged and proven. It's a much more robust solution than the quick-and-dirty backup another admin wrote to back up our webserver. (That one isn't backing up the MySQL database properly. I need to convert it over to my script.)
So ownership here is easy... I wrote it on my own time, it's mine. I can slap my copyright on it and license it for my company's use out of the goodness of my heart. (My annoyance at reinventing a wheel I already invented saves the company money. I could justifiably rewrite that code from scratch on company time, as there's no obligation to give the company the fruits of my personal labors for free.)
But what about the other way around? What if I wrote that backup software on company time? Traditionally, that's work-for-hire and is owned by the company. Being that our company lacks any specific agreements to the contrary, that's is the legal situation where I work (unwritten, informal agreements don't really count in copyright court). Yet, to the seasoned developer's mind, it doesn't make sense to look at the work I've done and have to recreate it from scratch in order to use it from home. Culturally... do developers pay attention to copyright law and the employer's ownership of their code for little utilities? My experience is that they don't.
I think this also works out in the employer's favor... an experienced developer doesn't just take with them code they wrote on the job when they leave, they bring with them all of their favorite little utilities that they've written on past jobs, that they wrote in school, that they wrote on their hobby projects. And often, when they move on, they leave copies behind. The tech support guys use a script I initially wrote over ten years ago when I worked for an ISP. It doesn't look much like the original script, but it has ten years of improvements on it. I wrote it because I needed it, but I've used it at every company I've worked for and passed the current copy on to others in my department. When I move into a new job, I bring with me a whole library of tools that make my job easier, and often make others' jobs easier.
The irony is that if we strictly followed copyright law, treating work-for-hire code as something I can't take with me, and treating any code I wrote on my own time my property and unusable at the company (without paying me a licensing fee), I think the computing world would be in a world of hurt. I'd feel crippled every time I moved to a new employer. (Much like I felt at Company B, when they told me Emacs was not approved software and I'd have to use the "original" vi.) Taking the time to recreate some of my basic tools would be a stupid waste of time... my previous employer would not benefit from it, and I would suffer for it, and I would be less valuable to my new employer.
I see writing these utilities as a lot like learning a new programming language or learning how to manage Sendmail... the employer can't stop me from taking that knowledge to my next employer. And part of that "knowledge," in my mind, is embedded in the code I've written. Quite literally... I have a whole folder full of snippets that I reuse, or use to remind myself how to do something. To me, those are "mine" in the sense that my knowledge of Perl and Unix are "mine".