Hacker News new | past | comments | ask | show | jobs | submit login
How I Learned to Program (rdegges.com)
171 points by b14ck on Feb 4, 2012 | hide | past | favorite | 73 comments



The one point I really disagree on is Linux.

Sure learning Linux will most likely teach you something about the platform on which anything you write will probably be deployed but that's really marginal (IMHO).

You get things done (programming included) by getting all the roadblocks out of your way. Linux is (IMHO) a roadblock. The OP claims it teaches you researching skills by giving you problems everyday you need to find solutions for. This is true in the same way that refusing to buy food of any kind teaches self-sufficiency.

To get things done you need to get in the zone. This means eliminating distractions. Trying to figure out why copy and paste doesn't work (and it turns out that it's because you're using OpenJDK instead of the Sun JDK) very much takes you out of that zone and then wastes time to boot.

This might be more useful later on (maybe) but learning to programming? No way.

To me, the best development platform is OSX. Why? Because it's (BSD) UNIX that is a pleasure to use that (mostly) doesn't have the aforementioned problems. My only real beef is that if you're used to using a program on Linux or Windows the keyboard shortcuts will generally be different on OSX (due to following the OSX conventions).

And as much as people (myself included) like to rag on Windows (in my case: the complexity), the fact is that modern Windows (Win7) is actually a pretty pleasant experience. Some things (eg git) suck but Cygwin can ameliorate a lot of those problems.


I didn't start to really understand how things all work and go together until I installed Linux on my desktop, and started exploring that world. I don't disagree with using OSX, in fact I use a Mac to do all my work now. But I never got started or interested or developed an understanding until I started using linux. Linux almost forces you to learn the underworkings of your system, computing in general, and loves to make you do work in the terminal. All good for learning programming.

I used to have a jokes tab on my iGoogle page, one day the joke of the day was: "If you want you computer to work, use a mac, if you want to know how you computer works, use linux, and if you don't want to know why your computer doesn't work, use windows." I thought it was funny, and it was a step in my inspiration to use Linux.

One analogy I'll make to promote learning on Linux: When I started playing guitar, any experienced player or teacher will tell you to learn on an acoustic guitar. Why? It's more challenging to make it sound good, you have to press harder on the strings, The strings are further away from the frets, you get buzz and damping if you don't use just the right form. It teaches you to over learn, then when you switch to an electric, it's easy peasy, and just sounds sooo good. I think in this case you could consider Linux to be the acoustic guitar, and Mac to be an electric. Just my two cents.


"I think in this case you could consider Linux to be the acoustic guitar, and Mac to be an electric."

Does this make Windows the double-necked bass?


Keytar.


To my taste, Linux puts a lot less roadblocks in my way than MacOS does. Maybe my complaints that follow are simply due to my ignorance, in which case I hope you will take the time to correct me, but as far as I know they're real roadblocks.

I want to see the source to the ls command? dpkg -S /bin/ls; apt-get source coreutils. I have no idea how to do that on MacOS. I want to be able to compile it? apt-get build-dep coreutils, which IIRC will install the compiler. The equivalent on MacOS involves signing up for a developer account with Apple, signing a contract that promises God knows what, and downloading a multi-gigabyte disk image. Even after installing, gcc still isn't in your PATH, and won't work properly with the platform SDK without a verbose -isysroot option. I want to make executable the file named gooba somewhere under my current directory? chmod +x $(find -name gooba). Apple's find requires an explicit `.` and maybe an explicit `-print`, I don't remember. Got performance problems on your machine? On Linux you have htop, dstat, iotop, powertop, and latencytop, none of which have MacOS equivalents as far as I know. Even plain old top has keystroke commands to switch between sorting by CPU and sorting by resident set size. As far as I can tell, doing that on MacOS requires restarting top with different command-line options. And there's no package-management system, so if you're building a server-based app, good luck installing the same versions of the same libraries on the server that you tested against in development. Or on your new dev box. And the server's probably running Linux anyway. Also, where the fuck is strace? Dtruss is a fucking piece of shit.

Admittedly XCode is a pretty nice IDE, but there are a lot of nice IDEs out there, and most of them run on Linux too. And I'd love to have dtrace on Linux.


If I had to choose between a pretty and easy to use OS (that lets me write programs in peace and not have to manually fix everything from Terminal), and the ability to manipulate my OS's "ls" command, I'd choose the pretty OS every day. I wish we could have both, but now that we have to choose, that's my decision.

