Linked by John Collins on Wed 21st Apr 2004 06:42 UTC
The purpose of this article is to give a novice programmer the basic idea of what OOP is, as implemented using PHP. Readers should have a basic knowledge of programming ie what variables are, variable types, basic methods of writing comments, and how to enter code into a text editor.
Permalink for comment
To read all comments associated with this story, please click here.
I learned OOP at the university level and they started us off with Java. I still think that is the best place to start because it is syntactically very similar to C. Ruby and Python are good examples of OOP languages, but they both have non-traditional syntax.
If your primary reason is syntactic similarity to C, then you should be telling people to start learning OOP with C++, considering that it began as a superset of C, and that C programming is still completely possible with many C++ compilers.
The problem many people have when moving from C to Java or C++ is breaking the mindset that programming in C often brings with it. This is why learning OOP is often better done in a language with a non-C-like syntax to get the ideas firmly rooted in the mind of the programmer, and then let them learn the OOP syntax of C++ or Java, where they can return to familiar coding styles with the OOP ideas fresh in their minds.
Sticking with one familiar syntax for every piece of code you ever write doesn't really help you in the long term. Over the last 5 years I've had to learn 4 programming languages, 2 of which had C-like syntax, and 1 of which was similar enough to a C-like syntax to get by. In the end, I found the 1 language that did not use C-like syntax was what got the job done for 3 of those 5 years, and in the last 2 years I've had to use a blend of C, C++, and C# to get what I needed. I certainly prefer these languages, probably because C was the first language I learned (8 years ago), but I often find myself looking to other languages to learn new concepts, even if they're available in one of these C-based languages, simply because it's easier for me to pick things up at the conceptual level when I'm not trying to use familiar syntactic elements in new ways.
I learned OOP at the university level and they started us off with Java. I still think that is the best place to start because it is syntactically very similar to C. Ruby and Python are good examples of OOP languages, but they both have non-traditional syntax.
If your primary reason is syntactic similarity to C, then you should be telling people to start learning OOP with C++, considering that it began as a superset of C, and that C programming is still completely possible with many C++ compilers.
The problem many people have when moving from C to Java or C++ is breaking the mindset that programming in C often brings with it. This is why learning OOP is often better done in a language with a non-C-like syntax to get the ideas firmly rooted in the mind of the programmer, and then let them learn the OOP syntax of C++ or Java, where they can return to familiar coding styles with the OOP ideas fresh in their minds.
Sticking with one familiar syntax for every piece of code you ever write doesn't really help you in the long term. Over the last 5 years I've had to learn 4 programming languages, 2 of which had C-like syntax, and 1 of which was similar enough to a C-like syntax to get by. In the end, I found the 1 language that did not use C-like syntax was what got the job done for 3 of those 5 years, and in the last 2 years I've had to use a blend of C, C++, and C# to get what I needed. I certainly prefer these languages, probably because C was the first language I learned (8 years ago), but I often find myself looking to other languages to learn new concepts, even if they're available in one of these C-based languages, simply because it's easier for me to pick things up at the conceptual level when I'm not trying to use familiar syntactic elements in new ways.