Learning to Code? Start Here.

Technology | Saturday, January 26th, 2008

I woke up this morning to a surprise in my inbox. Jon-Michael Deldin had written me a rather lengthy response to a blog post I had written last week on learning to code. I love getting feedback from readers, especially 1000+ word emails written at 2:00 in the morning. Jon-Michael went into extreme detail on how to begin coding, and where to learn the languages. Take a minute out of your day, and read it through. You won’t regret it.

Hi Michael,

If I were starting from scratch today, I’d learn Python. It’s clean, and it’s easy to run (open Terminal.app: Type “python”). Once you’ve learned HTML, you can get started with building a Python site using Django, TurboGears, Plone, etc. With Python, you can do incredibly useful stuff like creating the world’s longest palindrome :P. Python and other high level languages are just gateways to other languages.

For Python books, check out Dive into Python (free download) and Thinking in Python (also free) while you’re waiting for your copy of either Beginning Python: From Novice to Professional or Learning Python to arrive. For book selection, avoid any quick start guides or teach yourself something in x days. They’re terrible and often leave you with a poor introduction to a language. O’Reilly books are good; most Apress books suck, with Beginning Python being an exception; Sam’s and Peachpit books are terrible.

While you’re learning Python, keep in mind that programming is an art form. It’s not about staring into a green-on-black Terminal and typing complex codes. It’s about designing an application and all of its processes. I draw out my applications on my whiteboard or in my sketch book [1].

Also, I would avoid learning AppleScript until you’ve learned a real language. It’s a scripting language that’s extremely limited in its use, which is why I chose Python (create web apps, shell scripts, desktop apps [Picard from musicbrainz is written in Python]). What I mean is the techniques you learn in AppleScript won’t translate to other languages. However, you you could probably learn AppleScript in a weekend.

I gave up on learning C because it’s uses for me, as a web developer and bio+chem student, are limited. Well, that’s not entirely true. It’s the basis of many languages, servers, and programs, but it’s not a popular web development platform. You also have to compile C, so you won’t get immediate feedback. Instant gratification is a definite plus with Python. Sidenote: Java (Java ≠ JavaScript) is ugly and not worth your time [2]. Have you ever run Azureus or MarvinBeans on your Mac? Then you know how bad Java is :D.

—-

For the languages of the web, start small. HTML is incredibly simple to learn from W3 Schools, but also consult the actual spec [5]. So many of today’s web developers haven’t read the actual W3C docs, but once you get past the awful ugliness, you’ll find they’re easy to read and obviously, packed with useful information. Knowing the spec inside out is definitely a good thing. Always code to the strict doctype of either HTML or XHTML and validate as much as possible. The practical differences between XHTML and HTML are: XHTML tags are all lowercase and images are self-closing ([img />). Check out these archives for some solid advice regarding HTML (warning: you’ll probably spend many hours on that site! Definitely subscribe to it).

Learn CSS in conjunction with HTML so bad habits like laying pages out with tables do not form. Once you have a solid understanding of HTML and CSS, then move to JavaScript. Actually, learn JavaScript after you’ve learned Python or Ruby - it’ll be easier.

Also, setup a local web server on your Mac. Go to System Prefs > Sharing > Web Sharing and turn it on. Your web directory is ~Sites, and you can access it via http://localhost/~your_short_name.

One last bit of advice for the web - immerse yourself in it. Check out source code, play around with Firebug or Safari’s web inspector. Learn how things work and have fun doing it.

—-

For tools, you’re most important tool is a text editor. Here’s a quick, opinionated rundown of Mac text editors:

TextMate - extremely versatile; time-saving; made for the keyboard!; best software investment I’ve ever made :) (check out edu discounts). I do everything in it from coding to writing research papers (XML + XSLT + FOP lately).
Coda - made for HTML, CSS, and JS development; too many dependencies at risk (ie. your shell crashes, the app and all your work crashes…trust me, you’ll write some infinite loops in the learning process)
Smultron - free, but irritating to use
BBEdit - outdated in appearance; not very useful; way overpriced

Random software advice:

* Install Colloquy for IRC. I found this out late in the game, but IRC is an amazing resource for instant help.
* Hit Cmd+t in Terminal to open a tab
* Install the developer tools from your Leopard install disk. You’ll be compiling stuff on your Mac, so you need some developer commands.
* Read this

—-

Whew! Hope this long and rambling email helps!

Take care,
Jon-Michael

PS: If you want a really quick start to a simple programming language, look no further than your TI graphing calculator. BASIC is, well, basic, but a decent intro in a clumsy interface.

—-

1. Java is evil
2. Dot Grid Book by Behance is awesome. Expensive, but awesome.
3. HTML 4.01; XHTML

——–

Jon-Michael Deldin
http://jmdeldin.com

