Yeah, terrible places. You should visit an established one some day.
Helsinki. Stockholm. Berlin. London. Amsterdam. Prague. (Oddly enough, the parts of Madrid I've seen were less mixed.)
You don't have residential and heavy industries lumped next to each other. You instead get multi-use buildings with lower floors dedicated to shops and restaurants, higher floors to offices and homes. And clusters of light industry nearby.
Over a period of decades, locations with somewhat heavier industry may get encroached by residential creep, eventually making their logistics hard to sustain. They move out, leaving their large facilities behind. These in turn get repurposed for lighter industrial use. The old Hartwall[×] bottling plant in Helsinki went from an active industrial site to an abandoned husk, to a repurposed site in about 25 years.
You can mix commercial, medium, high and low density housing without it being nasty. Just because it's multi purpose, does not mean there has to be "factories"