Every app has a scary basement—dark old mysterious code vital to its operation
miksovsky.blogs.com
miksovsky.blogs.com
Here's a recipe that may help you get started on your adventure:
1. Work incrementally. Never try to fix the whole program at once. Overhauling the whole program inevitably introduces lots of disruption for users and delays the addition of new features. This will not be appreciated.
2. Make sure you have tests. Lots and lots of tests. Any time you touch a module, write some tests for that module.
3. Build better module boundaries. This can be a mechanical process. For example, to separate disk I/O code out of a checkout register, declare a RegisterIO class. Every time the GUI code touches the disk, add a new method to the RegisterIO class and move the code there. You'll wind up with a _really_ ugly RegisterIO class containing a lot of ad hoc IO functions. But the RegisterIO class will improve with time.
4. Reimplement small modules one at a time. You may want to run the old and new versions of a module in parallel for a while (I once had a program with two different text rendering subsystems), or run the same unit tests against both the old the new module.
Eight years of work later, you'll have a reasonably shiny new program with some odd architectural decisions and a really ancient logging subsystem.:-) But at least you will have been shipping new versions and earning revenue every step of the way.
This paragraph is hilarious and horrifying all rolled into one. That is not my idea of a fun project.
http://news.ycombinator.com/item?id=85587
If the name seems familiar, well, it's either because you bleed yellow or you've heard of CouchDB.
I did say "potential". :-) And the same lesson definitely applies beyond the need to separate UI concerns, but that issue seems to get the tangliest the fastest.
To get the most performance out of the PCs of the day, I believe he had the register itself more or less directly read and write transaction data from disk.
He's implying that the normal view/business logic separation wasn't fast enough.
Kind of like perltidy, but much more aggressive, pruning and re-arranging and re-writing bits as needed.
On the one hand, in theory a computer could never do it as well as a human, and we should learn to code properly. On the other hand, it's a very common problem, and computers are supposed to be time-saving devices above anything else.
Perlcritic is closer to what you're thinking of; it examines the structure of the code and points out design and implementation problems. It can't fix them for you though, and it only handles common designs that it knows about. It can't judge the quality of a design that it's not already programmed to recognize. Again, a useful tool for fixing all of the common problems, but it can't address the overall design.
The refactoring tools in IDEs like Visual Studio are useful too, but they don't understand your code in a way that would help redesign it. They just automate much of the process of extracting code from one method to another method/class. Useful, but not redesigning your code for you.
Ultimately, it takes an intelligent software designer to do this kind of work. Maybe artificial intelligence will handle it some day, but that's not coming for a while.
I don't buy this excuse. It just sounds like bad code to me.
So this is a program that has to run with reasonable performance on a 12MHz 80286 with 2MB of RAM. Are you sure you wouldn't consider having your UI read and write the disk directly? Separation of concerns is a modern luxury. And remember, you're using compilers from 1990, too. Don't expect great inlining. (Besides, only profligate memory spendthrifts would inline a function.)
(Edit, later followup: In fact, "separation of concerns" is one of the major sources of the "bloat" people complain about when they examine modern OSes. Much of the "non-bloated-ness" of earlier generations of OS doesn't come from programmers caring more about their craft, it comes from programmers having to stuff programs into things that can barely hold them and building "clever things" that we would today consider monstrosities like UI widgets that read and write directly to the disk. I am unsympathetic to accusations that, say, a modern KDE desktop is "bloated".)
My favorite monstrosity was the http://en.wikipedia.org/wiki/Overlay_(programming). When your OS couldn't page functions from disk for you, you damn well did it yourself. They even started building it into linkers....
Um, what is your source for that assertion? From where I'm standing, separation of concerns is a technique which favorises the re-use of code, and hence the reduction of bloat.
In my opinion, you're totally correct. This is part of the reason I'm not very sympathetic to the bloat argument. The megabytes of libraries are there for good reasons.
I wrote code for those machines, and no, I wouldn't write my UI code to read and write the disk directly.
"Separation of concerns is a modern luxury."
This is a myth. Merely an excuse for poor API design. Proper abstraction doesn't mean inefficiency.
Your last paragraph (the "Edit") is almost offensive. The cause of bloat is not separation of concerns. It's that people just don't care about writing efficient code (or they just don't know how). Did you ever write code in the era you speak of? Because your statement comes across as ill-informed conjecture.
Another appropriate term is "Happy Fun Ball" (google it)