Hacker News new | past | comments | ask | show | jobs | submit login
Awesome email advice from a friend on how to learn programming.
42 points by nav on Dec 23, 2010 | hide | past | favorite | 31 comments
Let's start with the first and most important rule of learning to code. Read everything and understand what you're reading.

Do not skip or skim words or communication of any kind. Don't read something assuming you know what it means; if you don't understand it, look around, ask someone, or google until you understand what you've just read. Then, you can move on.

The reason for this is that programming involves comprehension, not knowledge (more on that below).

Failure to follow this will make you a sucky programmer. You'll write buggy code. You'll piss yourself off when you think nobody wants to help you. Then, you'll end up really pissed because everything you thought you knew how to do falls apart, and you finally realize you're a bad programmer. This happened to me about 7yrs ago -- so, I'm trying to save you the trouble. After I realized this, and, after I learned how to program, not only did I quickly become very good but everything was 10 times easier and I enjoyed programming far more than I did before. Bad programming is exciting -- good programming is a party.

First, I want to tell you that learning a programming language and learning how to program aren't the same thing. A very simple metaphor to this is driving. You can learn how to drive, but, driving an automatic transmission sports car is completely different than driving a manual 18-wheeler. They both move on wheels and function the same, but, are very, very different. Also, if you were getting started, it would be easier to learn with a small automatic car than an 18-wheeler.

Programming and driving, however, are very different. Whereas driving is a mechanical task, which uses one part of your brain, programming is comprehension. When you're programming, you're not the driver, you are the mechanical engineer who invented fuel injectors, or the chemical engineer who invented run-flat tires. A programmer uses comprehension to write logic which instructs machines to create something material and useful.

The key when learning to program is that you create; bad programmers only know how to drive while good programmers know how spark plugs work.

So, I will share with you several things: 1) IMPORTANT: What NOT to do and why 2) How you should go about learning to program 3) About Java, Microsoft, and Enterprise 4) Failure and Practice 5) About Hacker News

1) IMPORTANT: What not to do and why Often, when we read sites, books, etc., we're interpreting what we're reading and creating a story (perception) or associating it with something we already know. No matter what you already know from previous experiences with computers, learning to program is new -- it's like learning how to write -- you know the letters, you've seen it all, but getting your hand to draw such concise letters, words, and sentences, is a completely new experience. This is how you should take in programming; coding should be elegant, concise, and flow. Programming isn't glueing things to form a collage or mocking what you've seen. Just as you can't pretend to speak in a foreign language, you should never write code unless you fundamentally know what it does.

There's a lot of crap out there. Rails, most of PHP, a lot of Java, and most of what Microsoft developers come up with are pieces of crap cobbled together to make something which somehow works. The problem is all the people who are SOOOOO excited and exuberant about their crap. Some things, like Rails, started out awesome and are crap now. Unfortunately, people forget that Rails is just a tool; instead, they use it as a crutch -- even though it's now very worn and rusty. Don't trust or use something just because it's popular -- chances are it sucks. By sucks, I mean, it bites you in the ass a lot and/or forces you to do stupid things which waste your time.

Which brings me to my next subject of Tools. There's a saying "when all you have is a hammer, everything looks like a nail". This is one of the many reasons you should learn a language FIRST and not do anything else first. Otherwise you will end up wondering why you're "hammer" isn't helping you with glue or screws. So, remember to use the right tool for the job.

Want to write iPhone apps? Learn Objective-C. Want to write Android apps? Learn Java. Want to use Rails? Learn Ruby. Want to use Django? Learn Python.

But before you do all of this, learn one language first. The language I'm going to suggest you learn is Python, and there's a really good reason why.

The book I'll be referring you to is "how to program" and teaches with Python. As per the rule above, don't skip the introduction; read and do exactly what it tells you. I picked this book because it's excellent at teaching you how to program, and it's modern. The fact that it's free is just a perk. This is why I picked Python -- this book is awesome.

2) How you should go about learning to program i) Start with Python. Learn Python by using this book: http://learnpythonthehardway.org/index ii) Learn how to write a basic Objective-C or Java program iii) If you learned obj-c, install the iPhone SDK, If Java install the Android SDK iv) Write a mobile application v) now, you're prepared to explore other languages, platforms, etc. (java, jquery, rails, databases)

Unless it's required (for classroom or work), don't touch anything else to do with writing code until v).

