4 ms·
I shit on php because when you develop professionally with it, you want strong types so what happend was that people started to use comments to hint types. Tho
by Morelesshell 2y ago
I shit on php because when you develop professionally with it, you want strong types so what happend was that people started to use comments to hint types.
Those hinted types are than enforced through an IDE.
Thats just horrendes langauges missuse / misdesign.
- zer00eyz 2y agoI write go so... types. Types are great and they have downsides. Perl, PHP, Python, Ruby, JS, Lua, lisp, objective c are proof that you dont NEED them to have working code.
- kaba0 2y agoGo’s types are like talking about how cool internal combustion engines are, and you bring up a crank.
- gregjor 2y agoMaybe upgrade to a recent version of PHP from the last five years. It has strong typing, not just hints in comments. If you like strong typing, great, but many popular languages have weak types and dynamic types by design. It’s not some horrendous oversight.
- Morelesshell 2y agointeresting that it finally landed. But just because PHP apparently added reasonable typing in >7.2 still makes it a ranchy languages for most of its lifetime. Anyway ranting about it doesn't imply that i hate it or that i haven't used it. Its one of my first languages, but from my personal view, php is a shitty language in comparision to most others
- gregjor 2y agoYou would have to compare PHP to the alternatives available at the time. Originally PHP replaced Perl and ASP, which have their own problems and no static types (back then). Ruby/Rails came out and got traction but was slow, buggy, and still no types. Python also slow, no types, and not great for web development. Then we got Javascript and Node, with even less sensible types (no integers!) so you have to use Typescript and lots of tooling to get what PHP offers. In enterprise environments Java and then C#/.Net dominated and did have strong typing, but that’s not the world of PHP. Comparing PHP from a decade or longer in the past to Go et al. hardly seems apples to apples. So if you want to dismiss PHP as “shitty” compared to “most others” define shitty and identify the others.
- Morelesshell 2y agoPHP without types / types in comments existed in parallel to spring boot for years. And im pretty sure that the history of PHP is still everywere inside PHP, like php function inconsistencies across the board. Or whats the current situation on unicode support? When i started with PHP4 and Lamp, what a great time. JavaEE was bloated, not a lot of good free webservers available, granted. But while PHP5 was great and had a loooong shelflife, JEE became much cooler and had fundamental critical things like CDI and really good CDI Frameworks. Eclipse Java IDE was always really good, something PHP hadn't had for ages. And if you look at the fundamental difference between lets say java and php: In Java you have specs and reference implementations (partially also thanks to oracle, you now have mulitply companies having their JVMs) which made the JVM very robust and fast. When Facebook did the hhvm/hack stuff, that was great and pushed enough nerves to rethink the performance of PHP but the performance gains were stupid crazy. Thats a very good indication when a language with so little money and support has such a huge performance gain after such a long time existing. The fact that Facebook than threw the PHP community under the bus with hhvm/hack didn't make it better.
- gregjor 2y agoI don't think PHP and Java really compete for mindshare. Java has mainly thrived for larger enterprise projects, whereas PHP appealed to individual developers and smaller businesses, and applications like WordPress. Of course there's overlap and companies may use both, but writing a web application in Java requires significantly more investment than choosing PHP. Eclipse supported PHP from 2007, and the PHPStorm IDE from JetBrains dates to 2010 or 2011. Java has always had better tooling because of the enterprise focus. PHP IDEs are very good today. PHP 7.x and 8.x have seen big performance improvements. I haven't seen hack/hhvm get much traction outside of Facebook but maybe it did.
- danaris 2y agoI don't wish to put words in your mouth, but it certainly sounds like your argument is essentially, "PHP was bad, therefore PHP is and will always be bad, no matter what improvements it makes." This...doesn't seem particularly reasonable? You're not required to like PHP, and you don't need a reason why things you dislike are objectively bad in order to be allowed to dislike them.
- Shish2k 2y ago> It has strong typing, not just hints in comments Even for arrays?
- gregjor 2y agoPHP arrays are ordered maps, not arrays of a homogenous type as in Go or Java. Array is a type in PHP, but all arrays have the same type, regardless of what they contain. You can describe the expected value or key/value types of an array in PHP doc comments for IDEs and static analyzers, but PHP won't enforce those.
- kyriakos 2y agothere are many loosely typed languages that are used professional (in addition to PHP). dynamic typing it has its pros and cons but that doesn't stop it from being used professionally.
- Morelesshell 2y agoMy point was that the professional side of PHP developers at that time, decided that they want to have a strong type system.