You spend half your waking hours at work.

Having a shitty attitude for that much of your life is no way to live.

On the contrary, being stuck in a situation where your livelihood can disappear at a moment's notice due to factors beyond your control is no way to live, but it's also not really something most people will ever be able to avoid. I don't at all buy into the idea that somehow pretending the situation isn't shitty is somehow more virtuous or fulfilling; what you call a "shitty attitude" sounds more like "being realistic about how one's work is valued" to me.

> being stuck in a situation where your livelihood can disappear at a moment's notice due to factors beyond your control is no way to live

That is literally the only way to live. Disaster stalks us an is only ever one misstep away (sometimes literally). In rare instances people can even just fall over and die.

In the sense that there should be food and shelter for everyone, even poor people; strictly speaking I think most countries have already agreed to that. Although how well that gets implemented is open to a lot of debate. But beyond that everything can always change at a moments notice.

I've spent several decades writing software. Got laid off 1-2 times per decade.

I still tried doing a good job every day, and feel very good about that.

To me, being realistic about the risk of losing my job at any time means having enough money that I can be unemployed for 6-12 months.

The major way good programmers get jobs is by being recommended by people they've worked with at previous companies. That doesn't happen if you deliberately do as little good work as you can get away with.

My "shitty attitude" comment is maybe more a personal philosophy that something universal. But I do not want to spend each work day being bitter and resentful. You may intend to punish your shitty employer, but I think you're mostly poisoning your own mind.

Working hard for a place that will not reward me is no way to live.

And with less dedication, I can spend far less than half my time there ;)

Nor is sticking your head in the sand.