Regarding steps ii) and iii) This of course, is the hard way, but that's a good thing! You can't use Python with the Android or iPhone SDK (Software Development Kit), AND you'll never be able to create a web application with them. However, the Android and iPhone SDKs don't suck and are VERY pragmatic (pragmatic is a good thing!). These SDKs make it easy for developers to create mobile applications -- this is an amazing thing because mobile phones have limitations which servers and desktops don't have. They have limited battery life, a slow network connection, less memory, and a slower graphics processor.

By learning how to develop on one of these platforms, you'll learn how to do something with requirements and limitations, and, you'll learn how to apply you're knowledge of programming to a new language. Best of all, you'll write something you can use on your phone, anywhere -- way better than a web site.

Once you can work through writing an android or iphone app (which isn't that difficult, trust me!), then anything to do with web applications will magically become a no-brainer for you.

3) About Java, Microsoft, and Enterprise The way you're going to learn how to program is completely different than the world of Java, Microsoft, and enterprise systems. It's different because these worlds are built on "information technology" and not on productivity. They're built to provide solutions, not solve problems. As a result, everything in these worlds are convoluted, complex, or expensive. Learning to program without these technologies will equip you if you ever need to work with them. In which case, you will better at understanding how the IT components in Enterprise are separate from the programming components. In short, you'll be able to see the forest from the trees whereas others do not. Most just get lost and try to find a corner they can hide in.

4) Failure and Practice Programming is trial and error. You have to LEARN. Last, if you don't have good comprehension skills, it might not be for you. That doesn't mean you can't learn how to program well or be productive, but, you may have to work harder and might not enjoy it as much -- it could take some time for your comprehension to get up to par. This of course, is what practice is for (which is also covered in the book).

5) About Hacker News - http://news.ycombinator.com If you want to program and develop software you should follow Hacker News. It's kind of addictive so be moderate. Hacker News has become a sort of "pay it forward" community where it's discouraged to put people down and you should always try to make positive contributions.




I don't find this very accurate. When I started programming, I didn't read many books, didn't know patterns and all that. I just did whatever was necessary to get the result I wanted.

Between then and now, I've learnt a lot of theory, and I think the key to good programming is just to keep applying what you learned to your software and to keep evolving.

Microsoft Languages and Frameworks don't suck. They made design decisions based off a lot of legacy stuff - they didn't have the luxury of being able to create a brand new SDK. The attempt they made (.NET) turned out pretty alright. The .NET languages and frameworks are pretty good and consistent.

Python is a good short start, equivalent to learning to develop with C on the console, but once you graduate this level, it becomes horribly limited. Making a GUI with python is a convoluted and painful process. So python may be suitable at the start, but one should quickly graduate into a native SDK for the platform you are working in.

And I don't think either of the two mobile SDKs is really well suited for beginners. There is a lot of non-language things to take care off when developing for mobile.

I personally think the best programming way is : C on the console -> .NET or Java. Those will give you a good grasp about what most programming is about and then you can specialise in whatever you want to do.


Agreed in general. But PythonCard takes a certain amount of the pain out of doing a GUI in Python.


Learn Python The Hard Way is not the best book to start programming with; it's better suited to people who already know how to code and want to learn Python. Python For Non-Programmers is my recommendation: it has stood the test of time pretty well and it introduces things in a nice gentle way. It's linked to from the Python homepage, I seem to remember, and there are PDF and HTML versions.

Experienced programmers forget what it's like to be inexperienced. You need to generalise and don't dwell on the things you don't understand. Effectively, the only way to really learn how to programme is to do it because you enjoy it. As you pile on the experience, you'll learn everything you need to learn out of sheer curiosity. When you're experienced you DO want to understand every single line of code, because that's what interests you. As a beginner, the magic of seeing something come to life, even if you don't fully understand it is often enough. That's certainly how I felt when I started out all those years ago.

Rails is awesome too -- not least of all because 'Agile Web Development with Ruby on Rails' is one of the very best programming books written. It's actually readable. Rails is a fantastic tool that lets you to create first-class web applications without needing to know everything about the framework upfront. That means you get results fast, and you learn the details only when the time is right. You also learn some very valuable conventions to do with code organisation, testing, DRY etc that so many corporate programmers never seemed to have grasp (and are never going to be great programmers as a result).

Also, if you seriously want to learn, don't follow HN. Get programming and get in the zone. Every minute spent reading stuff like this is a minute lost.


