Now I do consulting instead. I still get emotionally invested in the success of my clients but my job is specifically to help them run more effectively. Ended up that the solution for me has just been to find the job that allows me to help in the way most natural for me.
Your job will never love you back. Your employer's interests are diametrically opposed to you having a happy life.
It makes me sad that so many people here and elsewhere are content to just spend a third of their day 5 times a week for something they don't care about and don't get excited over. Is that really "healthier"?
I have a job where the code I write has a direct positive impact on the people the use our software. I enjoy seeing those positive outcomes. I enjoy seeing what my team and I created at the end of a hard sprint. There are certainly things I don't enjoy, as is the case with any job, but for the most part I feel good about how I spent those 8-9 hours at the end of the day.
I try to stay emotionally detached from everything I do for a company. Even recently this helped me through a layoff and transition. I worked for a full year, mostly by my self, to put together a tool the company desperately needed to grow but couldn't afford a full team to build. Some 20,000+ lines of code lovingly put together to do the job exactly as described with full end to end tests and everything.
Then the new guys came in and said the project is scrapped. Stuff is getting shipped overseas, and they're going to instead try to kludge some off the shelf stuff into the role. All my work, a year and thousands of lines of code, gone in an instant. If I was emotionally attached to my work, in the literal sense, I would've been crushed. I wasn't because at the end of the day they paid me to make something that could be destroyed. In this sense, money is the most important thing. I wouldn't work for free even if I was promised what I was doing would save humanity.
I don't get excited by company visions or goals. I don't get excited when the CEO talks a big game, or the engineering VPs tell us how good we are. I don't care about hiring processes, meetings with the PMs, or the exact nature of whatever it is I am building. All I care about is the fundamental act of coding is enjoyable to me - and that's what keep me in the industry. I've been in the industry over a decade now. I realize sprint goals along with everything else a company focuses on is mostly trivia. The people in charge universally lack the ability to understand the nature and motivations of an actually talented engineer.
But it is eye opening that in over a decade I have never had a company say "we need to make this code easier to add to" or "we should make this as flexible as we could need for the future". There's never budget for good engineering. Just getting the product done. So it makes no sense to have any attachment to exactly what you do. But rather the art, so to speak, of doing it. Emotional attachment is how you end up in therapy after getting laid off. Save yourself the trouble.
I think Aristotle would say that since a job is ultimately not in your control and you can be fired for reasons out of your control, you must compartmentalize your attachment, or detach altogether, if you wish to avoid pain.
It’s also an insight from Buddhism that expectation and attachment are core causes for suffering.
Yes, expectation and attachment are core causes for pain/grief/suffering. But that doesn't mean you shouldn't have expectations or attachments. It's just that you have to decide if the (potential or actual) grief and suffering is worth it, and under what terms you're willing to continue to have that expectation or attachment. This is where acceptance and boundaries have a huge part to play.
That's sometimes a difficult question. What kind of relationship to have with an emotionally abusive parent? Whether to leave a job that's financially very rewarding but is also extremely stressful and 60-80 hour weeks are common?
Buddhism decidedly doesn’t say “ergo, don’t love things.” It’s more “love things (people) as they are, without attachment and in full knowledge that they are ephemeral.”
Also you're loving something that cannot love you back.
I think you can get a lot of enjoyment and satisfaction out of a job without losing sight of the fact that it's a business arrangement... one which may stop being mutually beneficial for any number of reasons.
I've sometimes wondered if there should be term limits on most jobs? E.g. no more than 8 years in any one company, and maybe no more than 3 years in any one position. Something like that.