ThinkPart

Andrey's blog

 

Maybe PHP should be the first programming language learnt

 

My girlfriend is a freshgirl at the local University of Applied Sciences since beginning of March. She chose to study Computer Science. Maybe affected from the area of my own studies.

Her schedule is pretty packed. She has to take a course in discrete mathematics, hardware basics, algorithms and data structures as well as computer sciensce basics. CS is really new to her. She knows how to use a computer and she learns quick. Has no problems with Windows and Mac, which is promising. However, she needs to start programming. When I started my first bachelor in 1998 one year long I was taught to program in Pascal and Object Pascal. This wasn't new to me as I started in 1992 with (Q)Basic and in 1993 switched to Pascal. By that time I was at the high school. Pretty interesting was that the CS undergraduates had to learn Pascal while every other at the University learnt C and C++. Well, in the second year we had C and C++ courses, so we advanced. Java was shown in few sessions, nothing more. On the contrary was the situation at the largest University in my home city, Sofia, the University of Sofia. They started with Java.

Now, my girlfriend is facing the faith of starting her career with Java. But the simplest Java program has so many concepts which the newbie doesn't understand.

  • what is a class?
  • what is a method?
  • what is public?
  • what is static?
  • what is main?
  • what is String[]?
  • what is System?
  • what is System.out?

Compared to that, a simplest C program will be asked for the following:

  • what is #include?
  • what is int?
  • what is main?
  • what is printf?

And what should she ask if about the simplest program in PHP:

  • what is
  • what is echo/print

As you see from Java through C to PHP it gets simpler to bootstrap. PHP could be very simple, as C can be, without some things which the newbie might find complicated and will have hard time understanding (pointers, pointers to functions). Once the rookie learns some things he can be introduced to OOP without changing the language, just upgrading the knowledge. PHP is also very compact language. Code that does many things may be very well packed, but one needs to know many of the built-in functions. Yes, PHP doesn't have strict typing and is very dynamic by its nature but once the rookie knows the basics she might switch to Java and continue. Compared to Pascal, PHP has the advantage to have C-like syntax, which is also used by Java and of course C++ :). So, once accustomed to it other languages are just one hand away. Pascal is good for learning but very diiferent than C, C++, Java and it is a bit of a revolution in the way of thinking during the switch. I know it because I experienced it.

My gf just ordered "Java2 for dummies". I hope this will be an easier introduction and way to bootstrap than the ordinary Java book. As I said her schedule is pretty packed otherwise it would have been possible to start with a PHP book for dummies and then switch the language, but still then should would have ensalata mixta in her head.

Responses (8) to "Maybe PHP should be the first programming language learnt"

  1.  

    By your arguments, UNIX shell script is even easier to bootstrap.

  2.  

    In the first course, we used http://bluej.org/, together with the book, which is a pretty nice way to start with OOP/Java, as you can interact with the objects in a GUI (create objects, execute methods, ...) without having to know about static, main, String[] and so on. In fact, we never used the main method before the 10th week or so.

  3.  

    I don't think that PHP should be first language, exactly because many concepts could be left behind.
    as for Java - i think "Thinking in Java" is one of the best books to learn from.

  4.  

    Whilst (procedural) PHP is certainly easier to get to grips with, it's also a whole lot easier to make a mess with! It lets you get away with anything and allows people to develop bad habits. I would imagine that this is why stricter languages are taught to start with.

    Pete

  5.  

    PeteWilliams : Why not start with C++, very strict, very powerful, multiple inheritance, templates. It is hard for the people who can program to understand what hurdles the ones that have to learnt it face. You start with the small things, the easy things. In the first grade you got nothing more than how to add one-digit-number. And yes, one can build a mess with Java too. Take for exampel usage of exceptions for return values.

  6.  

    Why not start with Python?

  7.  

    Because Python syntax is very different from the C and Java syntax.

  8.  

    My first language at uni was OCAML, but depending on your professor it could've also been another ML dialect like SML. A friend of mine had Scheme in her first year (different uni). I notice the trend that German universities are more and more starting with a functional language before switching to (mostly) Java or C++, as I've also heard about Haskell somewhere.

Leave a reply

Comments are disabled for this post.