Discussions on the open letter to those who want to start programming

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.

- NickPollard

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.

Posted
 

An open letter to those who want to start programming

First off, welcome to the fraternity. There aren’t too many people who want to create stuff and solve problems. You are a hacker. You are one of those who wants to do something interesting.

“When you don’t create things, you become defined by your tastes rather than ability."

– WhyTheLuckyStiff

Take the words below with a pinch of salt. All these come from me – a bag-and-tag programmer. I love to get things working, rather than sit at something and over-optimize it.

Start creating something just for fun. That’s a great start! There’s no way you will start if you say you “need to learn before doing”. Everybody’s got to start somewhere. Fire up your editor and start writing code.

Here’s something important which people might call bad advice, but I’m sure you’ll stand by me when I’m finished saying why. Initially, screw the algorithms and data structures. They do not have generic use-cases in most simple applications. You can learn them later when you need them. Over a period of time, you’ll know what to apply in situations. Knowing their names and what they do would suffice to be able to pick some paper, dust it and implement it. And that is… if no library (other programmers' re-usable code) is available, to do it in the programming language of your choice.

Choose a good language. One that you think you can produce something useful in short time.

So let C not be your first language. That might give you the satisfaction of doing things the really old-n-geeky way. C was the solution to the problem Assembly Language was. It offers better syntactic sugar than it’s prominent predecessor – Assemble Language. But today, C (or C++) is not a language that you can produce something very quickly. I would suggest that you use a dynamic language – I won’t sideline any options. Choose a language whose syntax (and documentation) you think you might be comfortable with. For this, you might want to spend some time trying out different languages for a few hours. The purpose of choosing such a language is not to make you feel better and that programming is easy. Completing stuff faster and being able to see the output keeps you motivated. Don’t choose a language that requires a special heavy-weight IDE (tool that helps you write code and run it) to program better in the language. All you should need is a text editor.

Choose a good editor.

An editor is to a programmer, like how a bow is to an archer. Here are some editors to get started with…

  • SublimeText 2 – recommended if you are just starting.
  • Emacs – huge learning curve. Complex key shortcuts. And to be able to customize it, you’ll need to learn Emacs Lisp.
  • Vim – used by many for it’s simplicity and the fact that it comes with linux distros by default. I used Emacs for 2yrs and then switched to Vim to run away from emacs’s complex key strokes and when my little finger on both hands started hurting. Knowing vim keystrokes is a must. When you work remotely and try to type out code on some server from your computer, you’ll know that the only editor available from the command line without any installs, is Vim.

Watchout! Emacs and Vim might be really old. But they both have some features which even most modern editors don’t have.

Use an operating system that’ll teach you something.

Windows won’t teach you anything. The only thing you learn using Windows is to click the .exe file to install the software and use it. It may seem cool in the beginning, but in the long run when you have to deploy applications, especially if you are aspiring to be a web developer, you’ll need atleast basic knowledge of linux. Linux also allows you to customize stuff the way you need them to be. Macs are cool too, but I assume that you cannot afford one of those now.

Don’t copy-paste files to backup stuff.

It’s usual among amateur programmers to copy-paste files to some temporary directory in order to backup them. That’s the only way they seem to know. Stop that! Use a version control software. I strongly suggest Git, since it’s popular and easy to use. It has nice community and resources to support new-comers. (Apart from Git, There’s mercurial, darcs, fossil, etc. But just start with Git. I’m not going to bother you with the reasons for suggesting Git).

Know where to get help.

Join a community that you can relate to (with the tools you use). StackOverflow is Facebook for programmers. There are no status messages and comments. Instead there are questions and answers. Also learn to use the IRC. It’s an old form of chatrooms and is now being used by mostly developers to share information and helping each other.

Develop your netiquette.

Know when to ask questions. Most problems you face might have been stumbled upon by others who might have already posted on the internet for answers. Before asking on IRC or any forums, google first (or should I say blekko first) to see if there’s already a solution to your problem. IRC needs patience. Remember people are helping you for free out of goodwill. Sometimes it might take hours, for someone in the chatroom to respond to you. So wait until they do. Besides, be polite. It's a small world. Karma, good or bad, comes back.

Meet people, because books only teach you routine stuff (oh and the "book" is dead they say).

There are some street smarts that you’ll learn when you tinker with stuff or learn from those who do it. Roam, meet people and say hello. You are not the only programmer in your place. Make friends and do stuff with them. If you've noticed, when a couple geeks get together, whatever the starting point of the conversation be, it always ends up getting technical. It's bound to happen. Enjoy it. Programming for a good number of years, I can tell you that I learnt nothing more than what the books and articles said, until I starting meeting people and getting technical with them 6yrs back. So I always say that I’ve been programming for 6yrs, because that’s when I started meeting people and feel I really started to learn.

Write opensource code.

Writing opensource code is giving back. It’s much more than charity. You are leaving code that others can use and improve on (maybe) for years to come. It also helps you refine your skills when someone else adds to your code or suggests changes. Code that you opensource doesn't have to be big. It can even be a useful little program that downloads youtube videos. Moreover, you’ll be surprised, that your code will often help you start and have interesting conversations with people.

Lastly, when years pass, return this favour, by writing a similar letter to someone else who asks you for such help. And possibily correct me.

--
For a hacker, by a hacker
Akash Manohar

P.S: Wise men say, it takes 10 years or 10000 hours to get good at something. So don’t hurry.

Posted