|
Re: Programming with "Duh" Typing
|
Posted: Jul 7, 2007 11:27 PM
|
|
> Agree to disagree?
Fair enough. :-)
Back to the original topic, I hereby reject the premise of this blog, which is that typing things twice makes you much less productive.
Just how much time do you spend typing? Compared to designing, thinking about patterns, developing APIs, looking up other APIs, asking marketing what they want, looking at log messages to track down a bug, etc. I claim that actual time spent typing is very small, maybe 5%. So, even if every line of code was a List declaration, and you never used the IDE to help, at worst, all you lose is 5%. In reality, it's much less than that, it's minuscule. Typing things twice cannot have a big negative effect on productivity.
If actual time spent typing were significant, we'd all go to typing schools to earn a big raise.
Next, I'd argue that typing things twice can make you more productive. A good carpenter measures twice, and cuts once. Is he less productive?
Think of typing
List foo = new ArrayList();
As two chances to think about your code. As "pair programming with Java". You are reminded to think about the left side, which should be an interface. And is this a List or a Set? Is there an order, can an element appear twice, think!. Maybe it's a Map!
On the right side, you can get more detailed. Should this thing be immutable? Thread safe? How often will I be inserting elements? If there is a natural order of elements, what is it?
By encouraging the programmer to think, twice, about what they are doing, Java can make them more productive. Whether the programmer takes advantage is up to them... :-)
|
|