Join 3,512 readers in helping fund MetaFilter (Hide)


Learn to Code
January 31, 2011 11:43 AM   Subscribe

Want to be a coder? Productivity-porn site Lifehacker has posted its 4.5-part "Learn to Code Nightschool Course."

More online programming tutorials from Google, W3Schools, Try Ruby, and Oracle. (Previously, but pretty dated now.)
posted by jbickers (47 comments total) 120 users marked this as a favorite

 
Thanks jbickers, I'm looking forward to diving into those Lifehacker tutorials when I have more time.

I think I've seen people warn against W3Schools elsewhere on Meta.
posted by londonmark at 11:49 AM on January 31, 2011 [1 favorite]


I don't know if it's improved any but when I've used it in the past, W3Schools tended to be pretty crap. Lots of bad code as examples, etc.

See also W3Fools.
posted by kmz at 11:55 AM on January 31, 2011 [3 favorites]


I think I've seen people warn against W3Schools elsewhere on Meta.

I don't know if it's improved any but when I've used it in the past

It hasn't.
posted by thsmchnekllsfascists at 11:59 AM on January 31, 2011


I'm not sure if arrays are exactly like mini-databases but sure, ok.
Everyone should learn to program on some level so go nuts, non-coders.
posted by GuyZero at 12:00 PM on January 31, 2011


I've got that Lifehacker series bookmarked for later consumption. Can any coders comment on how accurate and orgood the series is it?
posted by oddman at 12:01 PM on January 31, 2011 [1 favorite]


Can we get a beginners guide to medicine or law? I would like to playing around with some simple surgical procedures and perhaps defend myself in court if something goes amiss.

I kid but I really enjoy telling laywers I'm the office legal wiz when they tell me how great they are at excel so they are practically a programmer.
posted by Ad hominem at 12:03 PM on January 31, 2011 [12 favorites]


Everyone should learn to program on some level...

Why?
posted by Thorzdad at 12:05 PM on January 31, 2011 [1 favorite]


Based on a 5-minutes read-through the lifehacker tutorial series is a) incredibly basic and b) javascript-centric (I think).

b) is not a big deal but if you go to straight C code the idea of strict typing may be a bit of a shock to the system. Also, pointers.

But depending on where you're at there's nothing intrinsically wrong with a very basic tutorial or learning JavaScript as a first language/environment.
posted by GuyZero at 12:05 PM on January 31, 2011 [1 favorite]


I would like to playing around with some simple surgical procedures and perhaps defend myself in court if something goes amiss.

This is a high-school level tutorial on programming, akin to the courses I took in high school on law and biology. Just because it doesn't let you do much doesn't mean it's not useful or enlightening.
posted by GuyZero at 12:06 PM on January 31, 2011


4.5 parts?
posted by doublehappy at 12:11 PM on January 31, 2011


This is a high-school level tutorial on programming, akin to the courses I took in high school on law and biology. Just because it doesn't let you do much doesn't mean it's not useful or enlightening.

I agree 100%, non-programmers, please do not be put off by some programmers (my own) bad attitudes.

Based on a 5-minutes read-through the lifehacker tutorial series is a) incredibly basic and b) javascript-centric (I think).


Yep, I kinda like this because there is zero setup involved. Pretty much edit a file and load it in a browser.
posted by Ad hominem at 12:14 PM on January 31, 2011


Parts is parts, doublehappy.
posted by spicynuts at 12:14 PM on January 31, 2011


This comment is in 45.4 parts.
posted by l33tpolicywonk at 12:18 PM on January 31, 2011


Want to be a coder? Productivity-porn site Lifehacker has posted its 4.5-part "Learn to Code Nightschool Course."

<snark>Brought to you by Gawker Media: Ask us about our security practices!</snark>

Sorry, that was the first thought across my mind when I saw the post. But I'll ditto Ad hominem: ignore the geek bitchery, non-programmers.
posted by romakimmy at 12:26 PM on January 31, 2011 [1 favorite]


