PHP Addiction - <AUTHOR> http://www.marco.org/2012/06/29/php-addiction <comment><USER2> Is it my imagination or is Marco the king of writing blog posts that are quick reactions to whatever is trending on HN?

The message you should get from this post is that familiarity with one's tools easily trumps any aesthetic flaws (consistency in parameter ordering, naming conventions, etc are really nothing more than aesthetic flaws and not "deep" [1] as the author suggests. After all, human language is inconsistent. After awhile you just get used to it and don't think about it anymore. Programming languages are no different.

I agree with Marco that it will take "years to master" whatever he chooses next. I always scratch my head at these "I learnt Python in a day" claims you often see around here. No, you didn't learn Python in a day. You learnt the syntax for a for loop in a day. Idiomatic Python takes much longer.

I don't agree that choice is the reason people don't use Linux on the desktop. Desktop Linux is the reason people don't use Linux on the desktop. I'm sorry but it's truly awful and probably won't ever get better. In the absence of product direction you have us geeks making everything configurable because, you never know, you may want to write your own window manager (and knowing us geeks, no two will agree on what's right) so you have no consistency, no grand UI/UX design and it's just terrible.

I use Linux/Ubuntu at work basically because I have to. There are advantages on having your dev environment mirror your production environment and Linux (over OSX) does actually have a package system (it's a messy hack on OSX) but I certainly don't like it.

The only computers I use that I truly enjoy using are my iPad and my Macbook Air.

Fear of the wrong choice isn't I believe what motivates most people. Fear of looking like an idiot? Sure. But that's different and will probably be the case with anything new.

People don't tend to weight up two or more options, decide which is best and go with it. They tend to use the first thing they come across until its flaws (perceived or actual) outweigh the "cost" of transition and appearing like an idiot for awhile.

[1]: [http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad- de...](http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/)

<comment><USER3> Desktop Linux is actually _fucking fantastic_ if you are prepared to take up messing around with it as a hobby. It requires commitment, time, and and open mind, but fuck, I've just sorted out xmonad, I have my dotfiles syncing via git, and it's _bloody amazing_. Package management is bliss, and both pacman and apt shit all over homebrew (great as homebrew is), it's absurdly fast even on old hardware, it's free, it's got all the compilation tools, headers, and libraries I could need either already installed or a few keystrokes away. Not to mention the fact that it's _beautiful_ : [http://files.0xf.nl/screenshots/screenshot-2012-06-27.19%3a4...](http://files.0xf.nl/screenshots/screenshot-2012-06-27.19%3a41%3a35.png)

Linux can be really, really awesome, if you're prepared to spend time making your work environment great.

Lastly, all this time is not wasted, you end up learning so much stuff that you can apply to every where else - because of my linux knowledge I often find myself helping out my friends who use OSX but don't understand things like headers and libraries.

<comment><USER4> I'm a longtime fan of Linux and have used it as my desktop of choice for years, but apparently you and I have a different idea of what "beautiful" is. That screenshot is a ghastly smattering of black, grey, and red, with no unified look or feel. Sublime Text is really good looking in its own right, but that overall desktop doesn't look appealing to me.

Granted, I use Gnome Shell for my desktop of choice, and find that much closer to my definition of "beauty", while KDE4 is busy chasing some idea of beauty that more resembles a mish-mash of Win7 style glass that spends more time distracting my eyes than allowing me to work, so take my opinion with a grain of salt.

I think OSX has come closest to the mark of "beauty" from a desktop environment, but it's such a terrible window manager compared to X11 that I can't stand using it except when I have no other good choice. Even then the only thing keeping me from insanity is a set of third party window managing tools that still only get me about 50% of the way to where I want to be.

<comment><USER5> Do you even notice the "beauty" after spending a week with it?

<comment><USER6> You notice ugliness everytime you use it. The beauty in UX/UI/Window Manager lies in it just being there, not distracting but complementing one when he/she is working.

That's my definition of beauty. I can go days without noticing it and if I take a step back and take in the whole experience, I find the beauty.

Ubuntu does it for me. Especially because I can take time to make it beautiful for me and I can have a free hand while doing it.

</comment></comment></comment></comment></comment><comment><USER7> Here is another point that highlights the problem:

If I want to write a hello world application in PHP, it's neither as long as <?php print("hello world");?> nor as short as <?="hello world"?>

Rather it's simply: hello world. Just type in those 11 characters in a text file and save it as hello.php. Now load it on your browser [or run it from command line] and it will print hello world. I don't think it can get any more simpler than that in other languages. PHP was developed from the ground up as a templateting language for serving HTML pages. These other languages are more of a general type.

Therefore the replacement for PHP should come through a new language targeted as a replacement for PHP as Jeff said. Otherwise there always be extra web/template stacks for the developers to take care of. And that will be the first hurdle to learn and overcome for novice developers looking for switching to something easier.

<comment><USER8> I'm not convinced this is true. You see, way back in the day in 1997 when I was doing web dev, _everything_ worked the way PHP does. ColdFusion, ASP ( _not_ ASP.net, ASP), PHP, and almost everything else that was seriously trying to do web pages worked that way. It took the community collectively a long time to stop seeing URLs as identifying anything but specific files. This is back when having those files be programs was still a bit of an innovation.

After 15 years of one of the biggest bursts of innovation the open source world has ever seen, and with such diversity in frameworks that the mind boggles, nobody has returned to this model successfully. I've got MVC-inspired designs coming out my ears, continuation-based designs, frameworks just beginning to incorporate web sockets deeply (instead of as an afterthought), GWT, ASP.net, and other attempts at building a fundamentally different model and compiling it into another, and everything under the sun... but no return to the page-is-program model.

I don't think it's the key to PHP's success, because even in the competitive- yet-very-fertile soil of the web framework world, nobody else can make it work anymore. I think it's vestigial, and nothing else.

(Personally I think the key is simply that everybody has deployed it, and since there's basically no way to force every web hosting company to support Language X simultaneously, PHP isn't going away until the entire concept of web hosting goes away. Which isn't anytime soon.)

<comment><USER9> The page-is-program model still works as well as ever. It's just that, if your problem is so simple that the page-is-program pattern is most appropriate -- for example, if you are eight years old and you want to build a page that serves up a different picture of a dinosaur every time it gets reloaded -- you should just use PHP. Why choose anything else?

It's true that other languages have not wasted a lot of time trying to displace PHP as the language of choice for anonymous random dinosaur servers. That's because there's no money in fighting PHP on its home turf. The turf just isn't worth enough.

"Vestigial" is the wrong word. That's like describing a screwdriver as "vestigial" because the impact driver has been invented. Sure, impact drivers can accomplish many things that mere screwdrivers cannot, but that doesn't mean that screwdrivers aren't still useful, and numerous, and popular.

<comment><USER8> Vestigial is the right word; a characteristic of a surviving species that isn't particularly relevant to the question of _why_ they survive. While debate goes back and forth between the various potentially-vestigial organs we may possess, it seems clear that if the appendix contributes anything to humanity's survival, it isn't very _much_. Also, vestigial tends to imply it isn't actively harmful, which I don't think it is because PHP certainly works just fine with other models as well. (If it were _only_ page-as-program, I'd have another opinion... but it would probably also not be doing anywhere near as well on very large sites and we probably wouldn't still be talking about it as anything but a historical language.)

You may disagree that my characterization is correct, but it is certainly the characterization I intended to convey. That's why I parenthetically commented that I think the real reason it has carried on is another one, to contrast the relevant characteristics to the irrelevant ones. Creating a new "PHP-killer" and focusing too much on the vestigial features of PHP is a recipe for failure.

</comment></comment></comment></comment><comment><USER10> That's one of the problems with the now-famous Fractal blog, I think: It was a joy to read in the sense that being a Python programmer, it only heightened my appreciation of the achievement that languages like Python and Ruby represent. It's what conscious, determined design gets you and what mistakes they managed to avoid.

But it's preaching to the choir. If you've never seen anything other than PHP, you won't understand two thirds of the list or why they're problems. (<\- Not looking down on PHP coders there, rather I'm thinking back to when I started out on PHP and am speculating on how I would have received the document.)

How do we communicate effectively what makes other languages better to someone with no reference frame other than PHP itself?

<comment><USER11> Most PHP developers don't start their first programming project from scratch using PHP to write their first web app. It's far more common to start because you are running a blog on WordPress and you want to make some small change. Then you make another and another, then you're writing plugins and suddenly you're a programmer and PHP is your language.

So to encourage developers to start with something other than PHP you'll need to lower the barrier to entry to modifying existing software, and also make something as popular and widely useful as WordPress and MediaWiki.

This is going to take a while.

<comment><USER12> I did a lot of PHP over the years, trying to migrate over to a Python web stack.

A big hurdle is ops dev. All hosting services support PHP out of the box.

Now I'm faced with the "distro choice". Which server do I use (lighthttpd / nginx / tornado)? Which framework (django / flask / web2py / cherrypy / pylons / pyramid)?

Like the original author, I've had a VPS sitting unused for 2 months paralyzed by choices. I eventually decided on nginx / flask, but haven't had the time to set it up. Maybe I should have just used Heroku. _shrugs_

<comment><USER13> The same choices exist for PHP, although you may not be aware of them. PHP runs on all the servers you mentioned, and there are many, many frameworks in PHP (although admittedly not quite as many as in Python).

Just choose one and learn it. They're all excellent web servers. I'd recommend going with Flask or Django in the beginning, simply because they have the best documentation. web2py also has pretty good documentation. The only problem with Django and web2py is that they are monolithic. If you don't like their ORM, or templating engine, or authentication/authorization, it's generally hard or impossible to switch, and if you do switch you lose all the benefits of the integrated system. With Flask and Bottle, on the other hand, you are free to pick and choose components. I think the same modular design approach is used by Pylons and Pyramid, but I'm not sure since I've never used them. But as you learn more, there's a lot to be said for being able to switch out components of your framework, or even writing your own in a pinch.

</comment></comment></comment></comment><comment><USER14> _The fear of making the "wrong" choice actually makes the familiar, mastered PHP more attractive._

The multi-core reality means that the long-term languages will have a strong concurrency model. Clojure and Go are two languages with strong concurrency models that are building momentum and have potential to go mainstream.

But for your first foray out of PHP, I would pick a language that has a large, well-established community with mounds of documentation, books, and resources.

My path out of PHP would be:

      1. Python
      2. Clojure
      3. Go

Learn Python first because it's easy to learn, easy to read, and it's taught at major universities so it's easy to find smart people to help. It has a large community behind it, which is still building momentum, and it has a huge library so it's generally more useful than Ruby.

Then once you're comfortable with Python, I would venture into Clojure. It's different, but in a good way. And you get access to all of Java's libraries so it's practical now, even though it's relatively new.

And then look at Go. Go is building momentum fast, but right now it doesn't have the massive libraries that Python and Clojure have. However, in a few years, this will change.

<comment><USER15> I think that multicore support is unlikely to be the crucial feature that cements the success of the language of the future for simple CRUD web apps. Such apps are invariably not CPU-bound. Wide support on hosting providers, tooling, ease for novices, database access, etc. are far more important--which explains the success of PHP in the first place.

<comment><USER16> You're assuming that simple CRUD apps will still be interesting in the future. It's possible that future apps will be CPU-bound.

It would be nice to have a language that lets you prototype quickly but also build the real deal efficiently. Actually, not having such a language should be embarrassing for the software industry.

Maybe Clojure fits the bill, difficult to say.

</comment></comment></comment><comment><USER17> The only thing flawed with PHP is your outlook on it. People with money (investors, clients, etc.) don't care about ANY of the nuances mentioned here or by Jeff Atwood. At the end of the day, we use PHP and are rewarded for doing so. If you want to use another language or make a new one...Great. Do it. But I'm not sure why some people just want to try to change an entire industry and move people off of PHP... It makes no sense. No one is holding a gun to your head to use PHP. You have alternatives and if you're not happy, make something yourself. You can't have everyone hold your hand your entire life and do things for you.

PHP is good. I'm living proof of that. I'm a very successful developer and PHP does just about everything I ask of it. I also find it enjoyable (when you don't use crap frameworks or CMS' like Drupal). For those of you that do struggle with PHP, then what on God's green Earth makes you think you'll do any better with the next language? There comes a point when you've rifled through everything saying they are all junk that you gotta look in the mirror and ask yourself what's really the problem?

<comment><USER18> In a few years most NEW projects will probably not be made in PHP. You are suffering from Cognitive Dissonance, PHP is not good.

<comment><USER17> Uh... You're quite wrong about that statement. If I could find you in real life I'd love to make $1,000 bet with you.

<comment><USER17> You also missed my point entirely. Good job.

</comment></comment></comment></comment><comment><USER19> Is learning another procedural/OO language really that tough? I've put off learning Haskell/Erlang/etc because it's such a shift in thinking, but PHP/Ruby/Python/Java/JS/C-whatever seem to all be about the same. There's some new syntax, and entire new libraries, but it just means you have have the docs open a bunch at first. I find I have to actively _keep_ myself from starting new projects in the new flavor of the month and force myself to use something that I know much better and that is much more proven. I think I'd be rather proud of myself if I got a whole project done in PHP rather than Node or Scala or JRuby or something like that.

</comment><comment><USER20> Disclaimer: I'm a Rails programmer for work and hobby.

Interested in learning something that isn't PHP to code your web applications in? Ok. You have a ton of options and this is a very exciting time to be a web developer.

Do you want to lean towards stability and proven concepts and work within a full application structure? Look at Django and Rails.

Do you want to serve up responses from a simple script without a lot of extra pieces? Look at Sinatra and Flask.

Do you want to get in on the cutting edge and don't mind forging some of the path yourself? Look at Node.js and Meteor.

Got a high level decision made? Sweet. Now compare the primary languages between your choices (forget the framework for now). After a few minutes looking at each, which reads better to you? Feel free to go on gut instinct here: there are no wrong choices.

You've now made a choice for your next learning target. Now: don't spend years. Don't worry about knowing everything about the framework and the language. Google for "X tutorial" and follow the first link that looks reasonable and current. Do that tutorial. Now you have some bearings within the framework and have some idea of how it thinks.

Now. Pick something you want to build (a todo list is popular now, it used to be a blog or a wiki). Build it. You will make mistakes. You will be confused. Google for answers (if you're in Node.js or Meteor you will have trouble here) or hack until you get something working.

Throw what you built up on github and ask others to check it out. Build something else. Repeat.

If you are already a decent programmer with a good grasp of the web and how HTTP works: you will pick up any of these frameworks well enough to work in it in a month or so. In six months you'll be well advanced: especially if there are good books available for the framework/language you are working in.

Have fun!

<comment><USER21> Do you want to provide an application that anyone can run and easily deploy on their own server with as little configuration as possible?

Oh.

I hate PHP as much as anyone (of course), but that's what it does.

<comment><USER20> That's the thing right? With PHP you need a server or you can't do anything. With Django, Sinatra, Rails, Flask, (Node?, Meteor?) you have all that for development as part of the application.

To deploy you just push to a free heroku instance and you are fine until you get big. Much, much easier than setting up your own Apache+PHP. And much, much cheaper than buying hosting.

<comment><USER22> So many people point to Heroku as the comparator to the wide availability of PHP.

Unfortunately Heroku is down right now. The wide-availability of choice, it's ubiquity, is why many PHP sites are still running right now - they are not reliant on a single point of failure.

There are many thousands of hosts, spread across the world, offering Cpanel accounts so I'm not tied down to the meteorological events in North Virginia.

If an act of God happens in Michigan right now, I can switch my site very quickly from there to a freshly minted Cpanel accout in California (thanks regular Cpanel backups!), or London or Manchester (Possibly not Newcastle right now, though). I'm really spoilt for choice here.

What are the alternatives to Heroku that don't have the same failing that are running right now that are comparable in getting an app up and running equivalent to PHP time?

</comment></comment></comment></comment><comment><USER23> I'll sound like a broken record, but I'm convinced Flask is the perfect transition.

It's built for smaller web apps, and rapid prototyping. The system of mapping endpoints to functions is incredibly intuitive -- if you've used Python before, learning Flask is incredibly easy.

<comment><USER24> i'm on PHP now as well. I would probably choose Bottle simply because it runs on Python 3 while Flask does not. I would go with Flask otherwise.

<comment><USER13> Bottle is very cool, but Flask has far more plug-ins ("extensions") than Bottle does. Flask has nearly all the features that Django does, only they are in the form of dozens of separate extensions. In my opinion, this is a good thing. It's easier to understand the framework when you start with the basics and learn more as you add on extensions.

I believe that Flask will move to Python 3 eventually, but at the moment I agree with the decision of Flask's creator (Armin Ronacher) to stick with Python 2.7. In the end, Python 2.7 is probably better for someone new to the language. There's more documentation, and it's still the default Python on most systems(although a few are starting to pre-bundle Python 3).

</comment></comment></comment><comment><USER25> I hadn't heard of his Second Crack project until reading this post...it's a static blogging engine similar to Ruby's Jekyll <https://github.com/marcoarment/secondcrack>

I know it's difficult to compare or find an observer who could adequately judge between the two, but I wonder if Ruby made Jekyll easier to write and maintain? Of course, there's not any easy way to make that judgment without knowing how much effort Marco put into Second Crack versus what was put into Jekyll.

</comment><comment><USER26> I've been having a similar problem with the added difficulty* that I don't do development as my full-time job (yet) and have been coding mostly for developer contests and hackathons.

So when I start something that has a deadline in 24 hours or just a few days, I can either fall back to PHP to get something going fast or spend most of my time just learning a new language. So, I have been typically going with PHP…

I've found that the important thing is to take the time to set yourself up with the minimum environment that can get _something_ , _anything_ going in a different language: that means whatever is needed to print something on a page and get some logic working with GET and POST parameters. Because the nice thing with PHP is that it's so easy to write a single file that displays text on a page, or that responds to POST and GET parameters with some logic behind it. If I started with Ruby for example, I wouldn't know how to do this basic thing. (granted, with Rails and Heroku, this is easy)

My plan is to make Python my generalist programming language and I started to look at Flask (<http://flask.pocoo.org/>) for that reason: it's a mini- framework that doesn't take long to learn how to do these simple things. I can then play with it for simple things.

*though it can make things easier since I can just work on whatever I want in whatever language I want :)

</comment><comment><USER27> So, I wouldn't really call myself a "programmer," because I'm a front-end web designer. I'm learning more and more web programming and I'm obviously using PHP. The main issue I see with languages like Ruby or Python for novices like me is that when you ask a novice (running on Windows) to go into the command line, that's like asking a cook to go milk cows. The cook will figure it out, but fuck you.

Sure, there's a learning curve to any new language, and I would love to learn a "better" language, but, if you can't explain to a novice why a certain language is better, the novice is going to go for the smallest learning curve and the language with the best/most ubiquitous documentation.

What do Python or Ruby do that PHP can't? Are they "faster?" I've heard that they are more secure, but does that mean that PHP can't be as secure if a skilled developer is coding for security? People say things like "rapid development," but I've been using CodeIgniter and it seems pretty rapid to me. What it all comes down to is this: are Ruby and Python "practical" for novice programmers like me? Truly? If not, then doesn't it make sense to start with a language like PHP and then, when you have figured shit out, make the jump to Python or Ruby? I wish this was more clear.

</comment><comment><USER28> "Whichever language I choose to replace PHP will have its own problems that will take me years to master, but by the time I know whether I chose the "right" language, I'll have invested far too much time in it to practically switch any meaningfully sized project to another language: exactly the situation I'm in now with PHP."

Something that I'm not seeing people take into account generally when they decide to develop in a "new" language or complain about any established language additionally is how far along that new language is and how many people know it well. Choosing the best thing also involves how easy it is to get the help of others. An analogy might be an automobile purchase. If you are located in the middle of nowhere it might be a better idea to buy the Honda where there are multiple local dealers rather than the NewGreatAuto (pick any car with less market share that is better price and feature wise) where you have to travel 50 miles each way for warranty service.

I went through this with hardware back in the 90's choosing SGI servers that were better price and performance wise than Sun, only to find that many open source software ready to run was not available for SGI. And that there were less people that knew IRIX than Solaris.

</comment><comment><USER29> If you're a really good PHP developer and are considering using another language, you should ask yourself one question:

Why do I need to switch?

You've already gone through the pain of learning how to work around all of its warts, and you will lose a ton of productivity immediately after switching to a new language. This may seem trivial if you are just programming as a hobby (and fun, even, to learn something new) but if you are a professional programmer, the productivity loss can be a problem. If you are a freelancer billing at a good rate, can you charge the same thing to your new client knowing things will take you twice as long and be less optimal, with bugs happening in new surprising places?

Taking on a new language needs to happen for a better reason than "the language I'm an expert in is kind of ugly." Are there libraries that are only available in the new language? Is there a different server architecture that lets you write applications with several times the performance in certain important use cases? These are valid reasons. "Too many functions in the global namespace" is not, especially if you already have them all memorized.

<comment><USER30> There's a bit of a false dichotomy there. You don't just have to immediately switch or not. It's worthwhile to learn new languages regularly, whether you use them professionally or not. Keep working in PHP and do a small project in something else. Easy transition if you keep going deeper into this new language, or easy to change your mind and go back to PHP.

</comment></comment><comment><USER31> Being addicted to PHP is like being addicted to coffee; for some of us, it works, and we're just fine with that. Code quality comes from the programmer, not the language.

</comment><comment><USER32> i have been a PHP programmer from college. Switching to python was the best decision i made.i'm just in love with python.

<comment><USER33> x3 - it's far simpler to learn due to consistency, more powerful to do both low & high level programming and a pleasure to work with. Just as simple to setup for web as php. Not real reason to be in knee deep php mess.

<comment><USER34> As easy as PHP in what sense? That Python is basically part of all OS' now or as easy as putting in <?php echo "Hello World"; ?> in a .php file and uploading it to your server?

I severely doubt it's as easy as the latter. I'd like to see an article that explains in less than 140 chars how to deploy a simple app as Hello World to the web in Python without the use of a framework like Django or Flask.

Edit: In the amount of chars Twitter accepts, here's how to get Hello World going in PHP.

sudo apt-get install php5 && echo '<?php echo "hello world"; ?>' > /var/www/index.php

85 characters. I'm done. Now let's see this done in Python... Ruby... Any other popular language this quickly.

<comment><USER35>
      echo "hello world" > index.html && python -m SimpleHTTPServer

:)

<comment><USER36> This just made me laugh. It reminded me of <http://projecteuler.net/> where you are feeling proud because your solution works and then you realize it can be done in one line of one line of Haskel/Python/Perl/Ruby =).

</comment></comment></comment></comment></comment><comment><USER37> Really, I wouldn't worry about making the "wrong choice". I can identify with this, and I think its a reflection of perfectionism, which is not a good trait to have especially when you want to make something new. It takes years to master a language/web dev framework, and considering the pace at which web dev is moving these days, your mastery will be incomplete and slightly outdated by that time anyways. The point is, thats not the goal you should have in mind anyways. You can start from scratch with a new web framework and start being productive in a week, two weeks tops. After that, just use it for your projects and allow the experience of those projects to help you learn more about the framework/language.

</comment><comment><USER38> Perhaps someone should make 'PYP', a Python that's easy for PHP programmers.

Like PHP, .PYP files would be templates with no limits on mixing presentation and logic. The filesystem hierarchy provides the default URL-routing.

But, you get the regularity/power/compactness of Python wherever you want it. (Perhaps, every line in a .PYP file beginning with '\' is meaningfully- indented Python.) If you ever want to hijack a part of the URL-space from the filesystem, there are routing utilities to do that.

Would such a glide-path from PHP to Python be a good thing? Or bad? ("The barbarians are at the gates!")

<comment><USER39> Such a thing exists: [http://www.modpython.org/live/current/doc-html/pyapi- psp.htm...](http://www.modpython.org/live/current/doc-html/pyapi-psp.html)

I don't think it's widely used, though, probably because the possibility of using PHP in this template-like way isn't actually a big advantage (serious PHP devs almost certainly don't use PHP that way); PHP's big advantage is that it's installed everywhere.

<comment><USER38> But _why_ is PHP installed everywhere? At least partially, it's because it offers such a low barrier to initial sloppy usage. Should a PYP offer that too? (And if there are other factors that make PHP easy to use everywhere, could a PYP mimic those as well?)

</comment></comment></comment><comment><USER40> Either Python or Ruby, or any number of other languages, are _so_ much better than PHP that it doesn't matter if you make the slightly less ideal choice.

Go with Python if you already find it appealing.

</comment><comment><USER41> I'd suggest switching to JavaScript (or CoffeeScript) instead of Python or some other trendy language.

a) You need to know it anyway.

b) Node.js is awesome and works the way web servers ought to work.

c) JavaScript, if you avoid the obvious warts, is a really nice language. Every other language I've learned either has as many warts as JavaScript or isn't practical.

Having picked JavaScript, it turns out to be amazingly powerful. Need to automate content production? Adobe's stuff is all scriptable via JavaScript. Want to write a 3d game? Unity uses a dialect of JavaScript.

<comment><USER42> > Every other language I've learned either has as many warts as JavaScript or > isn't practical.

Time to learn some more languages.

<comment><USER41> An, because of course your favorite language is perfect. Let me guess -- lisp?

</comment></comment></comment><comment><USER43> I was in the exact situation a year or so ago. Everything I wanted to build, I always went straight to PHP.

I stopped myself from, unfortunately, not building things. I've spent the last year learning Ruby, Python, Rails, Django, and a half dozen javascript frameworks to get myself acquainted with it all. Only recently I took a position where I'll be working with Rails full-time. It's a tough addiction to break, but it's so liberating once you learn what else is out there and what you can do with it!

</comment><comment><USER37> I think the simple problem with PHP is that its dated. Regardless of whether the language has serious flaws or not, the fact is that it takes a lot more effort and code to do the same things that new web frameworks let you do with a few lines of code. PHP is a great way to learn the basics because it doesn't have quite as many abstractions but that leads to slower development times, and plain bad code (insecure) if the dev doesn't know what hes doing. By the way, I'm referring to slower development times for decent size projects, not quite "hello world" (Honestly, even "hello world" would just be an HTML page and a route in django or RoR - 2 lines vs 1).

So if I was operating in the capacity of a recruiter for a project/company/startup, I'd definitely pick a skilled RoR dev over a skilled PHP dev, because the frameworks and the language themselves are handicaps for the PHP dev. Even if PHP is faster for a very small project, as soon as you move into a decent sized project, the frameworks start paying handsome returns for using them.

Note: I don't particularly love RoR/Django. Substitute with your favorite framework. It's just to illustrate a point.

<comment><USER17> Uh, it's actively being worked on and it grows at a very rapid pace. What you read about or use with PHP is dated. Most PHP applications are 5 years behind where PHP is currently. THAT is the real problem. You obviously have not seen any modern PHP code. RoR is dead dude. Have you been hibernating for a few years?

</comment></comment><comment><USER44> I have a lowendbox for personal PHP projects. I'd love something with a little more static typing, but there's really no alternative (maybe Perl in strict mode?) that isn't going to blow out my 128M ram (no chance of Tomcat). Perhaps C++, but i'd need to first sort out a good templating system, and FastCGI wrapper / spawner.

</comment><comment><USER45> Question: is there a Node.js package out there that lets me write in PHP style, without having to configure _anything_?

I mean, I install node, I install the node package, I start the server...

And then it just looks for an "index.node" file or something in a directory? URL's would map to node files? It would use some kind of templating syntax like <? ?> or whatever, but the point is, it would be as easy to use as PHP. (Each template could get the URL parameters, and read session variables, just like PHP.)

I've used Express, of course, but that's overkill for throwing together a little website. People _love_ the PHP model of files. It's clearly not theoretically ideal, or particularly scalable, but it works and is easy.

Anything out there? Maybe I should throw it together myself...

<comment><USER46> I don't think that model would fit all that well with node in particular. I'm not sure how would make a templating system like that play well with asynchronous calls. And using synchronous function everywhere won't work. (For example, I couldn't figure out how to read from STDIN synchronously, _at all_!)

But even if you do decide to use the synchronous functions everywhere, having all your function names end in Sync would just add unnecessary confusion.

So, while you idea certainly doesn't lack merit, it would make more sense for something other than node.

<comment><USER45> Hmm... you're quite right about that. At the minimum, there would have to be a per-page set of "code", which could contain async functions and result in a final callback, and then a separate per-page "template", which could not. And then that would kind of defeat the whole simplicity of the model, so you might as well use a proper framework.

I guess that's why nobody's done it yet. :) Thanks!

</comment></comment></comment><comment><USER47> Whatever language you are fluent in, its going to be difficult to switch to another language. Sure, I get the syntactical sexiness of Python, but learning its proclivities really would take years.

The fact is that my comfort with PHP stems from knowing what I know, knowing there are things I don't know, knowing there are unknowns I don't know, and knowing there are unknowns that are unknown. (Thanks, Rumsfeld)

Its this grasp on the language that gives me comfort. Mix that in with the universality of PHP and I'm more than willing to take my lumps for being told I solve problems using a shitty language.

There are shitty guns and shitty marksman. A good marksman can kill you with a shitty gun, but a shitty marksman will always be a shitty marksman.

</comment><comment><USER48> Ah, but that's the whole joy of it! Although I have a large enterprise-type code base in Visual Basic/Access Basic, I am still trying to nudge my next project into Python because I love learning new things!

Same with my distro - I am currently using Mint, but that may change, when my next boot hard drive fails.

Even with VBA, where I had done much of the work using DAO (started in 2005 with what I already knew) I am now trying to make the next changes using ADODB. The benefit being it will be easier to shift the back end to MySQL (or any other ODBC-compliant flavor) and have more then one language used in different front ends.

Ah, the learning! My joy in life.... And these days, thankfully little tuition required.

</comment><comment><USER49> At two extremes 1) You want to develop something fast and dirty - Go for scripting language. Out of them PHP is the dirtiest and fastest out of gate and thus the best choice. 2) Want someting battle hard with lots of extendability - Go for a stuctured language - Java or C# will work best here.

