A few days back, I wrote this blog post, targetting those who wanted to start programming. I was surprised that someone submitted this to Hacker News and it got a sudden burst of traffic yesterday. I was delighted to see the discussions happen both on Hacker News and in the post's comments. I couldn't stop myself from leaving the discussions open ended. So I thought I should pick some of those comments from HN and the post, and pose them in a way that's quickly readable (like an abstract). I havent' been biased in picking the comments and have picked both critique and those that agree with the post.
"Initially, screw the algorithms and data structures"
Maybe I had to write the word "initially" in all-caps. I know that this kind of advice might sound offending(!) to popular programmers (those who are often called "rockstars"). It is very necessary to understand that not everyone can pickup programming very quickly. Anyone who suggests learning automata, is probably not keeping in mind, that not everyone who wants to learn programming comes from a math/CS background or is just trying to prove that his job of programming is tough.
That's like saying, "Initially, screw the basement and build the attic." The number one problem I've ever seen with shitty code, over and over and over again, is lack of understanding of fundamentals. Do yourself a favor and learn how to build things properly first. Poorly structured data cannot be overcome by the greatest of processes. Poorly structured processes will give you technical debt forever.
- edw519
And a very clear reply by NickPollard which nails it, and explains why he thinks that it helps to stay away from data structures initially,
Sure, if you want to be a good, successful programmer, you need to know your algorithms and data structures, inside out, back to front, whilst underwater being surrounded by sharks. This is far more important than being up-to-date with language X or framework Y.
However (and this is a big however), the letter is targeted at people who are thinking about learning to program, in which case it's important for them to actually achieve something quickly, so that they will be encouraged to continue.
When I started to program (at the grand age of 3), I wrote absolutely terrible programs in BBC-Basic. For years I wrote lines and lines of code without a single function, procedure or subroutine. Even Arrays, lists and such were beyond me.
I didn't care though. I had written stuff that worked. I had created text based adventure games that the computer would play with me. To a young kid, that feeling of power, creativity and success was like a drug, and I was addicted.
If instead, I'd spent ages reading books to work out whether I should be using quicksort or radixsort, or whether my Hashmap would scale well enough, I'd have gotten bored and never written anything, and probably become an accountant.
It is often necessary that the person get a feel of programming by trying it and produce something and get a feel of it rather than spending time reading a fat book of algorithms that'll take a year to read assuming you also have a day job or school to go to. It's not about getting perfect. It's about getting motivated, loving it and coming back to do something more awesomer with your pack of tools.
"Choose a good editor"
IDE's are amazingly helpful for beginners; project-templates, error location, code-completion, debugging options, the list goes on.
- nkerkin
Agree, they are helpful. But you are advising beginners to be dependent on some third-party IDE to use a language, which IMO is not good. The pain shows when you begin to learn a new language in the future. You try to find out if there's an IDE for it and then learn the shortcuts for that too. Instead why not just use a good editor and the same one for every language?
edw519 goes to the other extreme by suggesting that beginners disable the syntax highlighting in the editor they choose and in oinksoft's own words, "This is not endurance training with sand bags on the ankles, and there is no real long-term benefit of having a syntax-unaware editor"
I have to agree with oinksoft about using an editor that comes with syntax highlighting support for many file types is a good choice and that is why I listed Sublime, Vim and Emacs. These are cross platform unlike TextMate, which is also a very good edior but runs only on MacOS X. Just make sure you choose an editor that's cross platform, so that when you change your primary OS, you still won't have to worry about switching to a new editor.
Some suggest that learning Vim or Emacs might be tough since both have their own learning curve. True, but they have their advantages. From experience, the learning curve for Vim is smaller than that of Emacs, where even to indent a few lines you have to type-out a complex key-combo. I have to say that modern games make it easier to do complex combo shots with fewer keystrokes.
"Choose an operating system that'll teach you something"
Other than asking beginners to screw algorithms and data structures, this is probably the second most talked about of what I wrote in the blog post.
mnazim is right that linux is not a requisite to learn programming. There are many who stick to Windows and love the ecosystem. But, I and many around me, are just not comfortable directing new programmers to Windows. You are depending heavily on a proprietary software. When they release a new version of Windows, you would be surprised with changes. Why not just use an operating that is constant when it comes to basic features? Windows offers one way to do things - by the interface. And they improve that every version. The linux command line is constant. Even when your favourite distro's development team releases a new version with grand software to beautify your linux desktop, it's still the same terminal and runs all your commands just like before. More over the development tools on linux are available on-demand. There's no where you have to go to when you have a nice package manager like most linux distros have (Unless you are a latest-and-greatest fanatic like me, I assume you wouldn't be installing a lot of development tools from source). When you want an alternative to some lib* package on your windows environment, you'll have to go hunting for a DLL file (or something like that) and again depend that the software's developers would support Windows just because it's what you run/know.
I also said Macs are cool too. I stand by what I said. Their interface is constant. It is based on BSD and the terminal has a lot in common with linux (enough said!). I would not speak for the other features or problems a Mac has since the most I've tried on a Mac is press a key in someone else's macbook, when they had it next to me (I've seen people using Macs and talk about it religiously as to why it is a good development machine). If you are a kind of guy who believes in using software that is constant and pre-configured to save time, a Mac might be your solution. Besides, you get same tools (vi, emacs, sublime, etc) on Macs too, so you don't have to worry about anything except saving enough money to buy one.
Yes! the OS teaches you a lot. Every command does only one thing, and you can make your procedures/method in programs do just one thing. In unix/linux, commands in the terminal are decoupled. Not too many commands depend on other commands. Each of them are capable of processing input or performing their task independently. And the output of a command can be piped to another command as input. In OO programming, you create classes and you try to be wise like the monk by de-coupling or atleast writing loosely coupled classes, which can later be used together by passing the instance of one to the other. There are a lot of things that you can learn when you observe your surroundings, and your surrounding will now include your operating system too.
So, for those of you who think I was biased or was "bashing" Windows, I wasn't. I just meant it is not the kind of thing a tinkerer should be using. A month ago, I taught my aunt to use Windows because that's what a lot of people around her use. Now she doesn't have to come back to me when she has a problem. She can bother her neighbours, who I'm damn sure, are also using Windows :) But the theory of using what neighbours (or people around in general) use doesn't apply to the tinkerers. Our peer group is vast and uses the internet as a medium to discuss technology and stay connected. We know that if we have a problem, we can ask Google, StackOverflow or IRC. So even if you are using a language like SmallTalk or a do-it-the-hard-way distro like Gentoo, we know we can find help, if we get stuck. My aunt doesn't know about these things and neither will your grandmom.
That said, with the help from some friends from Hacker News, I have justified my statements, about making certain choices (to make it easy in the long-run) for those who want to begin. These are just suggestions. Everyone of us are built different. So what works for you, might be different from what worked for me. And they might be very fine suggestions, so feel free to post or mail me your opinions. I would love to have discussions and I'm always open to change :)
P.S: Excuse me for the typos. I'm typing this just before I sleep, hoping that I converyed my message.