oddman said:"Can any coders comment on how accurate and orgood the series is it?"

No, I think it's wishful thinking to think that Lifehacker can cover that much ground in four six-minute videos.

If you're completely new to programming, I'd start a free trial at O'Reilly's online site, Safari, and add a "Head First" book of your choice to your bookshelf. The artwork in the series is really cheesy, but you get used to it. More importantly, the Head First series is excellent at covering a lot of key material very quickly. The Missing Manual series, also by O'Reilly, is great but it tends to have much more information than the non-technical beginner will be able to digest.

If you've got a fast internet connection and would rather learn through videos, you could start a free trial at Lynda.com. Generally, their material is of a very high quality.

You'll always be able to find tutorials for free, but it's hard to compete with some of the material on Safari and Lynda. You'll definitely get your money's worth if do end up creating a membership.
posted by lemuring at 12:30 PM on January 31, 2011 [17 favorites]


Thorzdad: " Why?"

I'll try to answer that, or at least give one possible answer.

My job doesn't involve programming. At all. And yet, about once a week I find myself staring at a page of Javascript, puzzling out what goes where and what does what. And through years of trial and error, I've started to figure a few things out.

I'm not a help-desk person either, but I know how to do basic diagnostics on my computer. I don't have to wait for IT to get back to me, and they can focus in the bigger-picture stuff, the stuff that impacts the whole organization. It's the same with coding.
posted by roll truck roll at 12:30 PM on January 31, 2011 [1 favorite]


The Google Python tutorials are pretty good. I went through them over the holidays.
posted by incster at 12:31 PM on January 31, 2011 [2 favorites]


Why?

For the same reason they should learn how to cook or drive. The advantages of knowing how to automate simple tasks on a computer can make a dramatic difference in your quality of life.

Yes, you can get by in life eating frozen Lean Cuisines and taking the bus... but the opportunities available to you, as a human being, are opened broadly, and the skills you learn - how to read a map, how to concentrate on the road while operating a complicated machine, how to organize and prepare a meal, how to follow a recipe - apply themselves in all corners of your life. So it is with coding. Apart from keeping your inbox tidy, your pictures put into the proper rotation on facebook and flickr straight from your DSLR, your investments kept on top of, your collection of 80's sitcoms properly organized, etc - you can find readymade applications for this stuff, that will work, sorta - the merger of logical and creative thinking will have a deep and positive impact on your life beyond digital devices.
posted by Slap*Happy at 12:34 PM on January 31, 2011 [10 favorites]


OK, so if w3schools is so bad, are there any adequate substitutes that are as comprehensive and easy-to-digest?
posted by schmod at 1:01 PM on January 31, 2011


Why?

You'd be surprised how far a little extra tech skill will take you in life or a career. I became a web developer by accident, and it really helped my problem solving skills. It built up the tenacity to figure out a problem. Unfortunately that job beat the desire to web develop out of me, so I turned instead to databases and taxonomies.

One tends to just be able to do more in the way of technical wizardry that often impresses others, especially co-workers. Developing something as basic as a Word or Excel macro or a neat-o database can win you a lot of recognition. You can use your skills to then help others. It can be a self-esteem boost. People perceive you as being smart. It can make you self-reliant instead of depending on others. Plus it's fun to noodle around and see how stuff works. JMHO :-)
posted by Calzephyr at 1:04 PM on January 31, 2011 [3 favorites]


4.5 parts?

In FORTRAN it would be just 4 parts.
In APL it would be [A]*&^%$@ parts.
posted by storybored at 1:17 PM on January 31, 2011


Why?

I think everybody should learn some programming. In fact, I think the only reason you should have computers in elementary school classrooms is to teach programming.

Sure, most people don't have the exact combination of talent and dedication to become really great career software guys. But having an appreciation of what, generally speaking, is going on inside your computer (and the other computers your computer is connecting to) is part of understanding how society works now.