Between these two extremes run all others with their fair share of incongruencies and imperfections. They are just not popular and probably never will be. So I don't care. Let me know when there is a language that slaps me on the wrist for bad design and coding!

</comment><comment><USER50> I am always surprised with the level of argumentation in reference to programming languages. From my perspective, good development paterns and arquitecture are WAY more important than the language. It's similar to writing poetry or novels: picking one language over another won't make you a great writer automatically. Can you imagine Cervantes and Shakespeare arguing whether Spanish or English was better? What's most important is what you do with the words of the language, and not the language itself.

<comment><USER46> That really isn't a good analogy. Different programming languages are more like different types of prose or poetry: novels, novellas, plays, epic poems and so on. They have a practical impact on how you get your point across.

I imagine authors do have very strong opinions on whether it is better to write a poem or a short story or a novel.

</comment></comment><comment><USER51> I switched from PHP to node.js and haven't looked back since. And I know node has its shortcomings, but in time I have no doubt that they will be sorted out. Right now it does absolutely everything I need it to do and more.

A huge part of node's appeal to me (and many others, I'm sure) was the fact that I already knew javascript. Making the switch couldn't have been easier.

I used to defend PHP; but now when I look at PHP code, even well-written code, it just makes me go "ugh".

<comment><USER52> I was in the same boat, until I do complex node.js projects, do you use fibers etc? To get around the boomerang code?

