Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What other languages besides PHP have you used? I think a lot of us dislike PHP because we're putting it in the context of better designed languages.


Sorry to respond twice to your post, but I realized this was a great opportunity to learn something. Given my basic example in my post, what language would you recommend I try to accomplish this task? I like to stay away from frameworks so basically I'm asking you to not suggest Rails, however don't be afraid to suggest ruby. If you feel like typing something out, let me know why you suggest it and what advantages it has over PHP.


Ruby. It's the cleanest language with the most sensible standard library I've come across to date. Ruby doesn't necessarily mean Rails, and in fact I'm not a fan of Rails' overly prescriptive paradigm. (As an aside, any time you hear Rails is an MVC framework, discount it because it's really an MVA framework.) One of the things you'll find coming from the world of PHP is Ruby has consistent method signatures. For this and a lot of other reasons you'll almost certainly be happier with Ruby.

Aside from happiness, there are things that make Ruby more powerful. For example, you can cleanly implement the reactor pattern (think: NodeJS) with EventMachine and with EM-Synchrony you can avoid the callback hell that comes with NodeJS.

If you want, you can look at Sinatra to provide the common functionality that the PHP framework provides. With Sinatra you're not all-but-forced to use an ORM like you are with Rails, as Sinatra doesn't include one. If you really want, you can go closer to the metal and look directly at Rack, which is middleware between web servers (Apache, Nginx, etc) and the actual application.

There's really no right way to do it, but the best thing is to learn and explore. Some people will recommend Python, and while it's a decent language, it's got some things I consider to be rough edges -- lack of useful language features, such as switch/case statements, and badly implemented parts of its standard library that handle network requests.

The next language on my learning list is Go. I've heard nothing but good things about it, but I'll reserve my judgment until I have some experience with it.


I'll second Ruby because of Sinatra and add some of my own thoughts. Sinatra is a very gentle introduction to separation of concerns. You can get a Sinatra app running on a shared Dreamhost with the same effort as a PHP site.

PHP was ok for me I spent a ton of time looking up functions in the docs but I could get stuff done. Once I had to edit/work with 3rd party code it was a nightmare.

I've developed in PHP, Ruby, C#, Java, ActionScript, and Python and Ruby's gem system is by far the easiest package management system I've used. Making your own gem is really easy.

Great ideas seem to pop up in Ruby first and then are ported to PHP, so why not use the original (see Rails, Cucumber, Bundler).


Thank you for taking the time to write this. You have sufficiently peaked my interest. My next personal project will be done in Ruby.


>My next personal project will be done in Ruby.

Here's a better idea. Take a very simple problem - say user fubar enters his name, you say "Welcome, fubar!", populate a backend database with his name because he's a new user. Otherwise you tell him "Welcome back, fubar!" and don't mess with your database.

This involves what ? Handling a GET, making a database insert, doing a select on name in a database, that's it.

Now go do this in atleast 5 frameworks, and time yourself. PHP obviously, but do try RoR, Django, Play2, JSP and ASP.NET

I actually did the above exercise and came away with a lot of valuable insight. In my case Play2 was a breeze because on Heroku its trivial to set up, and each GET xxx request mapped directly to a xxx scala method in the Controller, so no magic. The others were a little more painful, but not a whole lot. I enjoyed the exercise.


The only trouble with this is that trivial applications tend to only give a superficial feel for the framework and aren't representative of a "real" development experience. For example, I wrote a trivial application in Flask. Python's Flask, while it looks great on the surface and has fantastic documentation, rapidly becomes unwieldy in the face of more complex problems. The same is true for Ruby on Rails.

Most frameworks almost feel like they're tuned to solve these basic problems and give a fantastic first impression that doesn't sustain.

Developing a complete project in each is a better way to move forward IMHO.


Good luck! One of the best books I found for Ruby was The Well Grounded Rubyist by Manning Publications.

Also, s/peaked/piqued ;-)


Just try something. I don't doubt that PHP has its good points, but how can you appreciate them without having something to measure them against?

Ruby or Python would probably be the best choices if you don't have anything else in mind.


I've played around with Python and Ruby (more specifically rails), nothing serious though. I enjoy trying new things, but never found them worth delving into for my purposes. I 100% admit this a reflection on me and not those languages. I have nothing bad to say about them. I just didn't find anything in them that was worth switching.


Unfortunately what many would define as 'better designed' doesn't always translate to useful software.


Can you give an example?


Any major websites done on Lisp, Smalltalk or Haskell?

Besides Viaweb?

Now count > 1m visits per day websites done in PHP.


You're measuring the success of a website in terms of traffic.

The number of hits a website receives isn't the product of the language it's written in, but primarily a function of its marketing (and other factors that appeal to its users).