And of course a little bit of programming ability coupled with a scripting language will make you a better, more effective user of technology. But it's not just that—it demystifies the machine. You might not be able to understand the code-level specifics of what's going on in a given application, but you can understand at a high conceptual level what's going on. It's so much easier to make the distinction between RAM and hard drive storage when you've actually written a program that has to get something from the disk, do something with the data, then write it back to the disk. (Even better if you've written code that has to get something from a certain address in memory, do something to it in a register, then put it back into memory!). It gives you a broad appreciation for the kinds of things that are easy to make a computer do, and the kind of things that are hard.

I took a year of computer science in high school and another year in college. I learned Pascal, and then C. I am a terrible programmer. I mean just absolutely, totally abysmal. But my intellectual life has been enormously enriched because of the programming I did learn, as has my ability to appreciate the software I use daily. And being moderately handy at the unix command line constantly comes in handy.

So that's why everybody should learn some programming. Good on Lifehacker for taking a shot at this admirable goal.

Although of course the best language for teaching programming nowadays is obviously Ruby.
posted by pts at 1:28 PM on January 31, 2011 [6 favorites]


Why?

I'm "just an editor/producer" for a collection of IT-related websites. A few years ago, I began to realize I was spending big parts of my days doing the same thing over and over and over again: cleaning out bad markup from writers, repurposing content from other sites, gathering page views and bounce rates for articles I published, etc. etc.

With a little basic AppleScript and eventually Ruby, I estimate I was getting back an hour a day every day of the week based on a few days' total investment in learning simple scripting for text processing. Once I learned enough HTML, JavaScript and erb to start sharing my tools, the gains from my small amount of learning multiplied. I cite those productivity gains when I'm justifying the time I spent doing that learning, but the real benefit for me was relief from the crushing tedium of doing the same thing over and over and over and the satisfaction of sparing colleagues the same tedium.

Having learned those basics, it was easy to leverage other peoples' code to do even more. Now I maintain a database that makes it possible for other editors in my group to do all their monthly reporting in five or ten minutes, and what we get back in the time it takes me to import and process their reports then hand back completed aggregate reporting constitutes even more total hours every month where lots of people are relieved of the tedium of looking stuff up in in analytics tools, tabulating costs, etc. That data gets a hard workout, too: We know so much more than we knew two years ago, and assembling the reporting needed to know that much takes so little effort.

I'm lucky I work in a field where I deal with data and content amenable to programmatic processing, but plenty of people do these days, and a lot of that work is just repetitive info-drudgery that becomes almost effortless with a light layer of simple programming. No "real programmer" required, because the problems being solved are pretty small and will never need a deep education ... they just add up over time and across an organization.

It might not be a moral imperative sort of "should," but if we preface "everyone should learn at least some programming" with "if it's worth it to reclaim the time lost to repetitive work by investing a few hours up front in basic programming education," then yeah ... everyone should learn a little programming. Not taking advantage of the incredible wealth of programming tools we have in the form of robust, accessible scripting languages and the ability they provide to automate so much repetitive information work represents a commitment to wasting time.
posted by mph at 1:35 PM on January 31, 2011 [6 favorites]


That's a good reason. I think everyone should learn a little programming for a different reason: it serves to help one think more cleanly about instructions and processes, which is an aid to communication. When you're effectively talking to a computer, you can't afford to be vague or incomplete in your directions.
posted by JHarris at 2:02 PM on January 31, 2011 [3 favorites]


Ah! They used Earthbound characters! SQUEEEEEE--

Er, uh, how interesting.
posted by JHarris at 2:03 PM on January 31, 2011


When you're effectively talking to a computer, you can't afford to be vague or incomplete in your directions.

Million of CPU cycles are now dedicated to being able to do just that... you kids and your ruby and your python with dynamically-resizing lists as PRIMITIVES! Why, when I was a wee lad, we had to resize our lists by hand! Uphill! Both ways!
posted by GuyZero at 2:08 PM on January 31, 2011 [2 favorites]


Why?