</comment></comment><comment><USER53> The PHP problem for me least is always available of existing projects I can modify. The last thing I did was an availability calendar and I soon found a perfect opensource one already written in PHP. A few customer specific modifications later, and I had finished my task. I did look for one in python, but didn't find anything. If I had to write one from scratch, it would be in python, but why reinvent the wheel?

</comment><comment><USER54> Tumblr, Wordpress, Facebook, Instapaper, Wikipedia... PHP has a stronghold, an opensource equivalent implementation for each platform would take forever

<comment><USER55> Every once-dominant technology had a stronghold in its time.

</comment></comment><comment><USER56> What's with the 'PHP sucks' fixation? Enough already. It doesn't help educate others, it makes you look like a know-it-all.

</comment><comment><USER57> See, once again: <http://www.welton.it/articles/programming_language_economics>

It's not exactly mind-shattering stuff, but it's nice to have some common terms to describe the properties programming languages have that make them the kinds of products they are.

</comment><comment><USER58> I've just been rewriting much of the stuff I can't stand (or adding the stuff I can't find) like this ... <http://tetraboy.com/lolcode/> and various easy helper libraries for more intuitive/flexible functions .... listcontains("1|2|3", "|", 3). Most problems solved.

</comment><comment><USER59> On PHP:

This discussion seems to be missing a key factor: __context __.

I seriously dislike PHP and its inconsistent, unpredictable features and libraries. I avoid PHP whenever reasonable/possible. I also avoid talking to mean, verbose or dumb people whenever reasonable/possible. But sometimes I just gotta do it...

So I use PHP, Python, [Java|Coffee]script, Ruby, Django, Pyramid, Express, Wordpress, Joomla, or whatever else is the right tool for the context/job.

In the context of building a 100M request/month API server, I used Python + Django. I would never have used PHP and I consider it a serious mistake to build large scale systems in PHP. Of course, others would choose Ruby, Clojure, Java, Scala, etc and those are all reasonable answers. I happened to be able to get the thing up and running fastest and most effectively in Python + Django.

In the context of currently re-building a client site that needs social features, a small CMS, etc, we're using PHP and Wordpress. I would never have used Python + Django because the client would not know how to host it and whomever is called on to fix a template is going to have to set up a Python stack, learn git and SSH, log into a VPS, etc in order to tweak anything.

Blends are good, too. We recently worked with a client where the website __and __application were built in PHP/Wordpress, but their API was Python. The "application" was basically a handful of Wordpress templates that pulled API data. They got the nice little CMS interface of Wordpress which made the website admins happy, but the developers got to do the heavy lifting in Python. Their anti-PHP developers were quite happy with the arrangement.

On Marco's post:

        If you can get PHP programmers to agree that they need to stop using it,
        the first question that comes up is what to use instead, and they're met
        with a barrage of difficult choices and
        wildly different opinions and recommendations.

Yep and that's true of everyone who's ever behind __a curve when the curve is shifting __. The ice cutters knew about refrigeration, but couldn't adapt. And the curve doesn't always just shift up or down; sometimes it branches crazily and the only way to adapt is to jump into the fray. Even then bad things can happen: Kodak predicted digital cameras, jumped into the fray and basically invented everything and they still got crushed by the digital camera transition.

I think the tension for PHP developers is in understanding on a personal-level how and when to make the transition to newer languages. Unfortunately, many seem to ignore the __possibility __that a transition is underway.

<comment><USER55> _Yep and that's true of everyone who's ever behind a curve when the curve is shifting. The ice cutters knew about refrigeration, but couldn't adapt._

Everyone should be skeptical of claims that include the word "everyone". Here's some history of ice cutters who did adapt; their business established in 1848 is still operating today:

<http://www.capepondice.com/company_history.htm>

</comment></comment><comment><USER60> The problem is pretty much what the article he discusses mentions: I can copy up a PHP file to any old random web host, and it will Just Work.

I would love to be able to not write PHP. But the language that replaces it has to be that easy to deploy.

<comment><USER61> I guess I still am lost as to what frame of reference people are discussing here. What real host [1] doesn't let you run WSGI processes, or arbitrary processes? What happens if you need to make TCP connections, or run a websocket server?

[1] This does not include Dreamhost, Bluehost or any of the other oversold shared hosting (please, feel free to search G+ and see complaint after complaint about them, especially recently).

I guess I don't see any "real" sites being deployed in environments where only PHP is available. A random script that you want to let someone else use for a few minutes, sure, upload that to randomphphost.com, but a real life public webapp??

If you take the time to learn it, deploying C#, python, ruby apps can be insanely easy. And to be my usual self, deploying Golang apps are beyond insanely simple. (I cross compile from my Mac to my Linux 64bit target, upload and run `sudo ./server -host=:80` and I'm deployed).

<comment><USER62> Most people don't start writing Real Sites hosted at a Real Host. They start with a stupid little static home page as a hobby hosted for free by their ISP or a $2-3 a month hosting provider. Then they want to add just one dynamic feature (maybe include a header and footer for each page), and they're obviously not going to learn Python and work out what the hell a WSGI is and get a new, probably more expensive, hosting provider just for that, so they use PHP, because it's trivial and already included. Then they need another slightly larger, feature. Fortunately there exists an Open Source php project providing just that feature, so they drop it in and it kind of just works.

A few more features get added in this way over the next few month and years and all of a sudden the sites popularity explodes. Now they have a whole bunch of stuff to deal with, and rewriting the entire site in some other language they know nothing about is not on the top of their priority list.

<comment><USER61> I don't disagree that Python/Go/C#/Ruby represents a bigger upfront learning and potentially cost investment. I think it pays off in functionality, development speed and flexibility in the long run is all.

</comment></comment></comment></comment><comment><USER63> The reason you describe your relationship with PHP as an "addiction" instead of using a word that described a more healthy relationship is probably because there is something about it that doesn't resonate well with your core values. At least that's the problem that I had with it.

If you want a nice introduction into the world of developing web apps with Python, I suggest you read the Flask user manual (see <http://flask.pocoo.org/docs/>). It not only covers the basics of the framework, but also seems to assume that you're a first-time Python user as well. It covers topics such as using virtualenv and pip to setup your environment which I found very helpful when getting started with the language.

</comment><comment><USER64> I have the same problem nowadays and think about migrating to Java for web development. I heard about Play! framework very much. Do you think Java is a good idea for web over Python and Ruby?

<comment><USER40> Many people (myself included) find Java too limiting. Many others like it.

But even Java is so much better than PHP. If you like it, go for it.

<comment><USER64> Actually, I find Python and Ruby much more interesting than Java (actually, Java seems as a boring language :) ) . But since Java is general purpose language and it's known as market skill, I want go for it.

<comment><USER40> Python and Ruby are both general purpose languages, and both also run on the JVM.

Knowledge of Java can be useful though, as terrible as the language is.

<comment><USER49> Python and ruby are just scripting languages - Java is a structured type safe language which is battle hard. No comparison!

<comment><USER40> Don't be silly. All three languages are of similar maturity (in fact Python is even older than Java) and all three have been "battle tested".

The only thing you might argue is that the JVM is a better runtime than CPython or CRuby, and for that there's JRuby and Jython.

</comment></comment></comment></comment></comment></comment><comment><USER65> A victim must want help.

Make small incremental steps.

The investment you think you have in X (PHP) is less than you think. It's much more in how to code, how web works, etc. the PHP parts are cruft you won't miss anyway.

</comment><comment><USER66> I've had a similar issue and have even come up with some suggestions myself[1], but really I think there is only one company in the right place to produce a serious PHP competitor. Facebook.

They have the man-power required to displace it, as well as the serious need... although the only potential solution they have come up with HipHop / HPHPi is really lacking in community support. Its open source but rather undocumented, and took an entire day to get set up.

If they could produce a viable alternative to PHP... something that fixes the clear fuckups but doesn't try to fix everything I think it would have a real shot.

[1] <http://davelang.github.com/>

</comment><comment><USER67> Wow, this is EXACTLY the same problem I have... word for word.

<comment><USER68> Ditto.

</comment></comment><comment><USER69> How do PHP people handle templating simply?

Edit: Perhaps I worded my question wrong. How do PHP programmers try and keep to DRY (ala layouts and view templates)?

<comment><USER70> Since PHP is a template language at heart, they go ahead and use PHP. For PHP folk, I guess the question is: how do people handle templating simply in other languages, since they can't use the host language itself for that?

EDIT: Disclaimer: I'm a PHP guy trying to make a break for it, and the question was both rethorical and tongue-in-cheek.

<comment><USER71> In Python, I've always used string substitution. I've never understood the need for a special templating system when it's already built into the language:

        template = """<boilerplate html>%(greeting)s</boilerplate html>"""
        parts = {'greeting': "Hello, World!"}
        page = template % parts

I create my site-wide template in a module and never have to look at it again, so my application code is mostly logic. When I have to work on PHP or Coldfusion, I don't understand how people can bear to have the logic hidden in a markup language that's mixed up with another markup language. Many can't, and that's why there are templating engines for what are essentially template- based languages.

</comment></comment></comment><comment><USER72> _"... The fear of making the "wrong" choice actually makes the familiar, mastered FOO more attractive. ..."_

An excuse for not learning something new.

</comment><comment><USER73> Looks like PHP is the VBA of web design.

</comment><comment><USER74> "There are only two kinds of languages: the ones people complain about and the ones nobody uses."

-Bjarne Stroustrup

<comment><USER75> Sure, but the pain-to-usefulness ratio is important, and _does_ vary from language to language.

</comment></comment><comment><USER76> i'm so bored of these arguments and how people get so religious. its honestly nuts.

</comment><comment><USER77> The only thing actually wrong with PHP, is that it's popular but not cool. And that's a terrible place to sit for any product.

It runs half the Internet quite well, but if you went by the posting on HN, you'd think it was Windows Vista.

I've probably read every article critical of PHP that has hit the front page of HN in the last few years, and the one thing they all have in common is the vague refrain that PHP is a broken language. And yet the gap between tangible proof of that being the case in real world use and the gossip of it supposedly being true, couldn't be wider.

<comment><USER78> > The only thing actually wrong with PHP, is that it's popular but not cool.

Hey now, we're all human. Even engineers. As soon as something becomes popular, it is no longer cool. Cool is the next popular. Cool is being different. That's just how things work.

Apache is slooooow (NGINX is cool!). MySQL is retarded (Postgres is cool!). PHP sucks (Python is cool!). Red Hat is lame (Ubuntu is cool!).

See a trend? The tech that sucks is the most popular and well established. The tech that's cool isn't popular. It has nothing to do with any objective qualities of platforms. It's all about being a part of the cool croud!

Remind you of high school much?

Now, if this is just a hobby, who gives a shit? Roll with the cool kids. If you're starting a business, be aware that the future welfare of your family is relying on your decisions. Think real hard about that.

<comment><USER79> I don't know enough about MySQL vs Postgres or RedHat vs Ubuntu to make a point with them, but sometimes it's not about being cool.

Apache is a webserver from 1995. It uses a process (sometimes a thread) per request, a architectural decision which made it nearly fundamentally incapable of solving the C10K problem. Only back in January was the Event MPM added (and it's still experimental), allowing you to have many Keep-Alive connections open at once without degrading performance. Nginx was started in 2004, and is event-based allowing for much higher concurrency. (Yes, I'm hand waving.)

PHP is among the worst languages most sane programmers have ever used. The referenced article, "A Fractal of Bad Design" is a pretty good starting point if you want more details on why it sucks. PHP stands for letting amateurs code effectively. Python is designed with an emphasis on readability, and manages to have a rational type system and a fairly regular standard library.

Apache vs Nginx is about learning from the mistakes of your ancestors. Apache was designed with the 90s in mind, and our technology has moved on to the point where the decisions made in its architecture simply don't work anymore.

PHP vs Python is about being a rational, non-masochistic, human being.

To say what is cool "has nothing to do with any objective qualities of the [technologies involved]" is to know nothing about programming as a business.

<comment><USER78> You wrote a well thought out response. I owe you a response in kind.

People have a tendency to overrate their rational capacity to reason out a viable decision. While you listed a few solid critiques, the situation is infinitely more complex.

And by _infinitely_ , I do mean exactly that. As in, beyond your capacity to reason it out.

In the end, the only right decision is a decision which withstands the test of time. Both Apache and PHP have done that and continue to do so.

Apache holds 65.5% of the market [1]. PHP holds 77.9% of the market [2].

Those solutions are working, right now, for all of those people. That's reality, not grand "rational, non-masochistic" theories.

[1] <http://w3techs.com/technologies/details/ws-apache/all/all> [2] <http://w3techs.com/technologies/details/pl-php/all/all>

Now that we're finished with that, I'm going to enjoy myself.

> a architectural decision which made it nearly fundamentally incapable of > solving the C10K problem.

C10K is not a problem and never was. The limiting factor in the overwhelming majority of deployments is the _pipe_. Apache can saturate the pipe just as well as NGINX. You will saturate the pipe long before you reach 10K connections. Which is why people continue to use Apache. Being technologically superior is pointless when there are no real-world benefits to that technological superiority.

On top of that, Apache's thread model provides it with greater stability. If a worker thread crashes for whatever reason, another will simply spin up. If your NGINX process dies, you'll need to wait until your monitoring solution brings it back up. Which could be a long time.

> PHP is among the worst languages most sane programmers have ever used.

Worse than COBOL? Yes, yes, a fractal of bad design! Except that article was written by somebody who doesn't have much experience in PHP and most of those complaints don't apply to the current stable version. The rest are easily avoided with sane design.

> Python is designed with an emphasis on readability

Was that humor? Python shoves its version of readability down your throat and laughs as you choke on it. Not all of us get off on syntactically significant white-space. In fact, most of us don't. Which explains why Python is so unpopular. But I get, I get it. It's cool.

<comment><USER80> The first half of your post is basically a long-winded appeal to popularity. Yes, most people on the web use PHP and Apache. Most people on the web also need nothing more than a WordPress installation and their online needs are met. Does that mean WordPress is the best tool out there? You should stop confusing popularity with quality, because the two rarely overlap.

 _> C10K is not a problem and never was._

Somebody better tell the developers of nginx, Lighttpd, Tornado, node.js, Cherokee, Apache Deft, IIS, and Jetty! All those hours wasted developing solutions to a problem that doesn't exist.

 _> Which is why people continue to use Apache._

For someone who just decried a situation "infinitely more complex" a few line breaks ago, you sure did generalize the reason millions of servers use a certain piece of software. It couldn't be because Apache has an easier installation on most of the common distros or that cPanel/WHM, the most-used virtual hosting control panel, only supports Apache as its web server. It also couldn't be because of mod_php.

This all stems from your conflation of popularity with quality. PHP did not become popular because it was good. It became popular because it was easy to learn and run.

 _> Except that article was written by somebody who doesn't have much experience in PHP and most of those complaints don't apply to the current stable version. The rest are easily avoided with sane design._

Most of his criticisms were completely valid, so I'm not sure where you're getting the author doesn't have much experience in PHP. Which ones have been fixed in the current stable PHP? And which ones can be avoided "with sane design"?

 _> Which explains why Python is so unpopular._

Now I know you're spouting nonsense: <https://github.com/languages/>

<comment><USER68> > Most of his criticisms were completely valid

Not even close. The author trolled through a bunch of other misinformed articles, copied some them verbatim mistakes and all. He doesn't know PHP and didn't research anything.

> Which ones have been fixed in the current stable PHP? And which ones can be > avoided "with sane design"?

<http://news.ycombinator.com/item?id=4177516>

<comment><USER80> In regard to his "objects compare higher..." point, I think he was referring to this:

        class MyClass {}
        class YourClass {}

        $myclass = new MyClass();
        $yourclass = new YourClass();

        var_dump($myclass > $yourclass); // false
        var_dump($myclass < $yourclass); // false?

In regard to his "there's no pass-by-object identity..." point, there's no way to do this:

        class MyClass {}

        $myclass = MyClass;
        $anotherclass = $myclass();

I really don't have the energy to refute the rest, but most of them are _relatively_ subjective. (I say relatively because most of them promote better programming, but their absence doesn't directly harm)