There are also more websites with their foundations in PHP, so it's reasonable to expect a higher number of successes. You can't therefore logically conclude that the language influences success. It's like comparing the number of millionaires in the US with the number of millionaires in Canada; the US has a bigger population compared to Canada, and all things being more or less equal, it's reasonable to expect that the US would have more millionaires simply because of its shear size.


>You're measuring the success of a website in terms of traffic.

Yes, me and all Analytics and SEO guys. You either sell ads or stuff. In both cases you want as many eyeballs and wallets as possible.

>The number of hits a website receives isn't the product of the language it's written in, but primarily a function of its marketing (and other factors that appeal to its users). There are also more websites with their foundations in PHP, so it's reasonable to expect a higher number of successes.

Yes, but your logic is circular. The question is WHY are there "more websites with foundations in PHP", and not just trivial amateur personal stuff but highly successful ones too.

You seem to assume PHPs expanse as just a fact of life, totally arbitrary, and thats why you say we must not draw conclusions based on it.

>You can't therefore logically conclude that the language influences success.

Sure I can. Here are some ways:

- Php is easy for newstarters, so got more adoption. - Php is trivial to deploy, so got more adoption. - Php was there, targetting the web specifically (with libs and features), in 199x, while Haskell, CL, what have you were not yet. - Php, because of the above, had amassed a huge ecosystem of projects and engines (Nuke, Wordpress, Drupal, EE, etc). - Php, because of that, has alo got huge adoption. - Because of th adoption it built a huge ecosystem of programmers, projects, tools, books, etc.

And, putting it all together, what makes PHP more likely to power most high ranking sites, is that you can easily find components and engines to base your site on, AND you can easily find tons of programmers to employ, AND you can easily find support for it, etc. All those make it a no brainer for a lot of uses.

And all of those are interdependent, based on some initial language attributes, not arbitrary like the US vs Canada population argument (which is not that arbitrary and size based itself, but thats another story)


> You're measuring the success of a website in terms of traffic.

I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity.

The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site is and how well it's marketed. This isn't circular reasoning.

There are more websites written in PHP because PHP is an easy language for beginners and therefore more common compared to Ruby or Python, for example.

It's an absolutely untenable position to assert that the programming language itself affects how much traffic an site receives, which is what you originally defined as "success".


>I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity.

Oh, alright. Thought you meant it was not a good metric.

>The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site is and how well it's marketed. This isn't circular reasoning. There are more websites written in PHP because PHP is an easy language for beginners and therefore more common compared to Ruby or Python, for example.

Yes, that second argument is not circular reasoning because it searches for the causes.

But the argument in your previous post, I read it as: "PHP is used by more of the popular sites because PHP is used by more sites in general" Which is kinda circular, mostly repeating "PHP is popular".

>It's an absolutely untenable position to assert that the programming language itself affects how much traffic an site receives, which is what you originally defined as "success".

I did the opposite: the success of the site affects the programming language.

That is, I am a pragmatist: I see every successful site built with a programming language as one more verification that said language is good for building sites with (whatever the reasons).

If we have 200,000 high volume sites in PHP and 0 in X, as a pragmatist, I will avoid using X in my next high volume site project.

Working from that, one can also see why it is so. For example:

1) it's because X is obscure, so I wouldn't be able to get a team easily. Perhaps even no one in my city, at least without adding the overhead of teaching them X first.

2) it's because X is more expensive to host. I'll need to get a VPS whereas I can just put PHP on a $10/year server.

3) it's because PHP has more libs and stuff. This DB/service API/etc I want to use does not have X drivers (or has a semi-abandoned project).

4) it's because PHP has Drupal/Wordpress and I can have a high traffic portal/news style site in minutes, whereas X has only ho-hum solutions for that, or I would have to build one from scratch.

and so on.

Surprisingly, many so called "scientists" and "engineers" choose to argue from first principles. "X is a bona fide academic language, and has all those meta programming features, higher-order types and such, so you are crazy to use PHP over X for your project".

So, instead of reading the situation pragmatically, and finding the real pain points PHP eases and why it's used, they resort to idealistic rants about how masses are ignorant, "beating the averages", etc etc.

Well, this Zuckerberg guy, with his average PHP, beat Viaweb's Lisp by about 100x better valuation. If, according to "beating the averages", ViaWeb's success was a pro-Lisp point, why isn't that a pro-PHP point? Or does it only work when Lisp wins (as in, "ViaWeb won because of Lisp but Facebook won despite of PHP"). Talk about having it both ways!


> But the argument in your previous post, I read it as: "PHP is used by more of the popular sites because PHP is used by more sites in general" Which is kinda circular, mostly repeating "PHP is popular".

You misread what I wrote in that case. I said "There are also more websites with their foundations in PHP, so it's reasonable to expect a higher number of successes." This isn't circular reasoning, and let me show you why:

Lets pretend I'm superhuman and create 10,100 unique, high quality websites in one day. Let's assume also that my skill and experience remains constant throughout building these 10,100 websites; I'll get no better at marketing, design, etc and all my decisions are of equal quality. The only difference is the programming language I use to develop some of the sites.

