This is an excellent post. I'm now excited about learning OTP. I've seen so many code-quality problems, some of which have destroyed companies, that I'd really love to see if there's a way to solve this problem. "No silver bullet" seems to be the going attitude. Code sucks, it always turns to garbage, and no one reads the shit anymore (that's why we have IDEs! Wheee!) I really want to disagree with this. Readable code shouldn't be a rarity.<p>Apologies in advance for what's going to seem like self-promotion. Many of my opinions I've already plopped onto the internet in my blog so I'm going to be doing a lot of blog linking.<p>Maintenance has a nasty paradox. To do it right, you need political power. You need to be able to say, "I am fixing this and that's that and any problems it causes for you are your problem." The level of political clout you need to do maintenance decently is manager-level. You need help from a lot of people and if you don't have the ability to force them to prioritizing helping you in this gnarly task, they probably won't. (Feature freeze? I need a Bob-ruling before I do that.) In most companies, maintenance is not rewarded, and it's not fun, so people with manager-level clout generally avoid such work. (<a href="http://michaelochurch.wordpress.com/2011/09/23/taxation-without-representation-why-code-maintenance-fails-and-how-to-fix-it/" rel="nofollow">http://michaelochurch.wordpress.com/2011/09/23/taxation-with...</a>) The politically enabled people tend to take the "shiny new" work (and since no one has the clout to oppose them on anything material, they often made bad decisions and produce shoddy results) and the underclasses end up maintaining the garbage after they launch, get promoted, and flee the system. So maintenance ends up being a workball that gets dropped on people who don't have the power to do it right, don't have the expertise to know how to do it, and don't have any good reason to care.<p>People underestimate complexity density and how much it can vary, and also how high it can be in source code. How long does it take to read "a book"? Well, it's between 2 and 400 hours for me, depending on the material. 10,000 lines of code is a book. Sometimes it's boilerplate that you can scan, but more often, it's closer to the 400-hour end of that extreme.<p>IDEs don't solve this problem very well, because they tend toward "four-wheel drive" syndrome: they get you stuck in more inaccessible places. I think <i>read-only</i> IDEs are indispensable, but if I were running a company, I'd be tempted to disallow IDEs for new development. One of the perks of maintenance is that you get to use an IDE. If you're on new development, then as long as the code is good I don't care and you can use whatever tools you want, but if I see you writing obvious "IDE code" I am taking that shit away.<p>One thing that I think is at the root of the problem is a denial about what programming really should be. People say "math is hard", but math is actually <i>easy</i>. At least, it's an only-somewhat-hard way to do things that would otherwise be impossible. Imagine what it would be like to build a physics engine if calculus and linear algebra didn't exist. How would you generalize linear regression to N dimensions without matrix calculus? Quite often, the mathematical abstraction is the simplest (and most terse) way of representing and solving a class of problems. It's hard, because of the <i>intrinsic</i> complexity. Mathematicians are also familiar with the experience of taking a whole day to read and understand a 4-page paper. They know, from painful experience, how much complexity density can exist in 100 innocent-looking lines of code.<p>Why the FactoryFactory crowd exists is that there's a class of programmers who really don't belong in the industry because they despise or can't hack math (and another class of programmers who have the ability but have been misled into thinking that FactoryFactory bullshit is actually the right way to do things). So instead of mathematical abstractions, they use pointless business-y shit made up to turn the tables against smart people with taste. ("What? You've never used a MetaSelectorVisitorSingletonFactoryFactory? And you call yourself a programmer?") Of course, even though the individual pieces that commodity programmers create are less difficult to understand than appropriate mathematical abstractions, the overall tangle that must be generated in order to have a chance at solving the problem becomes incomprehensible quick. But (channeling a commodity programmer) "no one reads code" anyway. What, you expected <i>insight</i> into the problem in that shit? We just wrote that because our bosses told us to do it.<p>At any rate, your insight into the sociological problems associated with code maintenance is right-on. The work is given to the people who are least equipped to do it. So can't companies just allocate maintenance work to the best programmers? The answer is <i>no</i>. First, if the best programmers do maintenance work in a company that doesn't value that stuff, they're seen as just screwing around doing junior-level work. Second, no one good will tolerate being "allocated" to maintenance. Good people will happily maintain <i>code they care about</i>, but if you tell a good programmer that she has to maintain someone else's legacy or find a new job, she'll take the latter. So you need a culture in which good engineers <i>choose</i> maintenance and <i>have the political power</i> to do it right. It's really hard to make that happen.<p>Google is better than the vast majority of companies in this regard, but they still have a culture where it's well understood that promotions usually come from launches. Maintenance is relatively well-respected (by industry standards) at Google, but new invention is still better for your career. You can get promoted on maintenance (which makes Google better than most places) but your odds still aren't as good, and there's more downside to maintenance, where the worst-case outcome is macroscopic non-accomplishment (i.e. you beat your head against a wall and have nothing to show for it). There are large bonuses (sometimes 6- or 7-figures) for people who take on important legacy rescues, which is a step in the right direction-- an acknowledgment that it costs major dough to get anyone good to maintain someone else's mess-- but those usually go to managers and tech leads who oversee the rescue efforts; the engineers are "just doing their job" and usually try to transfer to something with more upside as soon as they can.<p>So the second point about developing a decent maintenance culture is that you need open allocation (<a href="http://michaelochurch.wordpress.com/2012/09/03/tech-companies-open-allocation-is-your-only-real-option/" rel="nofollow">http://michaelochurch.wordpress.com/2012/09/03/tech-companie...</a>). You can't "allocate" good engineers to maintenance. They have to <i>choose</i> it, which means you need an environment where people are encouraged to work on what's important to them and to the company. I've taken to using a 2-by-2 matrix to explain this. First category work is interesting, important stuff: core machine learning algorithms, search at Google. Allocating this work is no problem. Second category is the important but undesired work. Third category is interesting stuff that hasn't become important yet: R&D-type projects best suited for "20% time". Fourth category is unimportant and undesirable work. Important legacy rescues are 2nd-category work. Under open allocation, companies have to create genuine incentives (not just "do it or I'll fire you") for people to do 2nd-category work, and 4th-category work doesn't get done (management isn't willing to pay or promote for it, because it's not actually important). But 4th category work <i>shouldn't</i> be getting done in the first place. It pisses people off and adds minimal business value.<p>By the way, closed-allocation shops generate huge amounts of 4th-category work (often the majority of the workload of a closed-allocation shop is 4th-category). If you have a closed-allocation shop, the 2nd and 4th category work gets glommed together in "that ball of work we (management) allocate to people we dislike" and not done well. This is a mistake; 2nd-category work actually is important (by definition) and shouldn't get the 4th-category treatment. It needs to be done by people who have the ability and actually care.<p>Third subrant, and then I'm done (for now). I don't know what OTP is, but these insights about modularity and small-program methodology are right-on. The Unix philosophy works. The only case I've seen of a program departing from the small-program philosophy and adding value is in the database world. Databases have very stringent requirements related to performance, transactional integrity, durability, and concurrency, and all the pieces have to work together. So, they become large systems that macroscopically function as huge, featureful programs. It has also taken some of the best minds in computer science <i>decades</i> to get this stuff right. Databases are hard, yo. Do you have the best minds in CS on your business-logic codeball? Do you have decades? If no, then avoid big-program methodologies outright.<p>If you use the big-program methodology, your programs end up becoming parochial because their surface area is huge and requirements get barfed on it and the code becomes a pile of political injections, not real software. You end up with Java Shop politics (<a href="http://michaelochurch.wordpress.com/2012/04/13/java-shop-politics/" rel="nofollow">http://michaelochurch.wordpress.com/2012/04/13/java-shop-pol...</a>). However, to be fair, this problem has little to do with Java <i>itself</i> and is more accurately described as a problem afflicting large-program philosophies <i>in general</i>.