<comment><USER68> > In regard to his "objects compare higher..." point, I think he was referring > to this:

That all comparisons between objects, except equals and strict equals, return false doesn't seem terribly unreasonable.

> In regard to his "there's no pass-by-object identity..." point, there's no > way to do this:

        class MyClass {}
        $myclass = new ReflectionClass('MyClass');
        $anotherclass = $myclass;
        $instance = $anotherclass->newInstance();

        $myclass = 'MyClass';
        $instance = new $myclass();

> I really don't have the energy to refute the rest, but most of them are > relatively subjective.

I think you'll be hard pressed to find too much fault with my criticisms of that article. The author doesn't even know common language terms like private/public/protected. And clearly he's never even seen C++.

<comment><USER80> _> return false doesn't seem terribly unreasonable._

It should throw an error, not return false. This goes back to PHP's "try as hard as possible to run the script" mentality.

The author doesn't need to know C++ to comment on PHP's failings, does he? And he knows private/public/protected— you even quote him using them. You're probably not familiar with Python, but there aren't any private methods (aside from double underscored-prefixed methods, but that's not entirely the same). That's where he was coming from. It's not that he doesn't know those terms; it's that he thinks that's how they should work.

Judging by your other responses, you're quick to toss out whether someone is a "PHP programmer" or not, as if that has any bearing on their argument. I'll tell you right now, I work in PHP five days a week, and I agree with most all of eevee's points.

<comment><USER68> > It should throw an error, not return false. This goes back to PHP's "try as > hard as possible to run the script" mentality.

I don't disagree. Although I think this goes towards PHP weak typing not it's try as hard to run the script.

> It's not that he doesn't know those terms; it's that he thinks that's how > they should work.

He thinks they shouldn't exist at all. Which is one philosophy but that's not a valid criticism.

> I'll tell you right now, I work in PHP five days a week, and I agree with > most all of eevee's points.

Even where he clearly doesn't know what he's talking about and didn't try the code he was supposedly saying doesn't work?

Those who don't know their tools are bound to have more problems or believe things that are just wrong.

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER81> >the first question that comes up is what to use instead, and they're met with a barrage of difficult choices and wildly different opinions and recommendations.

The real answer is "it doesn't matter". Of course python people will try to convince you to use python, and ruby people will try to convince you to use ruby. But both groups will agree that either language is far better than PHP. And as someone who likes neither of those languages, I would agree with both of them, just pick one. There's no "wrong choice" to worry about.

<comment><USER82> The choice does matter. A lot. When I started with ruby, I had to decide between 1.8, or 1.9, or jruby, or several other choices. Then I had to pick sinatra or rails or merb or whatever. mongrel or passenger or thin or unicorn. It didn't really seem like the choice would matter, but then you run into some tiny annoyance, do a bit of research and find out that some other framework doesn't have that problem. So you switch, only to find a new problem. This goes on for a little while until you realize that you could write the whole damn thing from the ground up in lua.

The time spent just researching whether it's a bug in my code or their code starts to eclipse the total project time if done in another language.

<comment><USER83> "... run into some tiny annoyance, do a bit of research ... So you switch ..."

If you pick a solution and run into a tiny annoyance learn to work around it in some way. It is a _tiny annoyance_.

Best case scenario, learn why it's happening, how you can fix it, and (in a dreamland) submit a patch that fixes this for everyone else in the future.

Worst-case scenario just find a workaround.

<comment><USER82> If it's early in the life of a project and you don't have much experience with the framework, tiny annoyances are a warning sign. If the easy things don't work the way I like, what happens when I try to do something hard? The cost of switching is low.

I used merb for all of about 10 minutes before giving up on it. I fooled around, created a couple very basic crud pages, and it worked for a bit, then I got nothing but error pages. root cause: I had created a new class called 'fish'. That opened my eyes to the fact that were was so much automagic fairy dust sprinkled about, if anything serious ever went wrong I would never figure it out.

</comment></comment></comment></comment><comment><USER77> Yeah, I wrote Tumblr in PHP, but I'm eager to abandon it. You know, it's just an easy to use, broken language that you can scale a site to 15 billion page views per month with. I'm sure my next project will need a better language, because it's going to scale to 400 billion page views per month, and PHP just isn't going to cut it.

Hilarious suggestions contained throughout his post.

<comment><USER84> Where did he say anything about scaling in the article?

<comment><USER85> I was actually pleasantly surprised by not reading about the usual "webscale" BS in these two articles. Both authors made it very clear that this is not about being able or unable to build something with a given language, but the quality of how you do it.

<comment><USER86> On what planet is the ability to scale a web application not a quality metric?

<comment><USER85> It sure it, but that's not part of the discussion. Also, when talking about web development, the language used is rarely the bottle neck.

</comment></comment></comment></comment></comment><comment><USER61> >"Whichever language I choose to replace PHP will have its own problems that will take me years to master"

What? Really?

<comment><USER87> There is some truth to this. However, if you define a "better language" as one which is more consistent and predictable and less buggy, that implies less time to master.

One thing I love about Ruby is how many methods suggest one another. For example, Enumerable collections, like arrays, have an `any?` method. It takes a test function and returns true if any of the items pass that test.

[1, 2, 3, 4, 5].any? {|i| i > 4 } # true

Ok, you just learned `any?`. Now, you can replace `any?` in the above with

1) `all?` - do all elements pass? 2) `one?` - does exactly one pass? 3) `none?` - do none pass?

