6 ms·
I haven’t given up on PHP — yet
- scorxn 18y agoSummary: PHP is cluttered, people like to bitch about it but use it anyway, sometimes frameworks are good. The 'yet' is merely a weak thread through the vague, obvious noise. I want my 10 minutes back.
- swombat 18y agoAs an insider, it’s actually funny to see endless discussions on newsgroups or the latest PHP-bashing entry on the Slashdot-of-the-day web site where people who aren’t familiar with our platform disdain its ludicrous awkwardness while marveling at its popularity. I'm very familiar with PHP. I built my first start-up on it, and it was a costly mistake. I know PHP very well and loathe it for many good reasons. I think the author should try giving up on PHP now. He may well find that the world seems like a better place after that step.
- es 18y agoCould you name reasons why it was a costly mistake for you? Were there scaling problems or issues with maintaining existing code? I'm not trying to protect php, just curious.
- swombat 18y agoPHP's main flaw from my point of view is its ugliness. It's almost impossible to distinguish bad code from good code. All of it looks equally bad (well, some of it looks even worse). The downside of that is that you don't get the automatic "bad feeling" when you put in a hack. It just doesn't stand out like a sore thumb (like it would in Ruby), so it's very easy to ignore the hack. Since PHP is an extremely hack-friendly language, where it is very easy to take damaging shortcuts, and it lacks the feedback mechanism to make you aware of when you've taken a bad shortcut, every large PHP project seems to eventually end up the same: a monstrous pile of hacks, one uglier than the other. I don't have that problem with Ruby at all, for the record. Ruby is very hack-friendly too (even more so than PHP), but because of its natural elegance, whenever you do something plain bad it is immediately visible and remains so until you clean after yourself. I could talk about all the cruft in the global namespace, the lack of consistency in the API, the appalling OO implementation, the lack of a super-successful framework like Rails... but ultimately, what bothers me is the result of all those problems: ugly code that keeps getting uglier. Why did ugly code bother me with my first start-up? Because it is hard to care for ugly code. Once your beautiful start-up's code turns into a pile of spaghetti, you start to wish you were doing something else. And that's a pretty bad place to be when you are the sole maintainer of your start-up's code. It won't stop you from ploughing on - but it will slow you down a lot, and you don't need that when you're a start-up.
- justindz 18y agoIn my case, learning PHP before learning a language that (regardless of the language) was embraced by a more best/interesting-practices-oriented community would have helped me enjoy programming sooner.
- trezor 18y agoIf there were a product statement for PHP, it’d probably be something like "only a drunken Martian could come up with this." I know I'm pretty much stating the obvious, but this is the problem that will keep PHP cemented in its current state for years and years. Like everyone knows, and like stated in the post, PHP is riddled with inconsistent naming-convetions for functions, inconsistent parameter-order and inconsistent functional behaviour. Let's also not forget how 99% of the functions in PHP are "binary safe", like treating text like binary data is a good thing. There is code out there working on binary data and relying on string-operations to work properly. Let us for a second assume the PHP developers are actually capable of making good and thought trough decisions and just ignore that whole backslashed namespaces incident. If the PHP developers were to address the inconsistencies of the language and actually standardize on something, even with some decent refactoring-tools, this would still be a rather big undertaking and would no doubt lead to more bugs in the core framework until all the itches get sorted out. And for what? PHP is well known for causing applications to break between releases, but intentionally breaking and crippling all PHP code in existence? They might as well give it a new name and release it as something different than PHP all together. But why would anyone actually bother to do that? Does PHP as a language have any qualities not found in other languages? Does PHP, besides existing codebase which in this case would be a moot point, offer anything which isn't already offered everywhere else? For PHP to solve its problems they would have to abandon the only thing which support it as a platform. I postulate that PHP, in its current shaky state, is the way PHP will remain for as long as it is considered relevant.
- thomasmallen 18y agoDoes PHP as a language have any qualities not found in other languages? Yep. 1. Everything's a template. This is a double-edged sword. 2. mod_php is stupid simple. Makes deployment is a cinch. I'll update this list if I think of others, but these two are a boon for new and impatient developers alike.
- nir 18y agoAlso, very good user-annotated documentation (I don't know if this is still so, but it was when I started PHP) and a lot of existing code/libraries/applications (of varying quality) that you can use. The value of PHP is not in the language itself, but in the fact it is easy to pick up and easy to deploy. This often causes people with strong coding background to dismiss PHP, but empirically it seems most people care a lot more about easy deployment than, say, closures or namespaces (or even consistent function naming).
- eisokant 18y agoPHP definitely has its flaws and lack of conventions but for me that is what makes it beautiful. It's a language which has allowed me to grow as a developer over the years. If I look back at how I structured and wrote my code when I first started it's nothing close to how I code now. Since PHP allows so many different variations I didnt have to conform to one style but instead developed my own. If I would have chosen a different language to start with I am quite sure I would have given up on programming quickly. PHP has allowed me to learn from my own mistakes and create my own unique way of solving problems. Besides how I feel about it; it's been great for all the projects I've worked on and now for the first time I'm using a framework (Codeigniter) for my startup and it's proving to be even more solid and progressing my style even more. I believe PHP code is as good as its developer. Like mentioned in the article; you can paint a mess or a masterwork, all the colours and brushes are there.
- thorax 18y agoI have to second how well frameworks like CodeIgniter can help developers progress into cleaner code. Those modern tools discourage tightly coupled PHP code and they feel almost like an entirely different language. If you find that you can't stand PHP, you might want to take another look at these-- you'll find the code a refreshing difference from traditional "raw PHP" websites that people hack together early when they're learning.
- KrisJordan 18y ago10 years ago I wrote my first web application. I was hooked. The ability able to write an app that ran anywhere in the world was magical. My journey since has led me to PHP4 and the LAMP stack, away to C++ and Java and back to PHP5, away to C#, Scheme, and Python, and again back to PHP5. The truth is I have a love-hate relationship with PHP. The linguist in me abhors PHP sprawl and the pragmatist in me adores PHP’s simple execution model and practical ubiquity. Upon returning to PHP this September it felt both familiar and unsettling. The feeling of returning to the town you grew up in. Frameworks, like familiar faces, looked the same as when you last saw them just heavier and a bit more mature. Nowhere as spectacular as the framework heroes of other towns like of Pythonville or Rubyfordton. City council was still making unorthodox decisions like enforcing backslashes for namespaces. Yet downtown was booming- many of the greatest internet successes of the world had since established themselves here: Facebook, Flickr, Yahoo!, and others. So I set out to create an open source framework called "Recess!" which will be available on GitHub in preview form "any day now". I just recorded its first screencast that dives into how it Recess! handles routing. Interested to hear your thoughts: http://www.recessframework.com/screencasts/routing/index.html http://www.recessframework.com/screencasts/routing/index.htm... (disclaimer: the flash video may be slow to load - until which you'll see an empty black page)
- raamdev 18y agoI started programming when I was 12 and sadly my path to PHP looked something like this: QBasic -> Visual Basic -> HTML/CSS -> PHP With what I know now (various bits of Java, C, bash, Python, OOP, etc), I wish so much that my path to PHP looked more like this: C -> Bash -> Java -> HTML/CSS -> PHP Everyone who uses PHP professionally knows that it's extremely easy to write crappy PHP code. While PHP is easy for beginners to learn, it's equally as easy for them learn bad programming habits. After 15 years, I'm finally putting in the time to learn the language I should have started with: C. I really wish it was the first language I learned because it would have made learning other languages so much easier (and learning those other languages would have made me a much better PHP programming when I started using it). I believe every language has its uses and PHP is no different. While its a shame there is so much crappy PHP code out there, open-source projects like WordPress have shown it has its place. (If WordPress themes and plugins were not so easy for non-programmers to learn how to create and modify, I don't think WordPress would be where it is today.)
- dshah 18y agoMy evolution is like this: Pascal (object oriented) -> C++ -> C# - > PHP Despite a reasonably strong background in developoing software, I've found it way too easy to build crappy code in PHP. But, I think it's as much me as it is PHP. Perhaps PHP brings out the evil that is lurking inside of us as programmers?
- raamdev 18y agoOr perhaps humans are lazy by nature and, since PHP does a very bad job of keeping us in line, the less disciplined of us end up writing bad PHP code. Of course, if we don't know how to write good code to start with, it's not PHP's fault. I think the simple fact that you can write good, elegant PHP code goes to show that it simply demands a more disciplined programmer (or a framework to help with that discipline).
- trezor 18y agoAs someone who mainly write (and get to maintain) C# code these days, I have to say C# (nor any other language I've seen) sadly doesn't stop people from writing utter shit code. It does no doubt seems more prominent in the PHP world though.
- old-gregg 18y agoI apologize for an off-topic, but this question has been itching for a while and I just couldn't resist: "... did so specifically to solve his or her immediate problem in a manner that catered to his or her unique needs ..." I understand that speaking/writing like that you come across as a super-cultured, modern liberal or whatever, but am I the only one who finds this bastardization of English awkward? I've learned this language about 8 years ago at the age of 23 (relatively recently) and even then it wasn't so crippled by such idioms, and to this day every time I stumble upon a sentence like that, it pings my ear, kinda like seeing "chickenfucker" in the middle of Declaration of Independence, totally out of place, out of context. Does anyone else feels this way?
- fizx 18y agoKind of like "cease and desist"? Doesn't cease have the same meaning as desist? I read that the legal doublespeak comes from English roots. When the Anglos and Saxons had to start getting along, their lawyers had to use a word from both languages. Big [citation needed] here, so I hope someone obliges. I'd love to know the truth. But back to "his or her." I often use simply "her," to be both consise and politically correct. ;)
- old-gregg 18y agoAfter some googling I found something: http://plover.net/~bonds/genderedlanguage.html http://plover.net/~bonds/genderedlanguage.html "... The problem is that in the English language, the "traditional" gender-neutral form -- "his" -- happens to be the same as the masculine form. And to say or imply that an arbitrary or unknown person must be male, as those who use "his" are claimed to do, is discriminatory... "
- JoelSutherland 18y agoMost style guides have something like the following: (taken from Princeton's style guide) Don't say “he” when referring to an unspecified person. Instead, recast the sentence into the plural, or avoid the use of pronouns altogether. Example: Each student is expected to turn in his paper by the deadline. Better: Students are expected to turn in their papers by the deadline.
- wenbert 18y agoPHP is a tool. Just like all other programming languages. If PHP can be used to solve your real-world problems then okay - Go for it. It's free, easy to use, the documentation is the best there is And lots of frameworks to choose from. If not, then use something else. But for me, after a few years of coding PHP, I haven't had anything that PHP can't do for me (in terms of web development). Especially these days that Code Igniter, Zend Framework and the likes are going more mainstream... EDIT: just wanted to add that I have been wanting to use Tools like Ruby on Rails, but when I think of it -- it is so much easier to do this and that in PHP. i have read books on RoR, etc. but haven't find the time to implement on a real-world project yet. maybe it's just me or that i'm too lazy :D
- KevBurnsJr 18y agohttp://www.symfony-project.org/ http://www.symfony-project.org/