The book Software Engineering at Google goes into this (all factors of programming at scale / over time), worth a read.