For the sake of this example, let's assume that 1% of websites created, on average, end up with one million page views per month after six months.

In this fictitious example, let's say that for grins I build 100 sites in Lisp and 10,000 sites in Perl. 1% of my Lisp sites will be successful (a grand total of one successful site) and 1% of my Perl sites will be successful (100). From this data you're erroneously concluding that Perl is more likely to result in a successful site. This is wrong, because the number of sites created in each language varies wildly, but the odds of hitting "traffic gold" are still 1% with everything else being equal. The language, therefore, doesn't impact success rate.

Seeing something built in PHP doesn't make it a good choice, just a common one, just like smoking in the 1970s was a common choice, just not a good one.

Facebook, while it's mostly written in PHP, is actually transcompiled to C++ (HipHop compiler) because PHP was insufficient. They're not actually running any PHP code in production. Also I keep hearing that their codebase is an unholy mess and that the only reason it hasn't been re-written in another language is that the codebase is just now too big to rewrite. Zuckerberg wrote Facebook in PHP because it was the language he knew, not because it was the best tool for the job. Marketing and user experience made the site successful, not the language.

Don't just look at PHP and say "huh, it's common!" and conclude it's good. It just doesn't make sense and it's a logical error to do so.


Amazon.com was famously put together by mostly Lisp engineers. They more recently switched to C++ and apparently experienced a lot of growing pains as they had to learn how to scale up C++ to match what they had been doing in Lisp for years.


> Any major websites done on Lisp

Does Hacker News count?


Note the use of the word "major"


Note the use of "true" in "no true Scotsman".


Note that I specifically wrote >1m visits per day.

Note also that the mention of one site is too literal and meaningless interpretation of my question, which is more rhetorical, and should be read like: "There are TONS of high volume PHP sites and very very very few high volume Lisp sites".

That said: the "no true Scotsman" logical fallacy is only a fallacy half of the time, like most of those so-called logical fallacies.

They assume a perfectly logical world, where you have infinite information at your disposal and infinite time to check it. E.g I'd rather listen to my doctor on my medical condition over a random guy on the subway, even if that's "appeal to authority".

Similar cracks in the "no true Scotsman" fallacy. There ARE cases where a category/taxonomy is used badly, and no true member of said taxonomy would so something. That is, membership in a taxonomy is not always 100% solid, and you can have true and less true (fuzzy) membership.

E.g

- No KKK member would attend a NWA concert. - But I just saw a KKK member rocking it at a NWA concert. - Well, no _TRUE KKK member_ would ever attend one.

It's obvious that the first guy is correct: no TRUE KKK would ever attend a NWA concert.

Now, a random KKK member could possibly attend one (say, out of curiosity). The "no TRUE" argument in this case, says not so much the impossibility of an event happening, but that it is against the very concept of the taxonomy under discussion for it to happen.

Hackers shouldn't touch the "logical fallacy" stuff with a ten foot pole. They presuppose that conversations and argumentation can just go "by numbers", without examining each individual case.


Haskell


Way to talk down to people.

I use PHP as my main language for web development, but also am a frequent C user. I have done projects in C# and Python.

While I like C# and Python - actually for scripting I tend to go for Python rather than PHP, prefer the CLI modules of Python- , I found that in context of web dev PHP still get the job done faster and in a maintainable manner. As for C, I use it for writing PHP extension -or generally fucking around with PHP source code- and writing non web stuff, so not as relevant.

The difference between people like me and people like you, is I don't go around constantly mocking other language. It is pointless, I'd rather spend my time and energy delivering products, or actually doing something productive.


I'm not talking down to anybody.

Based on experience I asserted that many programmers feel that PHP is an inferior language because they've experienced "cleaner" languages such as Ruby. It's not wholly unreasonable that chez17 had only programmed using PHP, as PHP is commonly a programmer's first language. I therefore wanted to find out if chez17 had used other languages and to see what their thoughts are on PHP vs those other languages.

I also don't go around "constantly mocking" other languages. Why did you make that assumption?


Good, just the way it read.

As for constantly mocking other languages, that was not directly pointed at you, but at the constant swarm of people always going about php sucks, php this, php that... We got it, you people don't like PHP, try to see if I care.


Why shouldn't engineers "mock" the things that they think are badly designed? But by "mock" I mean criticize. In fact, as an engineer, it's one's professional duty to criticize bad design, as good design is essential to the endeavor of engineering progress.

Good engineering design vs bad engineering design is what prevents bridges from collapsing or Mars landers from crashing.

But I hear you: sure it's quite possible to do arithmetic using Roman numerals, and if that's what you're used to, you probably don't want to hear that you've been doing it suboptimally. And all these people clamoring for a change to decimal are just an unbearable nuisance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: