From: David Masover Date: 2009-12-09T07:13:57+09:00 Subject: Re: Wordpress Port On Tuesday 08 December 2009 03:33:42 am Rimantas Liubertas wrote: > > First of all, PHP had object-orientedness tacked on after the fact. Now, > > this can be done well, and it can be done poorly. In PHP's case, it was > > done poorly -- I'd almost rather not use them at all. > > Are you talking about PHP4 or PHP5 there? It was PHP5, when I was doing this, but it was also a long time ago. > > By contrast, Perl implemented OO rather well, > > Now that's funny. How so? > > So the language itself doesn't lend itself to particularly high quality > > in the first place. > > You can write Fortran in any language. The question isn't whether you can or can't -- you can write Lisp or Ruby in any language, too. It's Turing-complete, and you can always write a preprocessor. The question is, what does the language encourage? Is it easy to write good code, and hard to write bad code, or vice versa? Is there syntactic sugar for good habits, and syntactic vinegar for bad ones? Compare any of these to C. You probably could write a web app in C. You probably could be about as efficient with it. You could be disciplined enough to never do pointer arithmetic, to never make assumptions about pointer size (and thus be 64-bit clean), to always use exactly the appropriate methods to operate on a data structure, and to maintain a consistent naming convention. You could commit to always using a proper string structure, rather than using null-terminated arrays of bytes. After all, Ruby itself is written in C, and I'm guessing PHP is, also. If you did it in C++, you could even fake some decent-looking syntax. The question is, first, do you really want to spend the months of development needed to make this easy in C? And second, wouldn't you rather have a language that makes this stuff easy, and makes it hard for you to accidentally use an uninitialized pointer, or make a buffer overflow? Think about that for a moment. In languages like Ruby and PHP, a buffer overflow is actually not possible. You might get it in a third-party library written in another language (like C), but you can't do it yourself. But in C, it's not only possible, it's a very easy mistake to make, and a hard one to avoid. > > Add to that, one of the problems PHP shares with Ruby is its low barrier > > of entry, being perceived as an "easy" language -- only PHP seems to have > > this to a greater degree. People who learn Ruby and Rails are at least > > trying to learn to program. People who learn PHP usually start as > > designers, who learn a bit of HTML and CSS, and need a tiny bit of > > server-side logic in their HTML page, so they learn a bit of PHP or paste > > a bit of code in... > > That's BS. I can argue there are plenty designers starting with RoR as the > first server side code that cannot tell Ruby from Rails. I'd agree with you. The question is, how much of each is happening? And, in particular, I see this happening in PHP with _designers_. I don't see nearly as much of that happening in Ruby -- they at least acknowledge that they're going to be _developers_, even if it's their first language.