about ten years ago i made my way through enough programming to be able to write a custom letter-generating application (for medical transcription) that streamlined my work such that i've consistently made about $70k/yr working about four hours a day. i used to want to be a programmer (and have the aptitude) but could maintain no interest in it without starting from the point of having a problem to solve. now my only problem is finding fun stuff to do with all my free time.
posted by fallacy of the beard at 2:09 PM on January 31, 2011 [2 favorites]


Also, *pointers

That is so excruciatingly funny.

I used to say, "Writhing in pointer hell"
posted by mmrtnt at 2:19 PM on January 31, 2011


Although of course the best language for teaching programming nowadays is obviously Ruby.

Blech. I read a bit about ruby and found it to have some pretty inelegant characteristics.
posted by kenko at 2:50 PM on January 31, 2011


Although of course the best language for teaching programming nowadays is obviously Ruby

Contrariwise.
posted by Monday, stony Monday at 2:56 PM on January 31, 2011


Why?

Because one day you'll be looking at some cool Arduino thingy on Make and your four-year old son will be watching over your shoulder.

"Wow! Daddy, make me one of those!"
"I...I can't, son."
"But that little boy's daddy made him one!"
"I'm sorry. I could join the bits together, but I just don't know how to write the code to make the lights flash like that."

And then his little eyes will well up with tears because his heart has broken because he's just realised that's you're Not As Good As That Kid's Dad. And then your wife will have an affair with that kid's dad because 'he's just so...well, capable', and the next thing you know you're on a rooftop waving a gun at a news network helicopter.

This is my greatest fear.
posted by obiwanwasabi at 3:39 PM on January 31, 2011 [15 favorites]


Come on Ah Hominem it's mostly just a formal grammar, discrete math and some basic design patterns. This isn't surgery or law.
posted by humanfont at 4:08 PM on January 31, 2011


this would have been tremendously useful to me were it 15 years ago.
posted by Fupped Duck at 4:23 PM on January 31, 2011


I agree with the idea that there should be an easy intro to basic programming concepts and that everyone ought to have a basic understanding of how code gets written, for the same reason everyone really should try to learn at least enough of some other language to ask where the restroom is and interpret the response, not necessarily because they plan to visit France one day but just to have an idea of what it's like to speak a language other than your native one. It's a basic fact that computers don't think the way people do, and I regard dealing with them as a language skill that a lot of people never get.

OTOH inflicting Javascript on some poor person as their first computer language has got to rank right up there with ripping out fingernails and waterboarding as a way to scare people away from what you want them to experience. When you have set variables A to 3 and B to 4 and the result of A+B is ambiguous as to whether it's 7 or "34", you do not have a programming environment you have a horror movie. And the debugging ranges from nonexistent to unreliable. And important stuff is different on different platforms, often for no good reason. And don't even get me started on the I/O system when that's the DOM.

A much better approach to this IME would be an 80's-style text and line number style BASIC implemented in Javascript, to use the ubiquity of the browser language for ease of access but not inflict it on poor newcomers who will not be able to figure out that they misspelled math.function because they didn't capitalize Math, and the braindead browser is too stupid to tell them what the problem is.
posted by localroger at 4:31 PM on January 31, 2011 [4 favorites]


I'm taking a coding class right now that has the teacher explaining the various concepts of programming (like Inheritance, Polymorphism, Constructors, and the like) on the blackboard...and then we process and explain those concepts for our homework by drawing diagrams and pictures on paper.

The end result is that I'm learning much more in this class than I did in my previous class, where we spent the entire session coding in C#. I could do the code and make a constructor, for instance, but I didn't fully internalize it all until now.
posted by spinifex23 at 4:54 PM on January 31, 2011


You can't learn to program in four installments, or one course in college, or from just one book. Like many skills, programming is deep; you can learn as much as you want to learn. The biggest breakthrough is when you begin to be able to see programming languages as arbitrary syntactic structures surrounding the same underlying language of logic; this is what allows great programmers (and I am not one) to learn a language in a couple of weeks.

If I were designing a course for the autodidact who wants to learn to program, I'd say that he should read a couple of books. How to Think Like a Computer Scientist is interesting, and uses Python, my favorite language. If that doesn't scratch the itch, try Dive Into Python 3.

Later, after you've absorbed the basics and have done the usual exercises to build your "logical capacity," you can move on toward my preferred method of learning—reading source code. There are lots of ways to do this. The best is probably to download open source projects and figure them out, but I confess I have a fondness for Rosetta Code, which allows you to see the same algorithms expressed in many different languages and programming paradigms. Take, for example, these snippets to calculate the factors of an integer:


Haskell
import HFM.Primes(primePowerFactors)
import Data.List
 
factors = map product.
    mapM (uncurry((. enumFromTo 0) . map .(^) )) . primePowerFactors

Java
public static TreeSet factors(long n){
	TreeSet factors = new TreeSet();
	factors.add(n); factors.add(1L);
	for(long test = n - 1; test >= Math.sqrt(n); test--){
		if(n % test == 0){
			factors.add(test);
			factors.add(n / test);
		}
	}
	return factors;
}

Python
from math import ceil, sqrt
def factor(n):
    return sorted(set(sum( ([x ,n / x] for x in range(1, ceil(sqrt(n)) + 1) if not n % x), [])))

Scheme
(define (factors n)
  (define (*factors d)
    (cond ((> d n) (list))
          ((= (modulo n d) 0) (cons d (*factors (+ d 1))))
          (else (*factors (+ d 1)))))
  (*factors 1))

It's the same logic, expressed in different ways—and I think that learning to read all of these (whether or not you're able to write the language itself) is an excellent goal if you're serious about learning beyond just renaming a lot of files in a directory (as worthy and time-saving as that is).
posted by sonic meat machine at 6:16 PM on January 31, 2011 [4 favorites]


To follow Metafilter standards and practices: Teach Yourself Programming in Ten Years.
posted by signal at 6:51 PM on January 31, 2011


Here is one of the dozens of ways to do it in C#
 private IEnumerable factor(int number)
        {
            var a = Enumerable.Range(1, (int)Math.Sqrt(number)).Where(x => number % x == 0);
            return a.Union(a.Select(x => number / x)).OrderBy(x => x);
        }

posted by Ad hominem at 7:35 PM on January 31, 2011


OTOH inflicting Javascript on some poor person as their first computer language has got to rank right up there with ripping out fingernails and waterboarding as a way to scare people away from what you want them to experience.

...

A much better approach to this IME would be an 80's-style text and line number style BASIC implemented in Javascript

Ya know, I'm not opposed to BASIC derivatives for teaching or anything. I learned a lot from 'em when I was just getting started. That said, I think straight up JavaScript in the modern context shares some important properties that environments like QBasic had for me in the mid-90s: Ubiquity and immediacy. There's a browser everywhere, and you can make it do something interesting right now...
posted by brennen at 9:39 PM on January 31, 2011 [2 favorites]


...that said, the code I make my living writing mostly exists to sell people Arduinos and related sorts of things, and though I'm not much of an electronics nerd myself, that kind of platform is where I'd be tempted to start a beginner these days. Writing C to target a microcontroller is its own special kind of gnarly and sharp-edged, but the scaffolding has gotten pretty good, and there's a wonderful sort of down-and-dirty sense of the fundamental about the whole thing: Here, make this light blink.
posted by brennen at 9:44 PM on January 31, 2011


