4 ms·
This article includes the same false assumption of just about every other article on PHP: PHP is Easy I'm not sure how anyone can claim that a language wh
by wvenable 18y ago
This article includes the same false assumption of just about every other article on PHP:
PHP is Easy
I'm not sure how anyone can claim that a language which only exposes the underlying C API of all the included libraries could be considered easy. Does no one stop to think that the reason 99% of PHP code is bad is because the language is actually hard? It's the C of scripting languages; it doesn't include a lot of fancy constructs or high-level abstractions. And, like C, that's what makes it powerful.
I think confusion exists because PHP is extremely accessible. It's intimately connected with the web environment (more so, and less securely, in the past) making it quick to get started. But that has never made it easy.
- jayair 18y agoI understand what you are saying but I think most of the articles that say PHP is easy, they mean easy to set up and get started. I guess the right term would be as you said PHP is accessible.
- wvenable 18y agoThis article says "I think PHP is a great language for anyone to learn how to program with." So he clearly thinks PHP is easy rather than just merely accessible and I couldn't disagree with him more.
- wyday 18y agoYou're making the assumption that C is hard. C was the second language I learned (after QBasic), and it was easy enough to make working rinky-dink applications even as an ignorant preteen.
- shader 18y agoCompared to many of the alternatives at the time, php was easy. Until you are trying to make a large application that needs lots of abstraction and careful architecture, it stays easy. It is very easy to get something to work quickly in php, it's just hard to maintain a large project in it. And it is much more accessible than almost anything else when it comes to web programming. Compared to rails even, php is a snap to set up and use. Rails has the disadvantage of being a framework, which means more learning up front. Php has the disadvantage of being (until v5) almost impossible to organize coherently, and so becomes hard to upgrade later. Php is easy; until you've gone too far to turn back. :( That's why it's dangerous.
- wvenable 18y agoYou can build projects that large and easy to maintain in PHP, but you won't find many examples of that in the community. You can organize your PHP5 code just like almost any project in Python, Java, or .NET. But you do have to write a lot of code that isn't necessary in those other languages because they already have it included (and it's the standard way to do it). I find most PHP code in the wild totally appalling. It's easy to blame the tool.
- anc2020 18y ago> I'm not sure how anyone can claim that ... could be considered easy. PHP is Easy, and it's easier than Perl, I'd be surprised if you argue with me on that. PHP has very little to trip you up mentally (or at least that was definitely the case when it started winning). No closures, "arrays" are just hashes etc. PHP is not hard. Actually the hardest thing about PHP could well be its dynamic variable names, like $$foo. Neither is PHP powerful, it is extremely un-expressive when compared with just about any other modern programming language. With PHP you _just_ use the clean wrappers on the C API, and that is also easy to do, no knowledge of C required at all. It's so easy you can pretty much write PHP apps without knowing that "4" is any different from 4. I don't know if I've convinced you, but honestly, I would have a hard time making a language that was any easier.
- wvenable 18y agoPHP is a simple language, but that doesn't make it easy. PHP does give you enough rope to hang yourself, and unlike most other languages with a similar property (like C, C++, and Perl) PHP gets too much blame for that. I think Python is a far easier language. No $'s, much greater consistency, more available abstractions. You can pretty much handle most of the common complaints of PHP and build very large complex code bases, however, you have to put in the work. Other languages have that work already included.
- anc2020 18y agoAh, well this is where we differ, I'd say PHP is easy, not simple, and that Python is simple not easy. My reason for feeling that way hinges upon Python having more available abstractions. Scheme is an exagerated example of this. Continuations are a very simple idea, you can describe call/cc to someone without much hassle. But the implications of call/cc can be very difficult to grasp. The closure is a lesser example of a simple, pure abstraction which allows complex code through this devious form of simplicity. So that is (pretty much) why it is very easy to reach expert level in PHP but very very hard in Scheme. At the end of the day, what's easier to learn: closures, or the fact that a callback (in PHP) is supplied by giving its name as a string? Its easier to not learn something than it is to learn it :)
- rbanffy 18y ago"It's the C of scripting" No. C is a very elegant, if somewhat minimalistic, language. PHP is a kludge made of all sort of functions cluttering the only namespace there is. While K&R clearly understood the value of separating language from library, PHP deliberately ignores this lesson. I heard the most recent version (or the next, maybe) will support namespaces. It started as a quick-and-dirty solution for writing dynamic pages and, sadly, it shows. I somewhat fail to see the power of a language as something derived from lack of fancy constructs or high-level abstractions. And, BTW, C has a lot of fancy constructs and high-level abstractions: you just have to point the right libraries to the compiler/linker. I am sorry to tell you, but the main reasons PHP is so popular are the low cost of labor and the lack of interest by a large group of self-appointed programmers in learning anything, as you say, fancy.
- wvenable 18y ago"PHP is a kludge made of all sort of functions cluttering the only namespace there is" Yeah, how many namespaces does C have again? If you were to write a web application in C with all the same open source C libraries as are available for PHP, your only namespace in C would look almost identical. "While K&R clearly understood the value of separating language from library, PHP deliberately ignores this lesson" Ironically, this is exactly what made PHP successful. Everything is included in the box. It wouldn't have been half as successful without including every useful library they could find. "C has a lot of fancy constructs and high-level abstractions: you just have to point the right libraries to the compiler/linker." You're not going to get closures, classes, meta programming, etc, etc, from libraries in C. And guess what, PHP has libraries too!
- rbanffy 18y ago"Ironically, this is exactly what made PHP successful. Everything is included in the box. It wouldn't have been half as successful without including every useful library they could find." I am all in for including interesting stuff, but not at the expense of forcing everything in at once and thus cluttering the only namespace people have to work. While C has only one namespace, you only include the libraries you need. "You're not going to get closures, classes, meta programming, etc, etc, from libraries in C. And guess what, PHP has libraries too!" While C has no syntactic support for closures and classes, C programmers learn how to build them from scratch (or use some other person's library to support that - after all, C++ stated as a preprocessor that generated C code). Are you sure you are familiar with C?
- deleted 18y ago[deleted]
- rbanffy 18y ago"It's the C of scripting languages" Really, it's the BASIC of scripting languages.