What gives code value? Does your code need to have meaning, a purpose, for you to have the necessary involvement to give your best effort? To what extent should we care about the usage for the code that we write? A lunch conversation with three of my coworkers prompted these sorts of questions.
Value, Purpose, and Programming
Let's call them Zach, Flora, and Jamie. They're my regular lunch group, inasmuch as whenever I'm eating lunch at the same time that they are we all sit at the same table. As happens in the real world, I don't remember exactly how we got on the topic of code "value", but the conversation went something like this:
Zach: I just feel like I need the code to be used in order for me to be able to do my best work on it. If I spend all this time writing a good, well-thought-out application, only for it to never actually get deployed, then what was the point of doing a good job?
Matt: I get that. I just don't feel quite the same way. I have to have a reason to build something, but just because it ultimately got tossed out doesn't mean I'm not gonna do good work on it. It might get used, it might not; that's not really for me to decide.
Jamie: If someone told me, "We need you to build these 7 sites over the next year, and when you're done, we're going to trash them all," I'd still do it.
Matt: But why? What would be the point?
Jamie: I feel like I'm not in a position to question why I'm supposed to be doing things. I'm just a software developer, not a senior or lead or anything, so who am I to question why something needs to be done? I just do it.
Flora: But isn't there a chance that the issue you found hasn't been considered before? It may not be likely, but it's possible, isn't it?
Jamie: ...I suppose it's possible, but it's just code. Why do I need to question all my tasks like that?
Matt: See, that's my issue: I can't help but question "why?".
I suppose that really is my issue, to the probable annoyance of my supervisors. I need to know what the code we're building will be used for, why it exists, in order for me to feel like I can do a good job working on it. I need to know that the applications that I'm writing will have value.
As shown above, Jamie disagrees. He stressed (later in the same conversation) that he still does his best regarding code structure and quality, but to him, the extrinsic value of the code is irrelevant; it's not for him to think about, as if it has reached his desk, clearly someone else (presumably someone who will actually use the program in question) has already determined that the code is relevant, useful. Why undermine their decisions?
We Are Not Our Code
I am of two minds on this. On the one hand, I certainly don't enjoy my code being casually tossed aside like garbage (unless it actually was garbage, in which case I'll throw it out myself), but on the other hand, the code that I write cannot be assumed to have value for the users. I'm obviously going to try to make it valuable, but ultimately it is the users who decide if what I wrote will have a use and a purpose.
I suppose that's the root of the problem, then. We are not the arbiters of value. We can't determine if our work is valuable, that must be done by outsiders, but without that value, why should we do a good job? If we don't do a good job, then are our applications valuable? Worse, what happens when (not if) some users decide that our work is not valuable, that it doesn't do what they want, and they throw it out? Should we be offended, hurt?
Of course not. I am not my code. The code I wrote is a reflection of me as I was at that moment, not as I am now. It is static, whilst I will (hopefully) forever be changing, improving, learning. Every second that ticks past is a second where I'm expanding my skills, consuming knowledge and applying it judiciously. I'll be better tomorrow than I am today.
What's amazing about making this mental separation is that if the code is not part of you anymore, you become much more willing to change it. Criticism suddenly seems useful rather than an ad-hoc attack on your abilities. It's no longer you who is stupid or wrong, it's the code, and you can just change it without taking an emotional beating. The code transforms into its own separate entity, wholly apart from you, and can be modified, re-configured, or thrown away without dragging you along.
Pair programming by Damien Pollet, used under license.
The best advice I have is this: separate your sense of self-worth from the code that you write. Doing so leaves you more open to criticism, to learning, to improving your skills. Once the code is separate from you, who cares if it sucks? Code doesn't have feelings. You can make your code better.
In short, you are not your code. Don't forget that you can (and should!) separate what you do from who you are.
Are you like Jamie, or me, or someone else? Have you had any difficulty separating what you do from who you are, and how did you handle those situations? Share in the comments!