[1] http://www.ted.com/talks/andrew_mcafee_are_droids_taking_our...
I would check his methodology carefully (he glosses over a lot) but the overall thrust is compelling
I want to think software engineering/programming would be one of the last jobs to be replaced by machines. It would last until the "singularity" is reached which is when computers would be able to program themselves (re-writing and improving their own code exponentially).
I haven't finished the whole thing yet, but so far it has been a good read about some of the problems with increased automation and machine intelligence. He also outlines some possible solutions.
http://www.amazon.com/The-Lights-Tunnel-Automation-Accelerat...
It's going to be a rough century
Norway almost de facto has a system like this already (through an incredibly generous welfare system), but the only reason we are able to pay for it is through the huge petroleum income.