NOTE: This is very much a work in progress. I am pretty certain I will have quite a bit to say on this topic. I have been acutely aware productivity is very important to our success as developers. I hope to share what I learn to help your own productivity.
Developer Productivity
We probably have all seen the monster coders - the guys that use brute force and high velocity to crank out lots of code. I'm not sure how good the code is in all cases, but I admire the ferocity. In engineering school, there were at least two ways to describe a solution to a problem. There was the brute force approach and then there was the elegant approach. The brute force approach would be four pages of hand-written calculations with the last line being the correct answer. It would often take hours and it would often be a landmine of potential errors. If you were careful, you got the correct result. Then in class, the professor would use some arcane mathematical identity and transform the problem into a problem that could be solved in two steps. Our response was, okay so you're a PhD! But the point is there is often an easy, elegant way to solve a problem and a multitude of ugly ways. I think of coding as doing tax returns. Give the same data to 10 CPAs and you'll get 10 different tax returns. Developers given the same problem will have slightly different solutions in most cases. In some cases, the solutions may be very different. If you look at all the solutions, there may well be one solution that is better than the rest.
Anyway, we are interested in elegant solutions - not for the academic reasons, but for the simple reason that it will be less code to write and less code to maintain. And hopefully easier to comprehend.
As an engineer, I like to model with mathematics or equations. Why? Because it is another way to look at something and you just might get a bright idea from it. Ultimately, we want to shorten the time to market, i.e., the time from the idea of a product to the actual product. So here is the basic equation:
Time to market = time to develop + time to test
The incorrect thing to do is to short change "time to test" because the product quality goes down, customers are dissatisfied, reputations get damaged, etc. Testing is one of those things that "takes as long as it takes" - sort of. There are of course testing methodologies, and I'll get into this later. So we can shorten time to test, but we should do it by using correct testing methodologies, not by simply shortening the test.
So that leaves us "time to develop" as the area where we can get the gains. In fact, a good job in this phase will make the testing phase go smoother. Again, we don't shorten development time by executive decree. We shorten it by implementing best practices in our software development process. Training is very much a vital part of implementing best practices. There is a lot to know in software development. It's done one thing at a time. As far as best practices goes, there is one test you can do in a few minutes that will give you some clue as to where you or your organization stands. It is called the Joel Test. These are 12 points that you should be living with daily and if you are not, you will struggle to some degree with productivity. Now I don't agree 100% with Joel on the test, but that's for another post. It still is a very good test and probably the easiest and best test you can do. You can use it as a debugging checklist to find areas where you don't measure up.
Development Time
Another thing you can do with equations is "drill down" and find out what each term is really comprised of and so learn more about it. Development time could be expressed as its own equation:
Development time = time to develop new code + time to reuse existing code
Well-tested, well-written code that can be reused will take much less time to implement than writing from scratch. If it is robust, it will greatly reduce the amount of time needed in the testing phase. Now reusing existing code can be done by "cut-and-paste inheritance" or by using code in libraries, class libraries, DLLs, etc. If it's already written, it can save you a lot of time.
Let's drill down some more:
Time to develop new code = auto-generated code + hand-written code
Now we have new code being written that is generated by some code generation mechanism. Then we have hand-written code. There will always be some hand-written code in any project. This can be reduced a great deal, especially with some bright ideas. But hand-written code is the albatross - it is the one area that is going to take the longest to do. It will be an area of likely bugs so will need the most testing. The more you can reduce the amount of hand-written code, the faster your application will see the marketplace.
So how much can hand-written code be reduced? Well my feeling is there is a theoretical limit to the amount of new code that absolutely must be written. And that is our goal. This amount willdiffer from application to application. But it should be a very small amount when the application is designed well and designed with productivity in mind. Hand-written code should be those areas where the new application is appreciably different than other applications. That is, the amount of hand-written code should be absolutely unique and not at all similar to anything written.
You see, something is either identical, similar or different. If it is identical, it can be reused. That's easy. If it is similar, it can also be reused, though it is more difficult to do so, at least on the surface. If it is truly different, then it's time to roll up your sleeves and get busy.