If you can remember one of those, chances are you can remember others. And if not, `myarray.methods` will remind you.

That same array has a `max` method and a `min`, a `max_by` and a `min_by`. It has a `select` to get all matching items and a `reject` to get all non- matching items. Knowing one helps you remember another.[1]

The key is __consistency __. It speeds up the learning process and makes you refer to the documentation less often.

That's the advantage of choosing a good language. It reduces the very pain that the OP is worried about.

</comment></comment><comment>====

[1] (But wait, there's more! Any class you create, if you define `each` and `include Enumerable`, gets all these methods for free!)

<comment><USER61> If all someone knew was PHP, maybe they would struggle to learn something else, but in my case, if I immerse myself in something and learn it and use it, it's not going to take me _years_ to get productive with it. Especially given the limited things that PHP can do, learning to do those in python/ruby/C#/Go took... trivial amounts of time. With the benefit of more functionality and a sane API. (and in two cases, static typing)

Alternatively, if all I knew was PHP, I would understand why someone would be scared of learning something new. I mean, look up and down this thread. Everyone thinks a one-liner hello world is the pinnacle of the ultimate web dev language. Because real web frameworks require an http handler, they assume it's more work or harder. To me, it seems that many in the "PHP is easier!" crowd are too scared or lazy to take the time to learn something else and realize that better separation of concerns and tooling actually allows for faster and safer development.

</comment></comment><comment><USER88>
       "[php solves problems etc] but it's deeply flawed.
       [...] I promised my next project i would code in something else
       [...] but i went right back to PHP"

This really struck a cord here... Is that the first signal that tomorrow I will be the Cobol guys of yesterday today?

Or is it just a signal that PHP is indeed damn practical for web prototypes that tend to overgrow?

i'm pretty comfortable dumping C and assembly to microcontrolers (kidding, nobody is. damn datasheets full of mistakes) and automating every bit of what i do in bash and python. but i can't get away from PHP for web crap!

</comment><comment><USER89> Well, there's a solution.

Do not write every part of a project in only one language. Following the UNIX "Small is beautiful", most projects can and are cut to small things that work together.

I often find myself writing a library in Python and publishing it's API in web.py, building services that rely on this API in Node.js, and making the final website in PHP.

</comment><comment><USER90> Its benefits are vastly outweighed by its negatives for me. I've made things in PHP before but if I ever do it again, it will be too soon. Sounds like a nasty addiction.

</comment><comment><USER91> my advice? stop writing blogs and start writing python.

</comment><comment><USER92> I don't understand why someone does not just fork PHP and create something that's syntactically similar but fixes a lot of the problems people complain about.

<comment><USER93> PHP is an incredibly complex project which is being actively developed [1] and improved. If there were very simple ways to update PHP that were universally agreed upon, they probably would be added (Like short array syntax, built-in HTTP server or many other new features added in PHP 5.4). It just isn't a syntax issue, there are underlying principles about the way features are considered in PHP that are just different from other "similar" scripting languages like Python or Ruby.

If somebody had profound disagreements with the way PHP was being developed, they would be much better off switching or contributing to another language then they would be trying to re-invent PHP.

[1]: <https://github.com/php/php-src/graphs/code-frequency>

</comment></comment><comment><USER94> "...next language choice was clear: Python, which seems to fit my style better than Ruby"

Just out of curiosity, why would someone believe this? The syntax of python and ruby are nearly identical, but ruby has more tools and support for web- based projects. For someone looking to develop for the web, ruby is pretty clearly a better choice. And this is not knocking python at all, I really enjoy them both and there are many other things python has more community support for - don't get me wrong.

To support what I'm saying about the syntax, check out this comparison: <http://hyperpolyglot.org/scripting> \- they are super similar, if anything ruby is a tiiiny bit more elegant.

<comment><USER95> Just by looking at a syntax table, the higher-level differences are not going to be enumerated.

Just off the top of my head:

\- Ruby was always designed as an OO language, whereas Python OO was bolted on later. Ruby's object system is almost a straight transplant from Smalltalk and is very powerful.

\- Python lambdas can only be one liners. Ruby lambdas can be arbitrarily long. Guido doesn't really like FP - there's no tail recursion, either.

\- Ruby's metaprogramming capabilities are a bit more powerful (haven't really looked at Python in this regard, so don't quote me).

\- In fact, there are some pretty big syntax differences. Python requires brackets even for the print statement now, whereas Ruby lets you miss them out if it's unambiguous. Ruby has blocks. Python doesn't have "end\n end" sprinkled everywhere.

The main philosophical differences are that Ruby is more powerful and implicit, wheras Python is stricter and explicit. When I say "powerful", by the way, I don't necessarily mean "good", just that it exposes more functionality to the user. Although I like Ruby a lot, I accept that on large projects Ruby's power (like that of Lisp or C) can be dangerous. Python has a lot going for it.

You're right, they're still very similar in many ways. Maybe they're like Democrats or Republicans; up close, they're screamingly different, but from a distance they're almost alike.

<comment><USER40> While I find Ruby to be nice overall, you're wrong on several points:

\- Whether or not Python was historically OO or not, everything in Python is now an object. Its love for protocols drives design like `str(foo)` (which calls `foo.__str__()`), not any particular deficiency in its object system

\- Python's lambdas are indeed limited, but one can easily use `def` and just name the function. Functions are first class, after all

\- Metaprogramming facilities are very similar in power. Neither language has macros.

\- Python tends insist on not duplicating things (i.e. both indentation _and_ braces/end) and on not being ambiguous. There is another reason Python can't omit braces for function calls: without braces, they are references to the function. As a consequence, Python doesn't need things like .call()

Overall, I haven't seen one language or the other to be more powerful.

<comment><USER96> Personally, I find that Python and Ruby are comparable as it relates to utility. I'd think it is fair to say that argument is a wash. It is Ruby's expressiveness that makes it my choice before Python:

\--- Ruby ---

      letters = ['a', 'b', 'c']
      letters.map &:capitalize

\--- Python ---

      letters = ['a', 'b', 'c']
      capitalize = lambda x: x.capitalize()
      map(capitalize, letters)

\--- PHP ---

      <?php
      $letters = ['a', 'b', 'c'];
      array_map('strtoupper', $letters);

Of course, this is one example where PHP (5.4+) at least somewhat resembles Python. I think that is why some of the more experienced PHP developers tend to choose to go with Python as their PHP recovery language.

Personally, I prefer "letters.map" (Ruby) over "map(...)" and "array_map(...)"; however, that is a personal style preference and has nothing to do with technical merit. And I still enjoy writing Python here and there. PHP is also still a necessity much of the time.

That being said, there are a few edge cases that I've witnessed where Python actually reads better than Ruby; though, these cases are few.

<comment><USER97> idiomatic python would be

        chars = 'abc'
        [c.upper() for c in chars]

<comment><USER96> Fair enough :)

