One of the frequent things that I hear about programmers is that it doesn’t matter which language the person is using and which language you need him to use, because if he is any good he’ll learn and catch up pretty fast. In other words, if you take a decent Java programmer and push him to write PHP code for you, you’ll only have issues for a few days. Or weeks, at most.
I understand the reasons for this statement, but I don’t agree with it. At least not completely.
Firstly, the reasons. They are rather obvoius, but I’d rather stagte them anyway. Computer Science is not specific to any programming language. The concepts and approaches are more or less the same everywhere. Flow control, data structures, and algorithms are not language specific. Each language has its own best practices and recommended variations, but a bubble sort in PHP will be very similar to bubble sort in Java. Then you need some common sense, which is also not laguage bound at all.
Secondly, the disagreement. I think that the Computer Science theory and common sense aren’t the only things that make up a programmer. What makes a lot of difference is experience. Programming languages, in their practical applicatoin, are just collections of software – compilers, linkers, debuggers, libraries, IDEs, etc. Like any other software, programming language software has bugs, undocumented features, and Days When Things Don’t Just Work. It’s the experience with the language that teaches the programmer how to handle the issues of each software piece. And that experience is priceless (almost).
Even if you’d manage to push a Java programmer into writing PHP code, that would a waste of resources. A Java programmer is a Java programmer, not PHP programmer. He will, of course, learn PHP nuances with time, but, he’ll probably lose a part of his priceless (almost) bagage. Sounds a lot like misuse of resources.
Another part of my disagreement is not so much reasoned as emotionalized. I’ve seen a few C and Java developers switch to Perl and PHP for their new positions. Not that I was forcing them to or anything, but they did. And the switch was moslty painful to say the least. Here are some of the areas that I noticed as being hard to comprehend.
Compiling vs. interpreting. Those people who were used to their compilation process were missing something for the first few days. Some needed as much as a week to adopt, even though write-save-reload browser was done a few hundred times a day.
Debugging. There are two major camps here. In the first one are all those people who live in the debugger. They know all the keyboard shortcuts and they have their highlighting customized. In another camp are people of the simpler nature, those who use print() and die() for most of their debugging needs. It seems that most people coming from C and Java prefer the debugger way. Most of the interpretted languages do have either a standalone debugger or a built in debugging tool, but it seems that the majority of interpretted language crowd use the print() and die() approach.
Sigils. If you don’t know what a sigil is, read this Wikipedia page. Because you do know what it is. Many strong type language don’t use any sigils. Most of the loosely typed languages do. Furthermore, when both the language from which you are changing and the language to which you are changing use sigils, chances are there will still be a difference. PHP, for example, uses $ for both scalars and arrays. In Perl though, you’ll get a $ for scalar, @ for array, and % for hash. Perl’s sigils are extremely helpful when figuring out someone else’s code. I remember the pain of having just a $ in PHP, when I was learning it. And I can’t even imagine how confusing it is for people who are used to non-sigilized programming languages.
Types. As already mentioned above, strong typed language programmers can be often confused with the fact that variables can change their type on the fly, and that they don’t even need to be declared before use. Loosely typed language programmers will often complain about the requirement to define their types. Three of the most common questions that I’ve heard regarding this matter were:
- “How do I define an array of elements of a certain type of a certain length?”
- “Is this line a piece of non-sense or does it really do something: $sum += 0; ?”
- “What’s wrong with writing: int amount; amount = 2.5; ?”
There are, of course, more areas than just those – include pathes, include files, OOP, database abstraction, loops (“What the heck is foreach?”), memory management, libraries, and so on and so forth.
Even the list of the resources for each programming language takes time to build. Yes, time. And time is one thing that’s always against us. Everything else we ca handle.
For “any good” programmer, probably you are right. For “quite good”, you’re wrong IMO. I still believe that many strong programmers can adapt and get a feeling of various languages over period of time. Of course, these guys wouldn’t call themselves experts after one month of using it, but they will be pretty comfortable.
Now, note “many” in “many strong programmers”. Often strong programmers in one language will simply refuse to switch to anything else, mostly out of principle. :)
One thing that I’m noticing these days is that more and more (good) programmers are experimenting with other languages outside of their comfort zone. PHP developers are learning the way of Ruby (Rails), Python, Java, and more. Then they come back to their home language and apply concepts that they learned in other languages.
My own personal experience in this has actually been with C# and .NET. I think programmers should be encouraged to leave their comfort zone every so often. Not necessarily to become an expert in a new language, but so that they can learn to write a small-scale, non-trivial app in something they’re not familiar with.
Even when you’re not an expert, it can come in handy, down the road. A client that I’m working with now has a .NET backend with a PHP frontend, and I’ve had to do work on both sides of the fence. Now, I don’t even have a year’s worth of experience in .NET. I only have a class that I’ve taken in college and some previous experience at a former employer. I’ve worked in it enough to feel comfortable working on the .NET side whenever I needed to. Yesterday, I created a handler for image uploads to be posted to from a form on the PHP side. Not quite the largest thing I’ve done in .NET, but it was a learning experience, because I got to use aspects of C# and the framework that I hadn’t delved into on my own, yet.
hazard,
you’re probably right, since I don’t have much experience with “quite good” programmers. :)
I work and dine with several very talented C++ developers. They all agree in that every dedicated person can learn C++ and write quality software. In about 5 years.
Alexey,
well, that’s sounds good. Especially that PHP isn’t exactly C++, so dedicated people should take much less to start writing quality software in it. :)
Having done all Java, C++ and PHP… well, it was pretty weird to move from C++ to PHP initially… as you mentioned, the umm…sigils ( i have yet to get used to this word ).. and the strong vs lose typed language is yet another round of surprise..
However, once I got over that period and gotten used to PHP, everything just clicked, and this took about 2 weeks. PHP seemed like a perfect language to me, and I’ve worked with C++ for years… coming from a pascal/assembly language background..
What I had to explicitly do to convert between different data types in C was automatically done in PHP in a very graceful manner… that I believe someone coding in PHP can finish any job so much faster than a C programmer..
Then there were those who will claim that C is a lot more efficient and faster, etc.. and I wrote different PHP scripts and compiled C code to do benchmarks.. and unless the C programmers code is super efficient, in most cases the speed gained from the binary application is no faster than a PHP code in execution… PHP is that efficient and will probably lose to only the top 5% of C programmers..
I believe the true performance lies in the data structure and algorithms.. however, C/C++ does provide features not even available in PHP, such as multi threading and system level APIs..
One little secret I will reveal, though.. If you’ve done Assembly and understood it, you will be able to do any programming language… with a good understanding of memory management and pointers.. the world of programming is in your hands..