You can prevent slums without outlawing this type of housing, they just need to be actively managed. Require landlords via regulation to keep up maintenance and evict unruly tenants, and actually enforce those laws.