</comment></comment></comment></comment></comment></comment><comment><USER98> I propose this as a blueprint for a solution:

        {%
        name = request.get('name','world')
        list = ['this','language','rocks']
        %}
        <h1>Hello {{ name.upper }}</h1>
        <ul>
        {% for item in list %}
            <li>{{ item }}</li>
        {% endfor %}
        </ul>

Save it as 'index.nxt' and run it in any future language you are going to design.

Create a mod_next and try it on any web server like apache, nginx, etc. It should work without any extra fiddling with config files or installing frameworks or template engines.

It should just work!

That's the kind of platform that would leave php behind once and for all.

<comment><USER18> You have just mixed HTML and server code. You fail.

<comment><USER98> That's php, just cleaner. If we don't recognize that as one of php's strength we're doomed to fail.

Of course once you master it, you separate the code from the html and call it from the view like this:

hello.nxt

        name = request.get('name','world')
        list = ['this','language','rocks']
        response.render('hello.html',name,list)

hello.html

        <h1>Hello {{ name.upper }}</h1>
        <ul>
        {% for item in list %}
            <li>{{ item }}</li>
        {% endfor %}
        </ul>

But what do I know about language design or human behavior?

<comment><USER61> Funny mixing PHP into HTML is one of the things I hate the very most. And is one of the first problems usually solved by PHP web frameworks. Well, templating is actually generally a primary component of "all pieces included" web frameworks in any language.

<comment><USER98> Exactly, but that's the easiest way to start learning. That's how everybody got their feet wet in web development. Then you jump to MVC and best practices.

My point is, the language has to be designed as a web framework from the get go, routers, templates, models, everything should be right there so noobs feel confident from day one. That's the only way to conquer the world.</comment></comment></comment></comment></comment>


Vigilante engineer stops Waymo from patenting key lidar technology - <AUTHOR> https://arstechnica.com/cars/2018/10/lone-engineer-spanks-waymo-in-lidar-patent-battle/ <comment><USER2> This is so typical in technology now, large corporations patenting everything they can possibly think of, including things that they've blatantly copied. It absolutely doesn't surprise me that a technology as fundamentally simple and foundational as LIDAR is covered by a load of bullshit patents. As the article notes what this is really about is using your patents to litigate competitors either to slow their progress or force them into expensive fights that drain their resources. Frankly, patent reform is yet another case where the large players have built themselves a moat.

<comment><USER3> Using Patents to patent trivial stuff and then getting a monopoly from the government as reward is just rent seeking evil and wrong on so many levels.

</comment></comment><comment><USER4> What if patent applications required a fee that was added to a bounty fund to reward people that could demonstrate prior art during the examination period? Engineers like Swildens would then be more than interested bystanders, but have skin in the game and therefore incentive to do what he did just out of interest.