Re-reading my reply and the original post, it's clear that everyone is different and what works for me probably won't work for you. Just don't give in - try different approaches, find what works best for you and stick at it.


Really? I thought LPTHW was meant for non-programmers? From the site: "The book is a very beginner book for people who want to learn to code. If you can already code then the book will probably drive you insane."

Is this not true? I've been wanting to get back to Python recently so I'm genuinely curious if this is a good resource for someone who already knows how to program in another language.


I've come to realize that reading comprehension is extremely important when learning a programming language. My native tongue isn't English, so it takes a while for me to absorb and fully comprehend what I'm reading. The technique I use is to start reading the text, even if I know I won't understand anything. I just read it and let it sink in. I wait a few hours, then I read it again, and again, and again until I fully understand it. It's much easier getting started when you accept the fact that you won't understand it the first few times of reading the text.

The Chrome dictionary extension is very helpful as well.


Lots of good advice, but I'd take the "X is crap" stuff & chalk it up to opinion.

Like most other things in coding, the right tool for the job will vary from person to person. Rails is probably not the best way to learn programming, but it does introduce a whole bunch of built-in best practices. PHP works for a lot of smart people and powers some big sites; it's an easy first language.

I've learned that there are lots of smart people out there & if they're willing to invest the time/effort and resources on something, chances are that it's probably got some kind of merit. To discount it as "crap" is the stuff of religion & holy wars.

I'd just say be open minded about things & remember that smart people often find different directions to come to the right answer. If it makes sense to you, go ahead and explore it -- even if it is "crap." It's hard to recognize the good without having encountered the not-so-good.


One thing I think is VERY important that I'd add is:

6) Engage the community and peers. You need to see how professionals do it, because otherwise you run the risk of develop in a vacuum and taking up weird habits and theories - becoming unorthodox.

I don't know how much my following analogy extends to the programming world, but I would like to point out that being an unorthodox programmer hurts you in team software environments, where there are norms that are assumed and implicit common ground that is assumed, which can be easily broken when one learns programming on their own (such as variable naming conventions, law of demeter, each method only doing one thing, etc. etc. best practices) and becomes confusing and ultimately harming productivity when working with other developers.

As an analogy this happens a lot with sports (golf, tennis, and boxing come to mind), where some people spend many hours and hours as a lone ranger on their own, driven by massive passion and inner fire to learn the sport in a vacuum, instead of seeking out a coach or professional guidance.

The result is they come out with skilled but unorthodox, and effective but arguably ultimately flawed methodology. You will get an occasional diamond in the rough for unorthodox boxing, golf, tennis who can compete at the world class, but for the most part they falter at the more... professional levels of competition.


an obviously my opinion here is not black and white, it's a "for the most part", "80/20 pareto principle", etc. etc.


Whoever wrote this seems to have an extreme hatred of Ruby on Rails. I've personally never used it, but... wow, that was a lot of hate.


Author lost total credibility at that point. Rails is quite elegant, and yes, it is just another tool. Totally unsubstantiated bashing. Surprised to see this on the homepage.


His words were quite harsh, but I do have to agree with him to some point. Rails has a culture of "magic", they have conventions on how to do things (e.g. naming stuff) and you aren't really allowed to diverge from that. This does not appeal to me and I'm not surprised to see that others don't like it either.

However, I can see how Rails "gets things done", and why so many people like it.

Perhaps the author came clear with his opinion a bit too hastily, but you shouldn't ignore someone just because you don't agree with every opinion he has. This was not an article about "why I don't like Rails", that's probably why he did not explain why he doesn't like it.

What comes to the article itself, I think it was decent and I don't agree 100% but not bad advice either.


> His words were quite harsh, but I do have to agree with him to some point. Rails has a culture of "magic", they have conventions on how to do things (e.g. naming stuff) and you aren't really allowed to diverge from that.

Here we go with the "magic". It is not magic, it just code. Many people are just too lazy to investigate why things works the way they do, and how to change it when the defaults don't fit their needs.

Just for the record, you are wrong about naming conventions, they don't act as mandatory, you can use configuration methods to set up things the way you like it. E.g

  Class Users 
    set_table_name “Usuarios”
  end
Rails has many drawback points, I rather prefer Django views, than Rails, but all this "magic" conspiracy theory is just childish.


