Ayende @ Rahien

It's a girl

You can’t learn the basics from the pros

There was a question recently in the NHibernate mailing list from a guy wanting to learn how to write database agnostic code from the NHibernate source code.

While I suppose that this is possible, I can’t really think of a worst way to learn how to write database agnostic code than reading an OR/M code. The reason for that is quiet simple, an OR/M isn’t just about one thing, it is about doing a lot of things together and bringing them together into a single whole. Yes, most OR/M are database agnostic, but trying to figure out the principles of that from the code base is going to be very hard.

That leads to an even more interesting problem, it is very hard for a beginner to actually learn something useful from a professional. That is true in any field, of course. In software, the problem is that most pros would simply skip whole steps that beginners are thought to be crucial. It isn’t from neglect, it is because they are going through those steps, but not in a conscious level.

Very often, I’ll come up with a design, and when it is only when I need to justify it to someone else that I actually realize the finer points of what have actually gone through my own head (another reason that having a blog is useful).

I think that there is a reason that we have names like code smells, you can immediately sense a problem in a smelly codebase, although it may take you a while to actually articulate it.

Comments

junior programmer
03/12/2010 10:54 AM by
junior programmer

I actually suggest you to blog or teach something basic, the kind of basic stuff that's done right the first time. What I find is that a lot of the time I google around and only find the basic useless stuff that have been written years back with the worst possible way of doing something simple. Because I see myself as a junior programmer sometimes I do find it hard to know what you are trying to say in your blog or the example. So please... some good basic stuff!!! Thanks.

junior programmer
03/12/2010 10:58 AM by
junior programmer

I think one of the good examples of "good basic stuff" is Karl's Foundation of Programming Ebook ( http://codebetter.com/media/p/179694.aspx) however I do think it would be good that he can go into more details as well as some real life code samples.

Steve Bohlen
03/12/2010 01:29 PM by
Steve Bohlen

This is one of the reasons that (effective) teaching is considered so hard: you have to know a thing VERY well in order to be able to teach it to others.

But to then effectively confer that knowledge to a student requires the teacher to remember aaaaaall the way back to when they too were a student and to 'unlearn' all the assumptions that they now make (to your point, those steps the professional has simply internalized such that they are doing them on a subconscious level now).

The greater the gap between teacher and student, the further the teacher must stretch themselves to recognize all the assumptions they cannot safely make about the student's knowledge.

Not only can't you learn basics from the pros, but its the vast minority of pros that can effectively teach anything to someone about the basics too :)

Great post!

cbp
03/12/2010 01:46 PM by
cbp

Yes, I've come to realise that good effective teaching requires as much discipline as effective programming.

You can learn the basic from a professional - a professional teacher.

Ajai Shankar
03/12/2010 02:36 PM by
Ajai Shankar

It is very hard for a beginner to actually learn something useful from a pro; it is even harder for a "pro" to learn something useful from another pro.

Reason 1: just as you said pros have most of the design already very well defined in their mind, and lots of them are really bad at articulating them.

Reason 2: Lots of programmers acquire so much ego over the years, that either they feel insecure/insulted having to justify their designs to others, or they tend to treat anything they did not write as "crap"

The trick is in being humble, giving benefit of doubt to existing code, and trying to understand the constraints in which it was written, capture the essence and spirit of it; then things just fall into place.

I feel I learn so much more when going through a relatively hard undocumented codebase because at the end of the exercise you would not have understood it all, but you come out all the better at having attempted it.

Best way to learn? Google for knowledge, Reflector for wisdom :-)

Ajai

Jim Jones
03/12/2010 03:53 PM by
Jim Jones

@Steve - I would say you're correct in that this is all about the assumptions that the pro makes, probably unconsciously, but a true pro would realize those assumptions exist. What better way to ensure you know them than to try to teach it to someone else?

tobi
03/12/2010 04:57 PM by
tobi

Sometimes it is quite a surprise for other humans that people like us can do that complex stuff easily while being hard pressed to express our reasoning.

Scott Muc
03/13/2010 05:41 PM by
Scott Muc

This is why understanding the Dreyfus Competency model is so important for teaching:

http://en.wikipedia.org/wiki/Competence_(human_resources)

An expert cannot discuss things with a novice in the same terms. A novice needs to follow a checklist. I'm currently dealing with this while I try to learn ruby on rails. In .Net I just wrote code without thinking (I would say I'm at the Practitioner level) whereas with RoR, I need follow step by step guides to get me started.

Steve Bohlen
03/13/2010 06:14 PM by
Steve Bohlen

@Jim Jones:

1000x agree with that -- which is probably one of the reasons that I enjoy trying to teach things to people; rewinding the clock on your own expertise and watching someone else follow a similar path as yourself helps illuminate the thought process you've long ago relegated to your subconscious in some really interesting ways -- and offers great opportunities for you to re-evaluate your subconscious assumptions too!

@Scott Muc:

Too true; the Dreyfus Model strikes again -- curse that damned thing for its constant applicability to teaching and learning! :)

David Cuccia
03/14/2010 06:33 AM by
David Cuccia

Lots of "good basic stuff" out there from pros - new favorite is TekPub.com. Rob Conery's so pro he can remember how to think as a novice.

Comments have been closed on this topic.