Off Shoring is not new. I managed a team of 7 Indains (6 dev, 2 QA) in Hyderabad as contract workers (not company employees) in 2007, 17 years ago! Before zoom, slack, meet, teams.
They were great at what they did, they were cheaper than 8 US employees, but the relationship definitely had pros/cons that are not easily understood.
The biggest pro was actually the timezone, I could ask for fixes/features and when I came into the office in the morning they'd be done. The cons were many, including quality of work and efficiency.
2. Taxation regimes. These too vary by country, and add compliance and operational costs.
3. Other laws (both U.S. and foreign) that make hiring foreign nationals complex in certain situations, e.g., ITAR.
When considered together, these costs and operational obstacles can be significant.
The real issues are, ironically, the collaborative barriers. Different cultures have different standards of work, a different working culture, and honestly different time zones.
The “24 hour dev shop” is a risk, but work moving overseas is only a problem at the commodified software level, like a SaaS b2b where a shit tool with one little innovation saves five minutes can scale to millions in savings.
Consider this situation: you hire a contractor. They work for you for several years, and then you fire them. The contractor goes to the labor court in their country and files a claim stating that, yes, their contract says that they are an independent contractor, but no, since you've employed them "full-time" for several years continuously, they are a defacto/de jure employee. (Which is a valid argument under the labor laws of certain countries)
What will you do:
- Spend the time and money refuting their claim? (You need to find a good lawyer in that foreign country; lawyers are expensive; and someone on your side needs to spend their time coordinating with them)
- Ignore the claim? (Not a good idea if you ever want to visit that country in the future)
The claim itself might be nonsense; that's immaterial. You're faced with a Hobson's choice if said contractor drags you to court.
(Addendum: this is why I made the point that labor law is local. When you hire a national of a foreign country, in general, you subject yourself to the jurisdiction of the courts of that country for labor related disputes.
I am not sure if a clause in an employment contract stating that the agreement is governed by U.S. law would be accepted by a local court; and even if it did, in litigation, you'd most likely have to represent yourself before the local court to make that objection.)
This comes with some downsides of its own, but generally this circumvents most labor issues. And of course anyone can sue for any reason, but if the argument is that the individual will pester you with lawsuits, can’t anyone do that to anyone else about anything?
Re: the lawsuits—yes, the barrier to initiate litigation is low (in most countries); but in my experience, most folks only start litigation when they feel significantly wronged.
Problem is, given the difference in cultures (something you pointed out earlier), an act by the company that is perfectly standard in the U.S. might be interpreted very differently by someone from another country.
Another is communication; companies want to hire people that can communicate fluently in a shared language.
But the best solution is to just become better at your job. The best programmers are all in the US, so it is easier to learn from them and join their ranks. If you are no better than the competition, then a company is justified in hiring in the cheaper labor.
But still: As you say, the best way to defend against this is to simply be the best.
(The second best way is to become very fluent in technical use of the correct second language and learn to sleep on a different schedule, so that foreign workers can be closer to peers. Americans have been good at working weird shifts, and our society historically supports that to a fair extent, but the language thing is something that we have not generally been very good at.)
I think language, accents[0], time zones, and culture are the main things providing any resistance to this happening even quicker than it should.
[0]We once had a person on our team from India, sharp guy but his accent was extremely difficult to parse over audio. We ended up doing most communication over email and chat.