In my experience, most full-time permanent jobs are at-will, there is no contract, and you can get fired for snapping your bubble gum in the cube farm just as easily as you can be fired for being bad at your job.
There may be more to the story, but in the absence of other information, "fired for using Notepad to write code" strikes me as being more on the arbitrary and capricious end of the scale than the rational and justified end.
It's a lot like firing a carpenter for using a screwdriver instead of a power drill with a screwdriver bit.
I guess it depends on where you are. There is a surprising amount of employment law at (least in NZ and Australia) to protect employees. I believe the EU is similar, but I don't know about U.S employment law.
Employers need to be very careful about the termination process; employees can claim compensation for unjustified or constructive dismissal. The employee might be glaringly at fault, but if the employer does not follow process (or even fails to document that) then a ruling can go against them.
Claims are very common here; there are various law outfits which just specialise in this area (e.g. the 0800 SACKED toll free number).
In the U.S., employee protections (or lack thereof) are largely determined at the state level rather than the federal level. What protections that do exist in law are practically unenforceable.
Decades of union-busting lobbying has resulted in "at-will" employment being the default in many states that formerly had better employee protections. Contracts are now uncommon, and contracts that do not heavily favor the employer are rare. This was sold as making it easier to hire and fire employees, but my observations suggest that it has not made it easier to hire.
Working in much of the U.S., aside from a few specific states, is toiling under the Sword of Damocles. My worst-case anecdote was being laid off with 3 days of notice with no severance. In theory, that should have triggered a federal penalty, since the entire office facility was laid off, but the company did some sort of legal sidestep to avoid that, which amounted to "You're not being laid off; we're just not giving you any work or paying you." When I found a new job 2 weeks later, the company demanded a resignation letter in order to release my security clearance responsibility to the new company. I refused, but I still had to write a note for their records explaining how layoffs work.
I'm continually surprised at people who come from Europe or Commonwealth countries to work in the US. Perhaps they just don't know?
In Germany there is a probation time of 6 month for full-time jobs. Normally you have a 6 week period of notice, in the probation time employer and employee only have 2 weeks.