But that aside, I'm not sure about the rest of your complaints. I just created couple new folders and 5-6 files named gooba and gooba2 and typed 'chmod +x $(find . -name gooba)' and everything worked (gooba's are executable and gooba2's are not). I don't think that extra dot is that bad and I actually like it better (it's more logical).

Also, you can install package managers such as: MacPorts[1] or Homebrew[2] or Fink[3] (I prefer Homebrew). Then you can install htop, iotop, ftop, and a million other unix apps.

in 'top', if you press 'o' (order), and then 'cpu', it sorts them by CPU usage. You can even set a secondary key by pressing 'O'. And you can always "alias top='top -o cpu'" in your .aliases.

[1] http://www.macports.org/ports.php

[2] https://github.com/mxcl/homebrew

[3] http://www.finkproject.org/


> If I had to choose between a pretty and easy to use OS (that lets me write programs in peace and not have to manually fix everything from Terminal), and the ability to manipulate my OS's "ls" command, I'd choose the pretty OS every day. I wish we could have both

Fortunately, you can: just use a current Debian on well-supported hardware. (Until a year ago I would have recommended Ubuntu.)

> I don't think that extra dot is that bad

There are a zillion things like that in MacOS that are just that little bit harder to use, for no good reason. Requiring five extra keystrokes in `top` to get an actual list of the top processes is another example. You can come up with justifications for why the roadblocks are there, or rationalize that they're not that bad, but they really add up.it

It's like Apple's vaunted relentless focus on user experience just doesn't extend to programmers.

> Also, you can install package managers such as: MacPorts[1] or Homebrew[2] or Fink[3] (I prefer Homebrew). Then you can install htop, iotop, ftop, and a million other unix apps.

If you're comparing MacPorts, Homebrew, and Fink to Debian or Ubuntu, I think you haven't used Debian or Ubuntu. I didn't realize iotop and htop had already been ported to MacOS, though. That's cool. Thanks for letting me know. Powertop, latencytop, strace, and dstat no, though, I guess?


I use htop on my macbook, that said it dual boots to #! linux. I honestly work in OSX more often than my linux environment, but installing Gentoo on an old PC when I was 15 really gave me the foundational understanding of computers I have today. Doing it again and again on various machines has improved that. I would like to work in my linux environment more (besides on my server that is), but I use OSX because there are a lot of convenience applications that make web development a cinch. Plus with homebrew I can get most cli stuff I need with out any problem.


You go to

http://www.opensource.apple.com/release/mac-os-x-1072/

or use wget or curl to download the source for what ever you are interested in.


I probably don't have to point out to most readers that this is a lot more work than `apt-get source coreutils; apt-get build-dep coreutils`.


Yes, it is. But on the other hand it is more discoverable. All I had to do is type "mac os x source code" in google search. It is a little harder to find out about apt-get source coreutils.

First of all you need to know about apt-get. Then you need to know that ls lives in coreutils etc.


You don't need to know that ls lives in coreutils; dpkg -S /bin/ls tells you that, although it is true that you have to learn a little bit about how dpkg and apt work to get to that point. You do need to know what package ls lives in to figure out which tarball to download from Apple's web site.



I'm not sure what you mean by that. Maybe you're trying to say that, yes, there are a hell of a lot of serious roadblocks?


He's responding to your first comment

I want to see the source to the ls command? ... I have no idea how to do that on MacOS.

The rest have been addressed, but as for this:

The equivalent on MacOS involves signing up for a developer account with Apple, signing a contract that promises God knows what, and downloading a multi-gigabyte disk image.

It involves running an installer from your install disc, or, admittedly, in the case of the most recent release, downloading a multi-gigabyte disk image from the app store. You don't need a developer account if you just want to install the software.


So the answer to "How do I find the source to the ls command?" is "click around a web site perusing long lists of packages, trying one after another in an effort to figure out which one the ls command is from, then manually download nine files one by one from http://opensource.apple.com/source/file_cmds/file_cmds-212/l...? Is that a fucking joke? If that's your idea of fun, go ahead, but I have a computer to do that kind of thing for me. I have an operating system with package management, not a hobby.

> You don't need a developer account if you just want to install the software.

Perhaps this has changed since the last time I did it, a couple of years ago; it did then.


(On further examination, a few clicks on the Back button get me to a place where there's an image that links to a tarball of file_cmds!)


I'd say that the main advantage of Linux here is that it helps get you started; it's really easy to make a quick CLI tool, usually in the form of a shell, perl or python script, that is useful -- scratching an itch. This applies quite well to Mac OS, of course, but to run Mac OS you'll need a Mac...


You can also write python and powershell scripts in windows.


Of course, but from my experience opening a CLI is completely unnatural to Windows users, much more than even Mac users.


And most Windows aren't developers. The fact that linux has a CLI isn't a particularly compelling reason not to use Windows though, since Windows also does.


You are not seriously comparing CMD.EXE with gnome-terminal and bash, are you? Come on.


It's a cultural difference and nothing more. On Linux, opening a CLI is something natural and common, something that every user does at times. Hence writing a quick CLI script seems more natural than on windows.


For someone who already has a Windows machine (still the majority, I believe) you just replaced one roadblock with another. One is technical and the other is financial (buying a Mac).

Really, Norvig sums this up best: "When asked "what operating system should I use, Windows, Unix, or Mac?", my answer is usually: "use whatever your friends use." "

(I use a Mac and think it's swell, but I definitely couldn't have shelled out for one as a high schooler learning to program, but could burn a weekend dual booting Linux)


> you just replaced one roadblock with another. One is technical and the other is financial (buying a Mac)

I think you hit on an important point. Most people seem to be approaching this from an adult / professional perspective. I'm thinking of the bright 14-year-old kid who wants to learn about computers. He (or his parents) may not be able to afford a $2000 Macbook, but he could build his own box relatively cheaply and put a free operating system on it. Linux is democratizing that way. And he can download the source code to virtually everything running on that box. That has undoubtedly inspired a few programmers.


I fully agree, since I am one such programmer.

You cannot imagine how beneficial Linux has been in making it possible for students from countries like India to learn deeply and experiment with their systems.


Fwiw, in my own experience, I learned more about how computers and computing work from the first year of exclusively using Linux than from a decade of using Windows. Windows is designed from scratch to hide all that and abstract it into a GUI.

Linux both forces you to figure stuff out, and enables you to, which in my case also motivated me to.

I don't know how that would have worked out had I been using OS X instead of Linux though, maybe the same since it's BSD-based. But I suspect Linux may be the only one where you can feel full ownership over your own system, and can be motivated by the knowledge that if you take the time and effort to figure it out, you can make it do anything you want to.

That personal, emotional investment I believe is the most important, rewarding, and incentivizing aspect of learning computers, computing, programming, and/or CS.


Windows is also designed to make you start paying to get at details. And keep paying. If you are e.g. a youngster, or a "this should be automated" worker who doesn't have any tech budget, this can be a significant hindrance. (Yes, I know there are now various MS initiatives such as the Express Studios and Spark whatnot. There didn't used to be (I wonder what changed ;-), and I remain skeptical.)


I think Linux is a much richer development environment than OSX and much easier to manage through package managers like apt or yum. Sorry, but nothing on OSX comes close. Plus, you get an insanely rich collection of interpreters, compilers and assorted tools and it runs on just about any computer you already have.

Cygwin can make life under Windows bearable, but there is a long list of confusing things people have to deal with such as the /cygdrive tree and executables always having the .exe extension. "ls" autocompleting to "ls.exe"?


It's funny that you mention the keyboard shortcuts!

When I talk to old hackers on Linux about moving to OSX, I tell them, "well, if you move, you don't have to configure your power management and display drivers and it has Emacs keybindings in all the windows!" and they get excited.

When I talk to young CS undergraduates --- all of whom have Macs, because it's not an engineering college --- I tell them, "you should learn Emacs; I know it's in a terminal, but it has all of the OSX keybindings you already started to learn!" and they get excited.


Wow, I never had any post summarize my growth as an engineer so well. Except for the writing and community bit, that's come a bit late.

I remember the day I realized that I could have windows and play heretic all day, or install linux and tinker all day. Linux quickly won.

The biggest skill I learned from linux is to never expect things to work, and to expect the internet to fix things. My round trip time from not working to google and back to working is by far my most valuable asset as an engineer.

And still, almost every day I leave work I think "God that was awesome!". I hope that never goes away.

Oh, and so +1 for 2 hour nr epic SC battles! Except it was under wine, and man did it quake!


Nice read. Did you also always wanted to open things to see how they work? When I was 6 or so, I asked my mother if I could open our hamster to see 'how it worked inside'. Maybe if I were allowed that, I'd be a surgeon now instead of a software developer!


The author speaks of writing some small scripts. I write some small scripts for my use for small tasks, if I come across any problem. Just in case, does anyone know a place(website,book etc.) where such small task scripts are collated so that anyone can use them like small assignments?

Advanced Bash Scripting Guide by Mendel Cooper(http://tldp.org/LDP/abs/html/) has some good scripts which I have come across for some practice but it isn't ordered. Any others ?



Thanks for the suggestion. Another O'Reilly book to read!!


Man, I'd love something like this.


Not exactly what you're describing, but commandlinefu.com can be quite useful.


Thanks, will check it out.


No offense to the author, but I was expecting more of an in-depth process article rather than an overview. Every "How I Learned to Program" article is fluff filled and really only inspiring rather than action orientated. I've never read a truly step-by-step guide on how someone has learned to program. Maybe I'll write it.


Step by step guide?

Get something you want to program. Get a reference. Program.

I am actually happy that someone told me pretty much this. It took a while until I realized how true this was. Just get something you want to do and keep that in mind when reading the reference. I know most people will start making tons of mistakes and writing really crappy code, but that's exactly what learning is about. Starting out with nothing and getting better. One learns from mistakes. Somehow people tend to forget this. Lots of people seem to be embarrassed making a mistake, causing them to don't do anything at all or not giving in that they are making mistakes. One can't learn that way.

I think the article sums it up pretty well and every programmer I know did it that way, well other than learning programming in school, which I myself don't really consider "learning to program", because I never met any person that actually learned programming ins school, meaning if they did they didn't ever program again.


Yes. A step-by-step guide. It can be done. I'll prove it.


This is probably going to raise some ire, but am I in the minority of people who are tired of "How I learned to program?" type posts showing up on HN?

You learned how to code. Great, I am legitimately, truthfully happy for you. It's a very cool skill/career path and a wonderful feeling when you have the ability to create something on your own.

But...do we really need to read that on the frontpage? Am I the only one that finds these types of posts uninteresting?

It has almost become a cliche to wake up and find a frontpage "How I learned <language> in <time> as a <non-programming profession>"


This is probably going to raise some ire, but am I in the minority of people who are tired of "How I learned to program?" type posts showing up on HN?

You're probably not the only one, but I rather like many of these posts, and I think they're useful for the large minority or small majority of HN readers who don't program. They're also handy encouragement to non-programmers in general: someone says "I could do it," describes how, and perhaps that'll act as an impetus and example.

Sometimes I learn something new from these kinds of posts.


I really appreciate them because I have no idea how to teach people how to program, but I know I need to do so.


I both agree and disagree. I don't much want to see them on the frontpage either, but I absolutely do want to see them because I forward them on to friends to whom I'm making the case that it is a good career move (as best career prep = CS + X, for all X [1]). It would be nice to have a subsection or something for them.

1. https://plus.google.com/114765095157367281222/posts/1mrFdZXm...


Re: kragen & jseliger - thanks for the explanations, I hadn't considered it from that point of view. I'll take a friendly view towards them in the future =)


I've been using linux for quite a time, and I personally love it. But I'm afraid average person(non-programmer)reading this blogpost will think that linux is something so fundamentally broken, you need to accomplish such trivial tasks as copy/paste throug hours of pain and suffering. Its not like that. Linux provides both normal and advanced modes of accomplishing stuff, which is an advantage over other OSs like for example windows, which only gives you one way to do stuff (which is almost always rudemtary for a power user).


Great article. I especially like the focus on writing. I've been writing for as long as I can remember. I used to spend time between assignments in class and homework writing short stories when I was a kid. That is partially why I became a programmer as well. Started out writing little TI-83 apps and moved on to Windows apps and now I am a full-time web developer (mostly Ruby on Rails stuff) and I absolutely love coding.


I started with - don't laugh - a TI-55 calculator. It had no conditional jumps (that would be the TI-57) or jumps other than to step 0. It also had, IIRC, 32 steps. I managed to program it to solve second-degree equations.

Then I moved on, briefly, to a Sinclair ZX-81 clone and then stayed with an Apple II until the late-80s. I rented an MSX from the phone company as a videotext terminal. It was a steal at about US$ 7/month.


Well, all this is a bit of a fairy tale to me. Sure programming on my free time with friends, always wanting to know more, to go further, that's true it is fun and I'd say it's a way of life. Now consider: process, deadlines, the annoying management guys.. All this is exhausting and boring, it takes away creativity and fun. Not everything is bright and shinny like that article seems to state. The guy actually designing apps is not necessarily the guy who will code them, etc. There's a lot of frustrating realities out there that are better to be known and accepted than ignored.

Also, see http://developers.slashdot.org/story/11/05/11/0358233/is-pro...


Sounds like you need a change of environment.


So it's not the fault of programming or any other activity per se, but that of the stressful (work) environment.


What I'm saying is that programming for fun on your free time is absolutely not the same as programming to pay the rent, and this is not straightforward when you start learning computer science (and that's what this article is about, right?). You have to respect a lot of things that stops you in the creation process, because the goal here is not to do cool things but do as you're told, to take decisions not for your entertainment but for your boss. Sure there are people that do whatever they want at work, but it's relatively rare. And this, my friends, is just my humble opinion.


