Learning to Code? Start Here.
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
. 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
.
—-
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 overpricedRandom 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-MichaelPS: 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