My first programming language was BASIC on a Commodore 64. So I've gone through many languages and frameworks in my day. In the last year I started writing an app in Ruby/Rails and I must say as someone with experience in other things, I like it.

I happen to like the "magic" aspect of Rails. The downside is that it does make Rails suitable for certain types of development and less so for things that fall outside of its paradigm. That's Ok, as long as you know that. Having said that, my app was actually OLAP, not OLTP, but I was able to extend the framework pretty well to do what I wanted, including working with legacy schemas. So it is more flexible than some give it credit for.

To me the real power isn't in Rails though, it's Ruby, which is the best programming language I've used, albeit extremely slow and inefficient. I haven't not used Python, so want to be clear I'm not making a Ruby v. Python claim.


To be fair, there is no magic in Rails, just a lot of 'defaults'. If you look at the code, its all very clear how those defaults are enabled, and there are clear methods for overriding them. The 'magic' thing started as a sort of marketing spiel to say "look at all these things that you don't need to worry about configuring, because they are all set to sensible defaults" but became 'mysterious' in some people's minds.


Not terribly consistent bashing, either:

"Want to write Android apps? Learn Java."

"About Java [...]. The way you're going to learn how to program is completely different than the world of Java [...]."


There is a distinction there: the way Java is used in the enterprise and for Android apps is very different.


Still, I think it's a bit strong for a "so you want to learn programming" email. If I was looking for advice, I'd rather start with the technology and learn the cultural differences myself.


I have a love-hate relationship with various ORMs - Hibernate, iBatis, etc. I can understand why he hates Rails, which auto-magically does alot of things for the web developer. The thing is that as a programmer, you need to realize that these frameworks might be abstracting too many details away.

This will be burdensome to many people in various scenarios, including one where you as an expert need to hold the hand of the new guy so that he can use the ORM effectively or one where you as the newcomer is attempting to learn the framework yet can't get anywhere because it does what Rails does - alot of hidden magic which you don't understand unless you go dig through the source or go to the forums to start asking questions.


How can you tell? Ruby is mentioned once, and it's in the context of "Want to learn X? Learn X".


The paragraph starting "There's a lot of crap out there."


I swear it wasn't me. :-)


I never recommend people "learn python", but rather that they make an effort to learn both Python and Ruby, and they'll find one suits their way of thinking more than the other.

For me, I quite adore Ruby; I love it's expressiveness and flexibility and the way I can do all sorts of evil trickery with it. I derive more joy from writing in Ruby than I have from any other language I've used over the last 20 years. And Python, well... I have have great respect for it, and I see that many people get the same enjoyment from Python that I do from Ruby.

Telling people which (of the two) to choose is like (to use a very sexist analogy) pointing someone at a blonde and a redhead and saying "The Blonde is better". The Ruby/Python choice isn't a choice between better/worse; it's a preference like blond/redhead


I don't quite understand this, for new programmers, why do people recommend both Python and Ruby? Why not spend time with either Python or Ruby, and then try something totally different, like Java, C, Common Lisp or Scheme?


Something tells me this was written by some arrogant kid to his friend. I disagree with nearly everything in this e-mail. I spent more time reading a rant than reading any actual advice.


Maybe I'm just speaking from my experience in schooling, but shouldn't C be someone's first language?

Also it's great to namedrop Hacker News, but I think he should also mention seeking advice from Stack Overflow or any of the Stack Exchanges. Trial and error is good, but if you're tearing your hair in frustration, it's always to get backup from a solid support community.


I disagree, as much as I like C and think it should be a mandatory language for all serious programmers (see my True Scotsman fallacy here? :D) I think C makes a horrific first language which leaves you mired down in boring details and hard to grok bugs.

I think Python (or other high level languages) are a much better starting point. Python teaches you functions, expressions and objects in an easy flexible way so you can actually do something. C is more for understanding how things work. But if you can't do anything as a programmer yet, why would you care how things work?


I disagree. Learning to program in C is like climbing a tree ass first.

At some point, any serious programmer must learn C and Assembly, as well as the internals of their computer, how the processor and the memory works. But before you are decent in writing programs with an easy language or two, you should just regard the implementation of the language and the computer as the "spirit of the computer".


Learning C could mean a steep learning curve: you have to understand pointers and memory management to get anything useful done, and IME it takes new programmers a while to get their head around pointers.


In my Opinion, the first 5-6 paragraphs are full of inspiration. This is what I do think so ...


can you tell me how to accomplish my java certification




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

Search: