Classes are great- they give you the deadlines and some basic knowledge, but like any other skill, it must be practiced to be fully developed. Programming can mesh well with online learning- the physical requirements (equipment) are pretty easily available. A class is great, it is only a complement to actually doing something, and that requires commitment from the student.
However, I think "programming" is just way too generic a designator. Knowing how to program is mostly about knowing syntax- it doesn't really show you how to actually do anything terribly useful- that's what the rest of your education is for. An online programming course is awesome, but only taken as part of a whole- the math, science, language, etc. education are also vital aspects to actually getting things done.
Ya'll hear about the geometer who went to the beach to catch some rays and became a tangent ?