4 ms·
Try Facebook's Hack if you want all the nice stuff of PHP and modern language features. PHP still beats the pants out of just about any other language out ther
by Apofis 12y ago
Try Facebook's Hack if you want all the nice stuff of PHP and modern language features.
PHP still beats the pants out of just about any other language out there in the ease of use department if you want to build websites and is fairly simple to learn. Once people pick up PHP, then they usually start exploring other languages that are more involved and strict.
All this PHP hate is really discouraging to beginners.
- imakesnowflakes 12y ago>PHP still beats the pants out of just about any other language out there in the ease of use department.. This is not true. Why is it easier than, say, Ruby >Once people pick up PHP, then they usually start exploring other languages.. But since they are already brainwashed from PHP use, it prevents them from seeing the value of doing thing the proper way, and might see the process as contrived. This is the most dangerous aspect of using PHP. It blocks your learning and understanding. It pulls you down and keep it there. A good example is the use of PHP arrays. It is a combination of different data structures like list, dictionaries, sets etc. But because it is a combination, you wont be able to use it as a list, or a dictionary or as a set to the fullest extent. And you will be so used to using this for every situation that you might be put off by lack of similar data structures in other languages, and blocks you from seeing the value of using the right one for a particular situation. So I request every one who is passionate about programming and wants a career in programming to keep away from the php language and community as much as possible.
- e-tron 12y ago"So I request every one who is passionate about programming and wants a career in programming to keep away from the php language and community as much as possible." <-- keep away from php and focus on (which language)?? "And you will be so used to using this for every situation that you might be put off by lack of similar data structures in other languages" <-- http://php.net/manual/en/spl.datastructures.php http://php.net/manual/en/spl.datastructures.php "and blocks you from seeing the value of using the right one for a particular situation." <-- technically, i do think that the average coder who works in javascript/php/ruby/php/(insert other script languages here) fails in using the proper datastructure for the problem
- mappu 12y ago>But because it is a combination, you wont be able to use it as a list, or a dictionary or as a set to the fullest extent Can you elaborate on this? Any specific examples? Lua and Javascript work similarly with one combined array/dict type. Also the PHP SPL exists, providing some other container objects like heaps and some traversal algorithms, analogous to the C++ STL.
- imakesnowflakes 12y agohttp://3v4l.org/GIn4Kt http://3v4l.org/GIn4Kt The above code shows php silently converting numeric string keys into integer keys. This ends up breaking the concept of a dictionary and prevents it to be used as a proper dictionary. Now if you want to use it as a set. This wont work http://3v4l.org/NZYsj http://3v4l.org/NZYsj Also, These are the following are the functions that are supposed to be used when you want to use an array as a set. array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_diff array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_intersect Consider the fact that arrays can have mixed numeric and string keys, and consider the fact that php converts numeric string keys into integer keys, and consider php weak comparison rules (2=='2'), and how do you feel about using the above functions for set operations? You see, the php philosophy is to compensate a lack of depth with a whole lot of breadth. Instead of demanding the user to understand different data structures in depth, it provides one data structure that requires very little understanding to get started, and cover the drawbacks of with a number of functions, edge case rules, and undocumented weird behaviors (resulting from different combinations of documented, but unintuitive behaviors). So the end result is you got away with only having to learn one simple data structure. But if you want to use it reliably, with the provided library functions, you need to keep an encyclopedic knowledge of the aforementioned edge cases gotchas. This is true with a lot of aspects of PHP. PHP is like a cheap-shitty-dangerous car that you can acquire with very little down payment on a loan with a huge interest. >Javascript work similarly with one combined array/dict type. Javascript have combined array/dict? How come? >Also the PHP SPL exists.. It does not matter, People starting with php won't be aware of these pitfalls to go looking into SPL objects.
- 12y ago
- pbowyer 12y ago> This is not true. Why is it easier than, say, Ruby I can set up hosting for a PHP website without thinking. With Ruby, unless something has changed in the last 6 months (I sure hope it has) it takes me a lot more effort. Ease of use is the entire ecosystem, not just writing programs in it.
- madawan 12y agoRuby is just "gem install rails", but IMO this discussion is misguided: initial setup time doesn't make much difference in the long run. If we're talking "how easy can a user get started", JavaScript wins by far. But that doesn't mean I'd recommend people using it.
- pbowyer 12y agoI disagree with you - "gem install rails" is setting up Rails, but not what I was talking about: hosting the result. I wonder if PaaS providers like Heroku would have taken off so quickly if Rails apps had been easy to set up the hosting for? It would explain their popularity outside the PHP community.
- philstu 12y ago> But since they are already brainwashed from PHP use, it prevents them from seeing the value of doing thing the proper way, and might see the process as contrived. This is the most dangerous aspect of using PHP. It blocks your learning and understanding. It pulls you down and keep it there. After 10 years of writing PHP I took a look at Python. I was confused for about 10 minutes, until I read about lists and dictionaries and saw they were different things. Who are these people who are just trying to write other languages without looking at the "getting started with data structures" page in the guide, or reading a single book? And why is learning something flexible and easy before learning something more advanced a problem? > So I request every one who is passionate about programming and wants a career in programming to keep away from the php language and community as much as possible. I was writing PHP for a living for a decade. I did a bit of Ruby along the way because it's all the same and who cares. I was then invited to CTO at a tech startup in NY, giving me a visa and moving me from the UK. I replaced their shittily built Rails API with a PHP one which was 3x faster, did 10x more and was actually tested properly. Very handy. Now I work for another company, Ride.com. We're building an API in Rails and it feels just like the one I built in PHP using Laravel. Almost identical. This comapny got me a visa known as "The Alien of Extraordinary Ability" in which my PHP code was used as the basis of my skills. All of this leads me to think: What the fuck are you talking about. 1. Languages rarely matter. 2. PHP is just fine. 3. PHP will not fuck up your career. 4. PHP will not ruin your ability to learn new languages. 5. You are an actual idiot. Stop preaching ignorance and get on with writing software.
- Apofis 12y agoYou specifically omitted the second part of my sentence in your first quote to try to prove a point. I won't even bother reading what you have to say.
- smt88 12y ago"Ease of use" often leads to "impossible to maintain". Strictness is one of the best features of any language in the long term, and it rarely results in much more thinking or typing. If you don't know what type you want something to be, you're not designing your code right. Why not let the compiler know while you're at it?
- aikah 12y agoThe opposite is also true.I've seen my share of unmaintainable code in Java. The fact that a large number of PHP users aren't developpers but just want to add some code here and there explains why a lot of PHP code is ugly.But if PHP didn't exist and the same people were forced to use java you'd see a lot of horrible JSP code instead ...
- mercurial 12y agoYou can write terrible code in any language. The problem is that code in dynamic languages, especially combined with weak typing and no tests, is tremendously harder to refactor without introducing regressions.
- smt88 12y agoLet me rephrase my comment in a more controversial way, but something I absolutely believe from 16 years of experience. It is impossible to write maintainable code in a dynamic + weakly typed language. Instead, you have to rely on your IDE and unit tests to catch bugs. That leads to a huge amount of extra surface area: assertions, type checking, error-throwing, etc. In many projects, unit tests become technical debt and no one ever has time to write them! Then you're really screwed.
- marrs 12y agoWithin my first 4 years of professional programming I'd already proved you wrong on pretty much all of your points. I'd maintained and extended a large application, written in PHP and Javascript, without the aid of an IDE or unit tests.