11 Comments »

  1. Thanks for posting that. I am saving it for when my first weeks of school settle down and I am more used to my mbp cause im interested in this.

    thanks michael!!

    Comment by Christine — January 26, 2008 @ 11:49 pm

  2. What a nice man! Useful info too.

    Comment by Ted Winder — January 27, 2008 @ 8:45 am

  3. Wow that’s all excellent advice!

    Comment by David Martin — January 27, 2008 @ 11:12 pm

  4. Great advice, but he’s wanting you to learn Python. :P I’ve tried to figure out that language, but as hard as I try, I will probably never get it. Then PHP came to light! There’s a huge documentation on PHP at php.net. It’s open in my browser alongside what I’m working on all the time, it’s a great resource.

    Try out a couple languages, the more you know, the more versatile you can be, and the bigger chance you might get hired.

    Comment by Chad Ohman — January 28, 2008 @ 12:55 pm

  5. That was quite a lengthy post. But unfortunately I think Jon has given you some misinformation with regards to Java.

    If you want to stick with web development only, then by all means start with Python (although I would recommend Ruby, I find it to be syntactically superior to Python). However if you ever plan on using something lower level such as C (or in your case Objective-C, which is a derivative of C) then learning Java would be very helpful. There are significant differences in the syntax of Python compared the syntax of the more established languages (C, C , Objective-C, Java, C#, etc). There is a reason that Java is the first language taught in most Computer Science programs.

    As well, it appears that Jon believes that Java is for desktop applications only. This is not true. I would venture to say that the majority of Java development is for web applications. J2EE is pretty much the industry standard for enterprise web applications. However, writing a Java web application does take some serious programming skills, and is not really meant for the novice programmer. But the benefits are numerous.

    I guess the point of my post if that Java is a great language, and has virtually limitless support and resources. MUCH more than the new frameworks such as Django and Rails.

    And just FYI, I am a working software engineer, so I think I have a little more knowledge than Jon when it comes to programming languages and the like.

    Comment by James — February 3, 2008 @ 1:43 am

  6. James, keep in mind my misinformation was a brief sidenote. I do know that Java is used for more than just desktop apps - that’s not why I dislike it. Java is too verbose in my opinion.

    But the benefits are numerous.

    What are the benefits to writing a Java web app?

    I guess the point of my post if that Java is a great language, and has virtually limitless support and resources. MUCH more than the new frameworks such as Django and Rails.

    Comparing a language to a framework is not a valid comparison. As a software engineer, you should know that.

    BTW, my first name is Jon-Michael, not Jon ;). I do have a healthy knowledge of “programming languages and the like” too. Remember: Web developers don’t play with HTML and CSS all day.

    Comment by Jon-Michael — February 3, 2008 @ 5:25 am

  7. hehe…sorry. I’ll fix that

    Comment by Michael Mistretta — February 3, 2008 @ 8:48 am

  8. Jon-Michael, obviously Java is more verbose than something like Python or Ruby, but that is because it is a lower level language. For instance, in Ruby to iterate over something 8 times, you could write something like:

    8.times do

    Whereas in Java you would need to write:

    for (int i=0; i < 8; i ) { code goes here }

    Another example is how in Python, everything is an object, even an integer. Whereas in Java, and most lower level language, integers are primitive data types. Primitive data types take up less memory than objects.

    But the real advantage of writing code at a lower level is that you have more control over how it is executed, and as a result is much faster. A language is only “too verbose” as you put it, if you don’t need that level of control. Try writing an operating system in Python. You would be begging for more verbosity.

    Now you may be saying “I’m only writing web apps, why do I need that level of control?”. Take a look at Facebook. Their front end is PHP, but they have a lot of low level code (C, C , Java) mixed in for optimization. If their application was written in Ruby or Python, it simply wouldn’t be able to handle to load. Which brings me to my next point.

    Python and Ruby are interpreted languages, whereas Java is compiled, which also makes it much faster. For example, in comparison to C , Java is able to execute at a speed ratio of about 1.5:1, whereas Python is able to execute at a speed ratio of 100:1 in comparison to C .

    Another advantage is that Java has many more pre written libraries than the newer languages such as Python and Ruby. So you will not find yourself in as many situations where you are solving problems that have already been solved (read: writing code that has already been written).

    Another advantage is support. Java developers far outnumber Ruby and Python developers, and so you will find many more online resources for Java. As well, Java is far more documented that Ruby and Python.

    Comparing a language to a framework is not a valid comparison. As a software engineer, you should know that.

    Actually, in the context it was used, my comparison is completely valid. I said “support” and “resources”. Had I been comparing it in terms of execution speed, then yes, a better comparison would be Java to Python, or Struts to Django.

    Remember: Web developers don’t play with HTML and CSS all day.

    I agree. However, the only web developers I’ve ever heard of who complain that “Java is evil” have not had a education in the fundamentals of computer science, and therefore do not understand the benefits of interpreted vs. compiled, low-level vs. high-level, or primitives vs. objects.

    Comment by James — February 3, 2008 @ 9:59 pm

  9. Hmm. Looks like a missed a </blockquote> . Michael if you’re reading this maybe you could stick a </blockquote> in right after the ‘for’ loop. Haha.

    Comment by James — February 3, 2008 @ 10:09 pm

  10. Weird, I also noticed that most the instances where you see C, it should have been C plus plus. It seems that the addition symbols were stripped off.

    Comment by James — February 3, 2008 @ 10:14 pm

  11. That’s very, very helpful.

    Comment by Timothy Andrew — February 14, 2008 @ 8:03 am

RSS feed for comments on this post.

Leave a comment

Michael Mistretta 2008 - Today | Licensed under Creative Commons | Powered by WordPress | Theme by Roy Tanck