Bounty claims could also require an accompanying fee, to be refunded if the claim succeeds. The fees would discourage low quality patent applications and bounty claims.

<comment><USER5> I don't think this would work. If the fee was too high, then smaller companies and individuals would be locked out of patents. If the fee is too low, then it doesn't matter and large companies will continue business as usual.

<comment><USER6> Make the bounty $10000 * sqrt(# patents owned by applicant)

<comment><USER7> Trolls will often have one patent per company all owned by a 2nd company. That's really hard to stop.

<comment><USER8> How about making it travel up the tree? Find the "root" company, then count the patents of all of the companies directly or indirectly under them. (yes, I like graph theory. Is it that obvious?) Use that to increase the fee. It would not only make trolling harder, but make it easier for small companies/inventors to have one or two crucial patents, which is what the system was designed for. Of course, as with most things that make sense to me, it would never pass as law.

</comment></comment></comment></comment></comment><comment><USER9> > He then spent $6,000 of his own money to launch a formal challenge to 936.

Either he has a lot of spare time and money or this isn't the full story.

<comment><USER10> > Either he has a lot of spare time and money.

He probably has! [https://www.wired.com/story/eric-swildens-uber-waymo- lawsuit...](https://www.wired.com/story/eric-swildens-uber-waymo-lawsuit- patent/)

And previous discussion on this: [https://news.ycombinator.com/item?id=15875685](https://news.ycombinator.com/item?id=15875685)

<comment><USER11> tl;dr for those who don't want to read devys link (though you should. Good article):

> After a three-year battle in which he spent up to $1000 an hour on lawyers, > Swildens ended up selling Speedera at a discount to Akamai for $130 million.

He can probably do this a few more times.

<comment><USER12> Everyone needs a hobby.

</comment></comment></comment></comment><comment><USER13> This is really pissing me off as they can essentially patent anything and everything and squash all completion. It's now an arms race of patents among the tech giants.

I remember reading here how Google was patenting neural network layers such as dropout etc.

<comment><USER14> It is tough for the small guys. It's not uncommon for a patent application to cost you upwards of 30k or so to file which is a definite barrier to entry to start with.

</comment></comment><comment><USER15> "Waymo's lidar firing circuit showed current passing along a wire between the circuit and the ground in two directions—something generally deemed impossible. "

It's almost as if science said, "Give me one free miracle, and from there the entire thing will proceed with a seamless, causal explanation."'17 The one free miracle was the sudden appearance of all the matter and energy in the universe, with all the laws that govern it. Rupert Sheldrake, The Science Delusion: Freeing the Spirit of Enquiry

</comment><comment><USER16> > describes how a laser diode can be configured to emit pulses of laser light > using a circuit that includes an inductor and a gallium nitride transistor.

Did they seriously try to patent an oscillator? Galium nitride FET or a vacuum tube, this design is at least 100 years old. WTF.

<comment><USER17> You can't claim to have invented the oscillator, but you can claim the novel use of an oscillator for a particular application.

</comment></comment><comment><USER8> The very least the courts could do here is make the patent owner pay back the 6000$ the engineer spent on the challenge. Of course, IMO they should get a big fine to go with that too.</comment>


Free At&t Rollover Minutes - <AUTHOR> http://www.9to5mac.com/51649/att-says-thank-you-to-iphone-users-with-1000-bonus-minutes

<comment><USER2> If only I actually needed rollover minutes. I have 7,200 rollover minutes I'll never use.

I wish they'd give out free MB/GB of data. _That_ I could use. (Though right now I'm still on the grandfathered "unlimited" plan, so I guess that's useless too.)

Heck, just drop my voice plan and let me buy data only. I'll cope.

</comment><comment><USER3> Didn't get the message but the number does match previous notifications from AT&T.

Gave it a try... will update if I get a response.

[edit] Correction, it's actually not quite the same as the number for previous notifications. Previous was 11113000 so my phone 'corrected' the new number (11113020) to the previous one without me noticing.

However, yes it seemed to work with the 11113020 #.

</comment><comment><USER4> I find these little gifts from At&t kind of insulting. After years of doing nothing at all because they had iPhone exclusivity now they're trying to convince people to stay? Perhaps if they had done things like this all along it would be worth staying with the company.

</comment><comment><USER5> Nice.

AT&T though is smart. They realize they won't have to honor any of these free minutes because iPhones can't make a call on their service.

(But I gave it a shot anyways - what the hell I figure).

<comment><USER6> I admire your cynicism. I was cynical as well, but went the other direction and assumed that this was AT&T trying to bilk $0.20 out of millions of people without text messaging plans.

</comment></comment><comment><USER7> It worked for me even without an iPhone. Though I wonder if this credit will actually go through.

</comment><comment><USER8> AT&T has also been giving free mini-cells -- I have one. It's a little bigger than a typical wifi hub, and it connects to your local network and makes up for reception dead spots in your house.

I wish they'd spend the money upgrading and building out their cell network, though. And I wish they'd done it about four years ago.

<comment><USER9> Do you think you fit some sort of customer profile that triggered such beneficence? To me minicells look awesome -- but also sort of prohibitively expensive.</comment></comment>


Ask HN: Suggest a 2D only alternative for blender - <AUTHOR>

I want to design a speedometer and then animate it. This is an hardware in loop thing so I dont want to use Flash. I will prefer and open-source alternative.<p>Please help. <comment><USER2> SVG?</comment>


The ultimate iPad email client? The endless search. - <AUTHOR>

Why has no-one created this? I know Sparrow for iPad is on its way, and no doubt it will be pretty good. I was just wondering why the limited take up to the challenge, just in case I'd missed anything.
I assume the risk if Apple rejecting the app is also high and given the likely time investment of building a native app that might have a put a lot of people off.
Still. Seems strange. <comment><USER2> Because the built-in email client is more than good enough.

And when I mention the use of email to most people in their 20's they stare at me like I just walked out of the jungle.

<comment><AUTHOR> Haha. Is it really good enough though? Even really basic things like search are not ideal. I actually think there is room for a super simple email client (i.e. not with labels etc.), but that competes with the native product, but is actually in keeping with the quality of the rest of the functionality.</comment></comment>


Ask HN: Help With Network Filesystem Implementation - <AUTHOR>

Hey Everyone,
I've been working on a syncing, network filesystem and I wanted to get your advice on an implementation detail.  Our hope is that users will have all of their files (and eventually programs and settings) synced in the cloud.
Which would you prefer?
Option 1:

    > You install our software, Skyline, on Device A
    > We create a folder in your home directory, /skyline
    > You select individual folders and tell Skyline to sync them
    > Each folder you selected is accessible from both its original location, and from the /skyline folder
    > You install Skyline on Device B
    > A /skyline folder is added to home, and any folders you added from Device A are accessible
    > You select individual folders and tell Skyline to sync them
    > The folders you add are now accessible in their original location, in Device B's /skyline folder, and in Device A's /skyline folder.
 Option 2:

    > You install our software "Skyline" on Device A
    > Your entire home folder is now being synced
    > You install our software, "Skyline" on Device B
    > You are asked whether files from Device A should be merged with the files on Device B, or if the files from Device B should be deleted and replaced with the files from Device A
 Thanks!
PS: If you're interested, sign up for updates on http://www.projectmeadow.com <comment><USER2> I don't understand how this is different? Option 1 sounds like MSFT SkyDrive and option 2 sounds like Dropbox. Just looking for what's different.

Oh! This is for a laptop, not an app like the two I mentioned?

<comment><AUTHOR> Correct, a laptop is the endgame.

Our initial release will however be software that you can run on your current system.

> I don't understand how this is different? Option 1 sounds like MSFT SkyDrive > and option 2 sounds like Dropbox. Just looking for what's different.

The cases being described in the post are _not_ the primary use case. Those cases describe users who aren't sure whether they wont to commit their entire system to project meadow integration.</comment></comment>