20 thoughts on “Learning Programming Part 1: 5 million

  1. 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.

  2. 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.

  3. 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.

  4. Sorry Terry;

    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!

  5. 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.

    I think that JavaScript is best language for new programmers. It runs in the browser (easy visual feedback, like PHP), is easy to learn, and can be used in a very advanced fashion. The best tools for working with JS are free/browser-based as well (Firebug, JSLint).

    Python is great too, but I think JS is friendlier to the beginner.

  6. I think starting with a psuedo-prototypal language (JavaScript) could cause some problems. Closures are a key concept to the language that a lot of people have trouble comprehending.

    I think Python is a great language to start with. The command line interpreter is great for sandboxing code snippets in.

  7. I really don’t think I would recommend someone to learn Javascript as their first language. It requires the person to understand HTML and DOM as well. You probably want to start with basic stuff: variables, flow control, cycles, functions, input, output.

    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.

  8. Thanks for all these comments!

    PHP isn’t exactly the best language to those beginners who like to ask “why?” (Answer: because the C/Java/Python/Perl/C# library we based it on has a similar wording/ordering/style… or something.) This can get quite frustrating. The elimination of register_globals makes it much harder for beginners. Try teaching someone who doesn’t know programming or even HTML already PHP sometime. Compare it to someone who has at least coded a little Javascript or had some sort of structured programming class as part of their computer literacy. Big difference!

    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.

    Barring that, I feel (based on personal experience and trying to hire programmers) a language that serves as a strong jumping platform by enforcing a highly structured traditional (nowadays OOP) programming style is the next best—and Python fits that bill well. Scheme, Erlang, and Javascript have grammars that are not similar enough to traditional OOP languages to make a good starting point, IMO. It’ll have limited utility. (Then again, you’ll be a master of obscure solutions like recursion—a unique and creative thought process is important also.)

  9. 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.


  10. @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).

    For instance, as a person with experience in BASIC, Fortran, Pascal, C, C++, Objective C, Perl, shell scripting, x86 assembly, Java, and Javascript (as well as SGML, HTML, and XML markup), PHP was extremely facile for learning web development. It’s similarity to all of those languages, intuitive inline code, excellent web-based documentation and search, large extension sset, and ubiquity (on Linux at the time) all were big plusses. They still are after 10 years.

    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.

  11. 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. 🙁

  12. 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.

  13. 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.

  14. 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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.