At least as long as 'no X' is a reasonably moral thing to restrict. So no pets, no working on cars in the parking lot, no smoking, no loud noises/no more than N police noise complaints, etc. At least my moral code allows one to form a contract that restricts such thing and that when one party refuses to honor a (reasonable) contract, the other party should be able to require the breach be mended or the contract be ended, and that some breaches can't be mended.
Some things that might not be stated in a lease but would also be reasonable to evict for could include no interfering in the quiet enjoyment rights of neighbors, no storing of dangerous goods, no causing dangerous/unsafe situations.
Does programming cause property damage or impact other tenants?
I don't think it's a reasonable restriction, but unreasonableness doesn't make it immoral. At the same time, if you make an agreement not to program in a rental and then you program, shouldn't you need to stop or leave? I might have moral concerns about how one enforces a restriction against programming, it's probably intrusive
Now, if your question is no programmers and/or no overnight guests who are programmers and/or you can have six tenants in the unit, but no more than three who are unmaried programmers... Then my moral compass is pointing towards no. Restricting the practicing of a profession on premesis seems fine, descriminating against the practitioners is ick.
A single asshole can destroy an entire building.
If the tenant does something criminal, sure, that's up to the police.
Here's a nearly-strawman-but-definitionally-valid example: a landlord may want to remove a tenant who's being unusually hard on the place and accelerating the wear-and-tear. Could be serious enough that paying the tenant to go away would be cheaper than the cost to remediate the damage accrued over the length of the contract.
[1] https://www.hud.gov/sites/documents/hsg-06-01gapp5guid.pdf