“Five million, bitches”
—my new reply every time someone mentions Ruby
A friend of mine is learning to program, and how to learn a programming language came up.
There is a lot of people who are non-programmers or have taken programming classes and not yet learned to program. When I was a kid, those languages were BASIC, Logo, and Karel the Robot, now they are things like C#, Java, and Ruby. Still the same problem of “what programming language to start” rears its ugly head.
Recommending what you know
Too often, people recommend what they know best, learned first, or are learning themselves. Ignore these people.
The first language I ever became an expert in was Pascal. It’s a highly structured language that was great for learning. The last time I coded in Pascal was in 1991 in order to prove computationally that some differential equation doesn’t approach e^x but rather the curve e^x-1. It’s not a forgiving language to be programming in today, the popularity of Delphi notwithstanding. (I’m sorry, if you want to learn a language with OOP bolted on, you might as well put the C gun in your mouth, pull the trigger, and blow out your brain with C++.)
I don’t code in Pascal anymore. And I don’t plan to.
(I’m sure there is someone out there recommending people learn Erlang as a first language. I’d be offended, but I figure they’ll be dismissed because they long ago lost the ability to speak coherently.)
Filing for divorce
One time at a McDonald’s in San Jose, I watched a guy talk to about six different people in their native language. Asking that man how to learn a language is futile. He is so far removed from the “learning” stage that he forgot. He picks up languages as easily as I pick up new cuss words.
Then, it occured to me:
We’re that guy.
It’s hard for a programmer to give good advice on what language to learn because we’re so divorced from the learning part that we don’t know the answer ourselves.
Answering by analogy
But maybe that incident clues us in to the answer. If words have meaning through paradigm, the reason we call it a programming language is because it is a language.
Programming languages are a lot like real languages—maybe the best way to learn a language can be derived from how we learn real languages. You know you can learn it in a classroom, but immersion is a much faster way to learn.
The best way to learn to program is to have an itch that needs scratching.
If you have a need to program, then you will immerse yourself and learn fast. If you learn in a class, oftentimes it’s a lot like those years spent diagramming sentence grammar:
or memorizing declensions…
Sure, my understanding of the future-perfect tense has helped me write marginally better, but you’ll learn much faster and better if you really need to speak/write/use a language.
I believe the fundamental problem with most programming courses is that they’re more an exercise in “look how smart the teacher is” and the theory behind the language rather than actually learning the language. You can’t get more than ten pages into an introductory book on programming before being hit by a wall of terms like “object-oriented”, “run-time”, and “compiler”. WTF?
When I look back at how the best programmers I know learned to program, I remember the people who had staked out their own workstations in Caltech’s .
Not that I’d try to take their spot—you could smell the stench of stale sweat left over from weeks of working and sleeping at their workstations with nary a visit to the shower.
Now that is language immersion! :-)?
What language to learn?
I don’t think that PHP is the best language to be learning programming with—if only because it makes no sense as a first language. It’s a haphazard language that was really designed to be the easiest second language to be picked up if you already know other programming languages, and want the shortest distance to apply that knowledge to the web.
But as a first language? Hell, the language confuses the heck out of me!
However, there was a recent estimate that there are 5 million PHP developers worldwide. If true, that’s an impressive number. It makes PHP one of the most popular languages in the world, and more so, because it is a language that takes a back seat to Java and C when taught in universities.
But why are there 5 million PHP developers worldwide?
I believe it’s because the web is all about immersion. You have an itch (making a website) that you want scratched, and PHP makes that scratching pretty darn easy—you can do just about anything most people can think to do on the web for about $10 a month to a LAMP hosting service and a couple good open source downloads—no other language comes close.
Then again, there are 5 million PHP developers out there. If you want a job, learning PHP is not enough of a unique experience to warrant a set of experiences that will be valued. And someone telling me that they “know PHP” doesn’t tell me anythingother than that person has learned what
So I told my friend she should learn Python.
20 thoughts on “Learning Programming Part 1: 5 million”
I think Python is a great learning language – logical, powerful, yet simple enough in syntax and features to be understood by beginners.
But then again, some people recommend Scheme as the perfect learning language. Go figure.
I learned Scheme as one of my very first languages. Mostly I felt like it got me immersed with recursion and RPN. Other than that, Pascal and C got me more into programming than anything.
I don’t think that PHP is a bad programming language to start with, and on the other hand you are right, there are a lot of programmers out there that only know how to use mysql_query and don’t know what is the difference between a for and a while. The advantage of PHP is in feedback.
Then again in highscool and college I’ve seen good C++ and Pascal programmers who were very disappointed because they didn’t understand what to do with the language in practice.
I actually think PHP would be a good first language.
Yes, you’ll have to have some discipline to understand why and how it is so “diverse” in syntax and parameter / structure.
But the very thing that makes it easy to pick up, and usable from Day One is what will motivate students to push themselves to go further.
I’d relish the opportunity to teach PHP in an evening course as a first language somewhere!
There are 5m+ PHP users because (1) “everything is a template” simplifies things for the beginner, (2) the standard library is pretty much the DSL for web programming, and (3) mod_php is unbelievable. But the language’s fundamentals are pretty poor.
Python is great too, but I think JS is friendlier to the beginner.
I think Python is a great language to start with. The command line interpreter is great for sandboxing code snippets in.
My vote goes to Python. It’s required tab indentation, FINE documentation, ease of installation and execution on any platform helps a lot. Not to mention it was written with a lot of care.
Thanks for all these comments!
Over all, I think the best language to be learning for the first time is one that “scratches an itch” because immersion (or internal motivation) is the most important thing. If that itch is building your own “personal home page” (a la Rasmus), then PHP is a fine language…possibly the best.
Ok, Ill bite.
I think PHP is probably the best language to start learning with for a great number of reasons. The language itself I think is pretty easy to understand and arguably clean despite the fact that the built-in/standard extensions (string, array, filesystem, even the SPL) are non-conformal and appear disorganized at best.
The primary reason is that PHP is a multi-paradigm language. By default, it lends itself to being a web templating engine since without a PHP tag, its simply in pass-through mode, making it easy to get visual cues on how variables and simple control structures work. Then as programmers become familiar with language basics, they can experiment with a more procedural/imperative paradigm by introducing functions and more complex control structures. Finally, after a developer has a handle on that, they can experiment with the OO paradigm of programming- (classes, members, visibility, etc.) If they really want to jump in the deep end after that, they can visit more complex concepts like namespaces and closures (and maybe traits in the future).
PHP, when set with error_reporting on and E_STRICT in place, can be extremely vocal about the types of errors and coding violations that a programmer might encounter when running and developing their application or scripts. Not only is it vocal, but its pretty concise as per what it expects to be in place (think of how Java gives you 1kb worth of backtrace when you take a misstep there.)
Lastly, there is a rich ecosystem around PHP. There are several one-click installers and stacks: Zend Server, XAMP, WAMPServer, MAMP, etc. There is also tons of color coding support in text editors, as well as a few true IDE’s that can comprehend the PHP language and guide you in development. Also, there is a super helpful community that surrounds PHP: #php, #phpc, #phpwomen come to mind. Oh, and about 7,650,000,000 pages on the internet that reference the acronym; or so says google. Heck, you could even just use the php cli for running scripts.
And I am not just saying this b/c I work at Zend 😉 I am also not saying this to discredit the fact that Python (and arguably Ruby) too is a great language to use to learn programming concepts.
@Ralph Schindler: I agree with a lot of those points, but I’ll point out a great many of them assume the web is that itch. When it comes to the multi-paradigm ability of PHP, I find that this is a huge boon in development, but I wonder if this is not so much in learning (a language for the first time).
Similarly, when developing a website, I often start the same way… direct static HTML, separation of dynamic pars, separation into functions, separation into objects to build a robust architecture. PHP offers that in a way that Python and Ruby do not…even stellar frameworks like Rails and Django encourage a rigidity of code that does not compare.
However imagine if you will a first time programmer with no knowledge of HTML or unix systems. Open up one of the best selling textbooks of all time “PHP and MySQL Web Development” by Luke and Laura and try going through the first chapter on a Mac OS X computer (arguably easier than on Windows). You have to know what terminal is, how to start up Apache in the Sharing preference pane, how to get PHP activated (and restart apache), how to install MySQL (and set it up), where to put your scripts to be accessible, what the URL is for said script, not to mention how to get Text Edit to allow you to edit files with the .php extension instead of tacking on a .txt. All that, and knowledge of HTML is assumed! All this before even getting 10 pages into the book, with no help from the text itself.
I think it’s really intimidating.
In fact, I’m sure of it.
After that chapter, I’d say that book offers the more “immersion” gratification (at the least cost) than any other language’s textbook. The chapters are easy and by the end of it you have an eStore written and working from scratch. What do you get at the end of the Learning Python book? And how easy was each subsequent chapter? I’d say much less and much harder.
It’s that first chapter that does the first timer in.
Eugene Wallingford discusses this (and finds some typos). Thanks!
Eugene continues here with a discussion on Chapter 1 of introductory text books.
Having to watch my friend slog through the first four chapters of the Learning Python (O’Reilly and Associates) book, I think it apropos to say that people writing introductory textbooks needs to find a non-programmer try to go through the first couple chapters of their books. It’s terrible the terminology (often unnecessary) that is front loaded in these books and the dangerous assumptions that are made—like for instance, trying to explain how to do things in Unix and Windows and never mentioning that Mac OS X is a unix system, or that the current directory may not be in your path, or explaining it once in Windows but forgetting unix entirely, or devoting three sections about what language the runtime is written in to a beginner (not to mention, these sections thesis is actually incorrect!
People learn differently, and that makes it difficult to write for everyone’s learning style. But to throw in data only someone versed in programming can understand, and incorrect data at that, that will confuse and frustrate everyone. That approach is simply inexcusable.
It is a shame what passes for “a great programming book” today. 🙁
Lego Mindstorms NXT-G is the best introduction to programming – no doubt!!!
My son at 8 is building and programming Lego robots like crazy.
He already understands basic programming concepts like loops, branching, variables, conditions, and even functions (creating and reusing chunks of code-blocks). He also starts to get the idea of passing information between code-blocks (API’s) and all the mess around programming, like compiling, downloading, testing, debugging, and all the other stuff you need to know but never really learn.
It takes 5 minutes to start programming, and you immediately get response to your programs – Hey, why don’t the robot do as I told it? Let’s try and change this piece and see what the robot do now. And it’s great FUN too – and all the neighbor kids love to come and play with it!!! This is immersion in practice.
Another good thing with the Lego Mindstorms is that you get a basic low-level understanding of how computers work. You work with trancducers (sensors) and motors. Input/Output becomes second hand. You learn about electrical signals and a lot of stuff the majority of programmers never need to bother with.
I have a master in electronics and computer architecture – and I definately think Lego Mindstorms should be used in education. The Brick contains a 32bit processor, there exists gcc compilers for the Brick, it has its own assembly language and it is even possible to create your own transducers and output decives.
The very first language anyone should learn is their own, because most programmers can’t communicate effectively.
The second language should be assembly. Nobody understands how computers work anymore, and it’s important that they do.
After that, explain to them how the different language families are structured, and let them pick their own to play with. Then you sit back for about 10 years, and then you have a competent programmer.
Very recently I was at the point where I was learning the C++ language. However even if I read about the theory, I could not get the "itch" I could start scratching. That is a good point that to learn a programming language, we start with an "itch", that is if we have something that we can show off once we create it, it motivates us and makes learning the language more interesting.
My recent post How To Install Google’s Go Programming Language
My recent post Wow- My FIRST Yahoo Widget got 1000 downloads