Playing With Blocks

Published on

I recently read an article that suggests pointing new programmers to Python and avoiding object oriented programming for as long as possible. While I think I understand the idea of trying to get a newbie's feet wet and not wanting to scare them off from the big bad beast that programming can be, I think this is the absolutely wrong way to go.

Inner Child

100% of children played with blocks as a young child. Building with Lego bricks and K'nex is a staple of childhood. Constructing something new from component parts is something so fundamental to human nature it can't, and shouldn't, be ignored. Especially for those starting out in programming.

Chances are that anyone trying to learn how to program will get this intuitive model out of the gate. Objects represent things. Methods represent actions. These things make sense to people.

Snake Bite

I've been accused of being a hater, but I do not like Python. I just don't like using it. I'm a C# .NET kind of man. You shouldn't start a new programmer out on Python. But here's the kicker: you shouldn't start them out on C# either.

Python and C# tend to be framework-centric rather than focusing on the nitty gritty of controlling a computer. Believe it or not, a good programmer needs to have a good understanding of what is happening under the hood when they write code. The code you write isn't magic. It will eventually be turned into electrical signals that interact with a physical entity. We have compilers for taking higher level code and converting it to the very low level signals, but knowing the connection is crucial for writing good code.

That's why I recommend C for beginning programmers. I feel that C, while not as close to the metal as Assembly, is abstracted enough as to not induce an immediate repulsion from a newbie, but close enough to get a feel for what is going on when a program runs. Plus, it's a right of passage to cause an overflow through a malformed printf().

Abstractions

Don't get me wrong, functional programming is a great tool and absolutely the right choice for many problems we experience in computer science. One of my favorite frameworks, LINQ, is essentially functional programming for the .NET languages.

That being said, I don't think overly abstracting early on in learning how to program is a great idea. I suppose you could argue that OOP is itself an abstraction, which is true, but a much more visceral, gut level abstraction. Chances are that unless you have a background in set theory or statistics, you're not going to look at a functional language and immediately see the Matrix.

Start At The Beginning

I guess what I'm getting at is don't try to start a new programmer on whatever your favorite language/framework of the moment is. It's easy to forget the valuable lessons you learn when you're working at a lower level once you've mastered certain principals that have let you advance to some of the more powerful frameworks out there. Use Python all you want (though I'd prefer you use C#), just don't try to start someone out on it.