Live data from Hacker News

PHP Sucks

evertpot.com

271–280 of 297 posts

Re: PHP Sucks

#271
post #249

Earlier quoted context omitted.

Python's method(self) is very useful. It gives the ability to call methods in the same way you use functions, which is what they really are. It allows you do things like map(str.strip, list_of_strings).

But why can't the interpreter/compiler implicitly add that argument to each instance method definition? There is no need for the programmer to type it. I understand that self plays also a role in the declaration of class methods but other languages found ways to do without method(self) and still have class methods. Java's static (coming from K&R) or Ruby's def self.method Anyway, that is the way of Python. A lot of p…

> But why can't the interpreter/compiler implicitly...

"Explicit is better than implicit" -- PEP 20

Python was the first language I ever learned and I just took it for granted that you had to manually specify "self" like that. When I see code with implicit self, it reads strangely to me. Like, "Where does 'this' come from? Oh yeah."

Re: PHP Sucks

#272
post #85

I started freelancing in my area doing Ruby on Rails, and found it far harder to maintain a project. I also found it harder to acquire clients in my area for new RoR development. More work was available locally with PHP. Clients were more willing to pay. I've done a ton of things in WordPress that shouldn't have been, "to save money". And I've done greenfield development with CodeIgniter, Laravel (v3 and v5), and a c…

RoR is chronically known for having issues with a maintenance of projects in a long term, so using this comparison is a very weak defense of PHP.

Citation please. Not at all disagreeing with you, I'm just interested.

Re: PHP Sucks

#273
post #156

Earlier quoted context omitted.

>I've felt for quite some time that most of the anti-PHP sentiment is an effort of other developers to justify the language they've selected to focus on. Would you be surprised if I told you that pro-PHP sentiment looks exactly like that as well?

I could see that, to a degree. But I agree with this article that most (if not all) of the "bad" of PHP has been completely papered over through best practices, documentation, fantastic tooling, or removal from the language. So the pro-PHP movement is more of a "guys, we're doing the same thing as you, why can't we all just get along?" When was the last time we saw a "PHP is Great!" article make it to the front page…

>the "bad" of PHP has been completely papered over through best practices, documentation, fantastic tooling, or removal from the language. I mean sure I could just reimplement a sane standard library from a different language in PHP and then live with the suboptimal syntax or maybe I don't waste my time and just use that language with the better standard library from the get go.

Re: PHP Sucks

#274
post #271

Earlier quoted context omitted.

But why can't the interpreter/compiler implicitly add that argument to each instance method definition? There is no need for the programmer to type it. I understand that self plays also a role in the declaration of class methods but other languages found ways to do without method(self) and still have class methods. Java's static (coming from K&R) or Ruby's def self.method Anyway, that is the way of Python. A lot of p…

> But why can't the interpreter/compiler implicitly... "Explicit is better than implicit" -- PEP 20 Python was the first language I ever learned and I just took it for granted that you had to manually specify "self" like that. When I see code with implicit self, it reads strangely to me. Like, "Where does 'this' come from? Oh yeah."

In a statically typed language you would have to constantly enter the type of the class as the first parameter.

Re: PHP Sucks

#275
post #108

Earlier quoted context omitted.

Right, and who's paying me to work with one of those alternatives? No one. My reference for what you quoted was a Rails project written by a Python dev who thought he needed to make Ruby more like Python. The resulting code was so horrendous that I literally cannot tell which of 2-3 parts that compose one feature (all heavily monkey-patched together) is responsible for what. It's like 2-3 complete implementations, bu…

> Right, and who's paying me to work with one of those alternatives? No one. Give me a break, it's not like there are only PHP jobs out there. If you can't find anything else then it's because you're not capable of coding something that is outside PHP domain, IE basic CRUD apps ..

Umm... outside of R&D or the valley, the breakdown is something like:

PHP: 30%; .NET for finance/enterprise: 25%; Java for finance/enterprise: 20%; Java for android: 10%; iOS: 10% (~5% overlap); Everything else: 10%.

And as far as payscales go, PHP is nearly always > the "Everything else" unless it's super specialized. But clearly everyone paying median or above for PHP is getting conned and they should convert their entire business to [flavor of the month] language.

[edit]And I'm leaving js off there on purpose as there are very few web devs who are expected to only work in PHP and never touch the js. And in those other orgs, you usually have a specific "front end" developer that probably doesn't deal with any other kind of code and makes less than the "full stack" devs.

Re: PHP Sucks

#276
post #179
post #62

Earlier quoted context omitted.

Have you tried Yii at all? In my most recent (side) project, I'm doing a Yii2 website and I'm feeling like it's not enterprisey enough. I have to go out of my way to figure out the best way to split things apart (which, I guess is good because it doesn't actually make that difficult for me at all - it's just something I have to choose to do)

I used Yii2 at a previous job. The way that it splits things out feels horrendous. The documentation is sub-par, and I feel like I spent more time trying to figure out why something didn't work the way I expected (from reading the code) than I did fixing things. I'm sure at least some part of that was the previous developer who built the application. But there is absolutely no reason for documentation to not answer t…

Use it at my current job. Also used li3 before that. The current version works pretty well without having any of the weirdness that can plague a framework once it gets more mature and people start wanting to graft in whatever is trendy from other projects.

What I like about it is the flexibility of the ORM, where you can use the model in a sane way but can completely toss it aside and just use SQL for those edge cases that would be a PITA in something like Django.

Re: PHP Sucks

#277

Earlier quoted context omitted.

I've mostly tried to fight the anti-PHP movement because I WANT new developers to come on board and create great things. I want new packages to pop-up as soon as some new tool/api/widget becomes available. I've felt for quite some time that most of the anti-PHP sentiment is an effort of other developers to justify the language they've selected to focus on. "Yeah, I'm doing Javascript and Node.js and yeah it's got it'…

I disagree. Wanting to get new grads into PHP is bizarre. They would be ostracized. They don't have the technical experience to know WHY it is a good language (CI/unit testing/years of libraries/API support in everything/bla bla). They should be working on things that are new and untested. That is what a twenty something should be working on. Check please?

I think this criticism is missing the biggest problem most new grads have: how to work well with others.

Version control, documentation, checking their work before committing and sending to QA, documentation, and learning how little they actual know about development on a real timescale >> which language they use. I'd rather start out in a well run IT shop that uses PHP than a quirky single dev small shop (or god-forbid an academic ivory tower of babel) with the most cutting edge startup blessed tool set.

Re: PHP Sucks

#278
post #271

Earlier quoted context omitted.

But why can't the interpreter/compiler implicitly add that argument to each instance method definition? There is no need for the programmer to type it. I understand that self plays also a role in the declaration of class methods but other languages found ways to do without method(self) and still have class methods. Java's static (coming from K&R) or Ruby's def self.method Anyway, that is the way of Python. A lot of p…

> But why can't the interpreter/compiler implicitly... "Explicit is better than implicit" -- PEP 20 Python was the first language I ever learned and I just took it for granted that you had to manually specify "self" like that. When I see code with implicit self, it reads strangely to me. Like, "Where does 'this' come from? Oh yeah."

Or to quote Matz "No language can be perfect for everyone. I tried to make Ruby perfect for me, but maybe it's not perfect for you. The perfect language for Guido van Rossum is probably Python."

My first serious language was C, which is way more lower level than Python. Still Python has something that reminds me of C. Those wierd __xyz__ methods, looking like what we used sometimes in #define; the useless : instead of some { (I know where the : comes from but it should be deprecated or made optional) and that self, which is the pointer to the C struct we were using to implement OOP in C. It's a strange mix of low and high level constructs, not fully OO and definitely not functional. Being at midway on many axis maybe it's the reason why it appeals so many people: it's a little bit familiar to everybody and this is important for the success of a language. Think of Elixir which was designed to look similar to Ruby, even if they have nothing in common.

Re: PHP Sucks

#279
post #211
post #192

Earlier quoted context omitted.

My experience has been 100% different from yours. I commonly recommend Yii and laud it's extensive documentation and "Definitive Guide" that covers basically everything. In my current experience as a developer, Yii's documentation is the best I've ever utilized. Much better than any Javadoc I've googled or even php.net's

What are forms and form validation like in Yii? [Have looked at the docs, but after real-world usage] I've used form libraries from the PHPClasses one back in 2003 through Symfony forms now (which has cognitive overload, and is so flexible as to be restrictive). Most business systems I write are data focused so forms play a massive role in them - and in my developer happiness.

Validation works directly with the model and you can pick a number of ways to check the input and have it return an appropriate error message.

The view/controller layers are very flexible and can be hooked up to anything from an HTML template using Yii to angular/bootstrap (which is what we're using) or another framework to handle the forms.

Re: PHP Sucks

#280

Earlier quoted context omitted.

Is it any worse than Javascript, if we're honest?

Javascript ain't that bad, it's interacting with browser exposed api variants that sucks but there are many wrappers to solve that issue. The real annoying part is that by nature it will never have the same amount of IDE niceties you'd get with more typed languages

No, JavaScript has a lot of quirks like the '==' vs '===', empty arrays equalling to false or this kind of stuff: http://stackoverflow.com/a/1995298/398142

I understand JS having its place as being ubiquitously supported in browsers but, just as PHP, it's bad and its problems are not about niceties from IDEs or static typing.

Post reply on HN