Let me put it this way. On a regular week day, I spend around 12-14 hours a day programming (that might change with a kid on the way), only 10 of which are done for my boss. The point is I don't program to make a living. I just make a living by doing what I do best.

In other words, programming to me means so much more than what I give my employer. Just like the article says, it defines a way of life, that puts knowledge, learning and improving on top of everything else.


Nice article, I second that programming is a way of life. Although I'm in my early 20's right out of college, I look forward to how much knowledge & experience I will amass, and the radical transformations this industry will go through, 10 - 20 years down the road.

> "On linux, if you want to copy a file from one box to another, you use scp or rsync"

No, not really... I just SFTP at the moment simply cause I find it more convenient (granted, I'm not a Linux power user in any way).


yes rsync for single files is over kill


That depends on the size of the file, the size of the updates, and the speed of your connection.


What about http://www.codecademy.com ? Modern day way to learn to program or waste of time?


Looking at this for about 10 minutes, it seems pretty intuitive. I don't know much about javascript though, so someone with more knowledge would be better answering your question.


Thanks for writing this up. Read the whole thing, took it to heart. Right now I'm making the leap to web developer in a year, without prior experience.

Was wondering what milestone achievements I should hit in Linux, given my goals? Goal details here:

http://news.ycombinator.com/item?id=3552656


Completely off-topic: Shouldn't the title be 'How I Learnt to Program'? It's a serious question (I don't live in an English-speaking country and my English is not great).


You may be interested in http://www.sciencedaily.com/releases/2007/10/071010132314.ht...

tl;dr - infrequently-used irregular verbs get "regularized", frequently-used irregular verbs, e.g., "be", "think", will likely stay irregular forever.

(I remember reading about changes to the English language that happened to be underway about the time the printing press arrived, and how the press "froze" that process, leaving us with the mess of pronunciation, spelling, and verb endings we have today, but I've been unable to find an appropriate reference, so I offer the article about the Lieberman study in its place.)


Would that be a sign Americans have been reducing usage of the learn verb? I guess that correlates with the amount of posts here about the problems of American education.


They're are both acceptable, but:

learnt - British learned - American


US English: learned

UK English: learnt


Ah, to be young and naïve again.


I learned by typing in BASIC program listings from computer magazines on my VIC-20 in the mid 80s. That slowly transitioned to modifying programs to see what would happen. At some blurry point the trial and error shifted to me actually understanding the language - and more importantly, the realization of programming logics - and starting to use it intuitively to write my own programs.


Similar story for me, except after BASIC it was Forth and 6809 assembly (and I had a TRS-80 Color Computer) and after a while I grew obsessed with data compression algorithms. Man, I used to love browsing old copies of Byte.


i agree, but how can one write passionately about being a programmer and programming without giving due respect to one of the most influental and dedicated programmers of all time - richard matthew stallman - by speaking an entire article only of "Linux" and not of "GNU/Linux"?


How can you write a comment without giving due respect to one of the most influential and dedicated programmers of all time - Dennis Ritchie, without his C language neither GNU nor Linux would exist. We should call it C/GNU/Linux. Or perhaps von Neumann/C/GNU/Linux.

Disclaimer: this is sarcasm.


I never had to #DEFINE RESPECT_STALLMAN before I allocated memory or some such, but maybe that's why my programs were always so inefficient and pasta-like this whole time!


hm, i do this #define in every program, but mine look the same as yours.


The two aren't mutually exclusive. One can be an excellent programmer and just say "Linux", or vice-versa. Besides, what does "giving due respect" to rms have anything to do with programming?




Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: