Earlier quoted context omitted.
Roughly in the order you should do it. Hopefully it's at least PHP 5.3 code: 1. Definitely get a PHP IDE: https://www.jetbrains.com/phpstorm/ 2. Get a step debugger and hook it in: https://xdebug.org/ 3. Fix the code style: https://github.com/FriendsOfPHP/PHP-CS-Fixer 4. Run the code through some static analysis tools https://phpstan.org/ https://psalm.dev/ 5. Upgrade the code with an AST fixer (might help you update…
In addition: - Make sure you have version control. So easy to do these days, so often forgotten. - don't think that the steps above must be done in order, right now. - dkarlovi mentions tests. Start with 1.) smoke tests like simple selenium tests or something like that. You'll find lots of vate towards it if you look and I admit it has issues but for simple projects like this that doesn't change much it should be fin…
PHP 8: Before and After
221–230 of 346 posts
Re: PHP 8: Before and After
#222I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…
I don't either, but what I also don't understand is why in 2020 anyone would use PHP over many available vastly superior alternatives.
Other than keeping old stuff running, why do people keep beating this dead horse? I just don't get it.
Re: PHP 8: Before and After
#223Earlier quoted context omitted.
You are proving my point by defending Java against PHP because my argument was that being more like Java isn't a negative thing. The productivity point was a secondary point but when it comes to building websites I think people can build faster in PHP although I guess that depends on many factors.
I guess I am not following your argument. Are you not saying that since PHP is less verbose than Java, this is better for productivity? After which you then follow up and say that PHP becoming more like Java is not bad? Seems contradictory, no?
You are right, I did sneak in there that I find PHP less verbose than Java as an advantage, since most people complain about how much typing you need to do in Java I thought this was worth highlighting.
However personally I think PHP evolving to be more similar to Java was a good thing, even better because imo they copied the good parts, ie: OOP instead of the verbosity but that's up for debate.
In short, becoming more like Java was good, but PHP isn't Java and has its own advantages for web development, imo this is that it is less verbose and easier to write.
Re: PHP 8: Before and After
#224Earlier quoted context omitted.
In addition: - Make sure you have version control. So easy to do these days, so often forgotten. - don't think that the steps above must be done in order, right now. - dkarlovi mentions tests. Start with 1.) smoke tests like simple selenium tests or something like that. You'll find lots of vate towards it if you look and I admit it has issues but for simple projects like this that doesn't change much it should be fin…
I tried searching for "refactoring legacy code" but I couldn't find it. Who's the author?
"Working Effectively with Legacy Code" is the name. The author is Michael C. Feathers I think.
Re: PHP 8: Before and After
#225Earlier quoted context omitted.
(Disclaimer: I know absolutely no PHP whatsoever.) > The second and third 'static' indicate late static binding, meaning they refer to the class being called, rather than the class defining this method. Wait, so they're using "static" to mean the binding is happening later ? Isn't that essentially less static than binding against the class being defined?
It's still static in the sense that the method is tied to a class, not to an object instance. Does that mean it's "less" static? I wouldn't say so.
It's less static than a method dependent on the object instance, but more static than a method that doesn't even depend on the class. If I've understood correctly (which I quite possibly haven't, in fairness), these are analogous to Python's static methods, class methods and regular methods, and its static methods really are the "most" static.
Re: PHP 8: Before and After
#226I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…
I haven't found any good arguments against PHP in the comments here, just pure hate. Let's name a few of the arguments people are making: 1. Its variables start with $ and that is ugly: I mean, come on, I won't even entertain this bigotry. 2. It used to be better before: This is just pure nonesense, before OOP PHP wasn't good to create any big and well-structured application, it is ironic because most of the bad opin…
So the whole "It's trying to be Java" is more like "What does it offer that's better than Java? Because Java has stuff that is better than PHP."
And I'm saying this as someone who doesn't like Java at all.
Re: PHP 8: Before and After
#227I do all my process automation tasks in PHP and it's been such a pleasure.
Re: PHP 8: Before and After
#228I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…
I haven't found any good arguments against PHP in the comments here, just pure hate. Let's name a few of the arguments people are making: 1. Its variables start with $ and that is ugly: I mean, come on, I won't even entertain this bigotry. 2. It used to be better before: This is just pure nonesense, before OOP PHP wasn't good to create any big and well-structured application, it is ironic because most of the bad opin…
Do you consider Magento being a framework you are happy to work with? I'm also working in Magento 2 and honestly it's a painful experience. It's a so bloated framework that without cache enabled the development is completely awful.
Re: PHP 8: Before and After
#229I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…
> I don't really understand why in 2020 there's still this kind of blind hatred against this language. I don't either, but what I also don't understand is why in 2020 anyone would use PHP over many available vastly superior alternatives. Other than keeping old stuff running, why do people keep beating this dead horse? I just don't get it.
Though, to be honest, I'd probably use PHP over Node even with TypeScript because the Node ecosystem is such garbage.
You just have to really like Laravel, I guess, to choose PHP in 2020. Which is totally fair. I haven't used Laravel, but people do rave about it.
Re: PHP 8: Before and After
#230In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common in platforms like nodejs where you need to be extra careful. Needless to say this makes php becomes quite viable for production envs, and prevents a whole host of issues that need expertise and careful programming to fix.