5 ms·
> So, it might be far from perfect, but than again, Javascript is far from perfect too, C++ is also flawed and Java has tons of bad decisions in its design (and
by lmm 13y ago
> So, it might be far from perfect, but than again, Javascript is far from perfect too, C++ is also flawed and Java has tons of bad decisions in its design (and culture). Still, those are some of the more widely used languages.
Still, I wouldn't take a job in any of them. Javascript is crap, only used because it runs in the browser. C++ is pretty crap, only used because it has manual memory management. Java has its problems, but it has a decent design at least for the time; there is a terrible culture that I think adopted Java because it was popular rather than the other way around.
But yeah, in 2013 there are really much better languages than PHP available; if you want a similar-feeling replacement Python or Ruby are much saner, if you're willing to step further afield there are wonderful modern languages that push the boat a bit further (I'm in love with Scala at the moment).
- justinhj 13y agoDefine 'better'. Personally I think Clojure has a lot going for it, and it's better than a lot of languages in a many ways. However, for the kind of application I work on PHP is significantly better fit than Clojure. Most of the points made in this talk apply to my situation. http://www.infoq.com/presentations/php-history http://www.infoq.com/presentations/php-history
- lmm 13y agoThe main "better" I care about is "fewer gotchas and special cases to memorize"; that's not the only thing that matters about programming languages, but it's a big factor. I don't have time to watch a 40-minute video; arguments I remember hearing from something similar are the very fast coding feedback cycle (easy with modern-day rails/django/etc.), "it's better than it used to be" (not really an argument), availability of frameworks (but I've never seen an actual example of the advantages that you don't get in other languages/frameworks), large standard library (again, present in other languages), dependency management (which seems more like php catching up with other languages than overtaking them), deployment (may have been a good argument in the pre-wsgi days and when Apache was the only webserver around, but not true any more IMO). What is it you see PHP as better than ruby/python at?
- justinhj 13y agoWell firstly the gotchas very rarely get me. I found the same with Javascript. The inconsistent and odd data conversions make fun slides to denigrate the language, but in practise they seem to be easily avoided. I realize posting a 40 minute video to support my point is a bit lazy and unfair but you seem aware of some of the key points fortunately. First let me admit that we have a php legacy codebase, so porting that to another language, even if we had a strong desire too would probably be prohibitive. I definitely feel super productive in PHP. I've been able to knock out a new app feature in 1 day, which to build the equivalent in Java would have been at least 5. It's very easy to write code fast, and then come back and refactor it later. Using PHP Storm as an IDE with a very good debugger and PHPUnit to build a suite of tests for everything we do means that gotchas are always eliminated before production, and with PHP I find things are either working or completely broken with not much in-between. I guess having a strong unit test suite, or really it's more of an acceptance test suite, is something you can do in most languages, but the assurance it gives us enables us to share large code bases between teams, doing frequent merges of features. You can have large numbers of programmers with varying abilities and even programming styles hitting the code without too much headache. The talk also mentions state. Not sharing state between requests except explicitly. You don't have to worry about complicated background threads, resource leaks, memory leaks. Even crashes are less of a big deal since you just lose one request to it, not the whole server like with Java et al. PHP's array is a swiss army knife with lot's of useful functions for transforming data, which is a lot of what we do on the server. I can map, reduce and filter data. I can dynamically handle arrays or single objects in the same function, or handle arrays of different kinds of data without any fuss. In short going from what I want to happen to having it happen is very fast. Background tasks are queued and run on other systems including some written as bash scripts or in Python, Go and node.js. These languages are a better fit for these jobs and so we ditch PHP for those. What Facebook is doing with HHVM (run faster) and Hack (add type safety as needed) is pretty interested and we've adopted the first but not yet the latter. Hopefully that's flavour of what I like about using PHP. I have not written more than a few lines of Ruby so I cannot comment on that. I have done some maintenance work on a Python server but not with a modern framework. I'm not sure Python with a modern web framework offers all of the advantages I've mentioned above but I am open to being enlightened on that.
- anonyfox 13y agoScala is incredible, but after learning it for a few weeks i realized that it is just too much. I just can't explain it better. Additinally the last time i toyed around with Scala, SBT was a joke compared to RubyGems/CPAN/NPM. Not the language matters, but the library-ecosystem around it.