Reading Code is Key to Writing Good Code
stevenharman.net
stevenharman.net
Sure, you might look at other code in your (probably enormous) project. And if you can swing it, you might be able to look at another group's code. But in general you can't go look at, say, random third party open-sourced code similar to what you're working on, or even better, random code that has nothing to do with what you're working on. (The license, viral or not, usually has no effect on the prohibition.)
There are aspects of serendipity, and of feeling recharged by feeling connected to the greater constellation of developers and projects in the world, and those aspects are stripped away here. I wonder if the Microsoft "culture" attracts people who don't care about reading others' code, or if it creates those kinds of people.
I read code when I've to modify it, or when I'm really curious about how something is working, or when I searched for bugs back in my "security researcher" past life. But it was either needed or fun. To read code as an exercise can be pretty boring I guess, this is not what programming should look like.
I can't see how there is so much value in reading a big codebase that expresses more or less the same style and patterns in many places. Maybe it's better to check for some interesting code in different projects. I bet that reading SICP or an algorithms book and to code a lot is a much better way to spend your time.
A good approach IMHO is to try to write some non trivial code, for instance an interpreter for a simple programming language, and if you have problems try to check what other code looks like and how it address the same problems you are facing. Then it will no longer be a pain to read parts of the implementation of Ruby or Python or Tcl, since you are discovering very interesting things, solutions to problems you encountered.
Another thing that's worth a lot more your time is to learn new programming languages. But there is no point in learning Python if you know Ruby, or the contrary. You should try to learn languages that are really different. For instance SmallTalk, FORTH, Lisp, C, Assembler, Haskell, Joy, Ruby, Tcl are different enough.
And there are plenty of reasons to believe otherwise. For one, extensively reading code is rare among coders. All good poets are very well-read in poetry, but there are many good programmers who rarely read code other than what they intend to modify, or as documentation.
Also, unlike a poem, a unit of code (say, a function) has a very well-defined goal. Coders don't need to develop an elaborate aesthetic sensitivity to judge whether their work passes their goals - unit tests and benchmarks will do just fine.
Nor do coders need to read code in order to learn about clever coding techniques. Partly, this is because code, unlike poetry, contains very few clever things per line. Partly, because there are simply better ways to get such information: books, blogs, articles, HN, proggit, stackoverflow, and so on.
It may well be that reading code is very helpful in becoming a better programmer. But I'd like to see some evidence first.
It's the feedback loop to improvement.
>> " Coders don't need to develop an elaborate aesthetic sensitivity to judge whether their work passes their goals - unit tests and benchmarks will do just fine."
If your goal is "It works", then sure. But some of us aspire to something more than that.
This is about whether it makes sense to pick an open source project and start reading.
People using IDEs for a start, code folding, hiding from the cruft.
Lua is said to have a nice code base, djbdns is probably the most bug free code ever written and TeX is also legendary.
Despite this, some in the Lean camp are still trying to pretend that we can use an industrial metaphor to produce software. Why? Because just like in the 1960's that's what the Management classes want to hear :)
I wonder if that's really true...
In reality, of course, programming is not like manufacturing at all. It's more like creative writing, or painting, or composing. It's difficult to tell how long something will take, what problems you might face along the way, etc. Business people typically do not understand this; getting an MBA will usually teach you about organization, supply, resources, large teams, and other things that are irrelevant for software development (not to mention business connections along the way, which is just as important.)
But software is clearly necessary if you're going to be competitive in almost any field, which is why programmers are needed. Business people usually don't like you; you're just a necessary evil. They'd rather not have to deal with programmers at all. They would rather buy some software package that comes in a carton. A person who works on something all day that they can't understand and can't easily measure the productivity of scares them. "Why are these programmers all so fiddly? Can't they just do their work like everyone else?"
This is one of the reasons most corporate software sucks.
(I've never worked for any extended period in a large corporate/enterprise environment, thank god, this is just the general story I hear from people who have.)
I had a co-worker say this to me last week - "I just feel like [our manager] treats people like resources, batteries if you will."
He complains a lot and his department transfer is going poorly, but I couldn't help but agree with him here.
To say that its creative writing, painting, or composing is frankly dead on. I don't have to convince our audience here that is true, especially anyone who has seen a truly elegant solution to a problem.
Corporate software definitely sucks as a rule, I believe, because the passion and motivation for excellence has been sucked out of them. I was discussing design philosophy (as related to a structure/organization question) with my technical team lead and he said something to the effect of (not far from verbatim), "Yeah, I'm not really passionate about [design philosophy], I usually follow whats there."
This is a guy that supposed to be leading a group of developers. Over a year and a half I have determined that taking a diplomatic approach to design and programming issues isn't always the best solution. It leads to disconnected and mangled code.
Apple is different in this regard because the CEO was, and at heart (hopefully), still is a programmer (despite app store mayhem - everyone makes mistakes). The market has noticed and felt the difference. (Also notice how Apple doesn't do a lot - if any - corporate level development.)
I agree with your stance completely and am willing to make the bold statement that the only person that should lead an organization that produces software as a direct product for consumers should be someone that has developed before and still has the passion about the art.
(Edit: a quick side note to all of this - I have friends that are in the Silicon Valley area and quit IBM way before I contemplated it. At first I thought they were whiny because they didn't get to write python code but what it comes down to is they understood and accepted the fundamental breakdown between organizational behavior and the art of computer science.)
It's why I left. The alternatives were: start my own thing, or get out of the industry. Of course now I wonder why it took me so long. One reason is the time I spent wishfully thinking that the problem could be addressed by agile processes and "organizational change" (the latter being a genuine fiction as far as I can tell) before concluding that they were incapable of delivering even the minimum I needed not to go crazy.