For those who already make web pages of any sort, I'll second considering a try at javascript. Not as a way to learn "serious programming skills" (no way to sort out that controversy these days) but as a way to accomplish useful things quite quickly that you may use daily. No language or compiler to buy, it's in your browser (and today's debuggers are quite handy).

It really helps to have a decent book to help you with the questions of syntax (although W3Schools is certainly good for the basics). I grabbed O'Reilly's. I've started learning many languages by taking a -working- program/routine that someone has done and modifying it or expanding it for other purposes. You start with something that works, modify it, learn what went wrong and how to fix it.

Why? It all depends on what you find satisfying. If you're making web pages, you'll find JS will greatly expand your ability to customize. You'll learn enough about programming that you'll stand a better chance of "choosing wisely" if you move on to a more full-featured language (that can actually write files!)
posted by Twang at 11:23 PM on January 31, 2011


You'll learn enough about programming that you'll stand a better chance of "choosing wisely" if you move on to a more full-featured language (that can actually write files!)

It might be observed, too, that in many ways modern JavaScript is a really capable language. It lacks some of the trappings of more general-purpose tools, but it presents a lot of interesting fundamental building blocks. I wish I'd gotten my head around the utility of first-class functions years and years earlier; people learning idiomatic JS are going to get that pretty much for free, the same way I used to take it for granted that of course you could just set a screen resolution and draw some circles or whatever.
posted by brennen at 12:13 AM on February 1, 2011 [1 favorite]


If I were designing a course for the autodidact who wants to learn to program, I'd say that he should read a couple of books.

Yes and I'd start with the subject at 10 years old in 1981.

There are a bajillion ways to learn to program. That Lifehacker of all places runs this particular oddly thought out tutorial is kind of weird but in the end it covers the basics and that's that.

JavaScript is no more idiosyncratic than any other language - weak typing in JS vs having pointers shoved down your throat in C or syntactical whitespace in python or needing a piano keyboard in APL, etc, etc.
posted by GuyZero at 9:54 AM on February 1, 2011


I would say that JavaScript is actually quite a bit more quirky than most general purpose languages. Some of its behavior is downright odd (= vs. == vs. ===) or confusing:
''        ==   '0'           //false
0         ==   ''            //true
0         ==   '0'           //true
false     ==   'false'       //false
false     ==   '0'           //true
false     ==   undefined     //false
false     ==   null          //false
null      ==   undefined     //true
" \t\r\n" ==   0             //true
How about return?
return {
   id: 1234,
   je: 5678
};

return
{
    id: 1234,
    je: 5678
};

return
  2+2;
Which of these statements fail?

Now, regarding your other statements: posted by sonic meat machine at 2:58 PM on February 1, 2011


isIdiosyncratic(lang) is a macro that I have hard-coded in my preprocessor like this:

#define isIdiosyncratic(lang) TRUE

Measuring the degree of idiosyncronicity is a meaningless and completely subjective exercise. I still consider languages that don't terminate statements with semicolons to be odd. That I think this doesn't actually make these languages odd. 

JavaScript equality is no worse than the ubiquitous PHP's equality tests and not much worse than explaining why Java has a .equals method on all objects. Or warning people not to overload = in C++. Or explaining why you can use = but not < and > on C pointers. Or showing somebody how to use paren-matching in emacs or vi in order to write simple Lisp code. I'm sure I could find a bunch of Ruby examples if I knew anything about it.

And nobody uses APL because they stopped making the keyboards for it. That's the only reason.
posted by GuyZero at 3:09 PM on February 1, 2011


There are idiosyncrasies in every language, to be sure, but they can also be a "language smell." The more idiosyncrasies there are—and the more common the situations to which they apply—the harder it is to work with them in complex projects. (See also Perl.) I think JavaScript is better than PHP, especially in this regard, but I still think its bones show a little too much to be a beginner language.

As for APL, well, it was written for line printer terminals and optimized for disk reads, but its symbols are hardly its only problem.
posted by sonic meat machine at 3:41 PM on February 1, 2011


A number variable couldn't be more straightforward because all number variables store are numbers.
Except for that whole floating point arithmetic thing. Ask Intel about how straightforward numbers are.
posted by sanko at 7:52 PM on February 1, 2011


« Older Residents of the unique town of Crestone, CO (and ...  |  Filibustery, making the filibu... Newer »


This thread has been archived and is closed to new comments