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

So the comparison is between starting from absolute scratch with Lisp -- having to choose a framework, get a dev environment set up, choosing your libraries etc vs an experienced PHP person just using PHP?

This article could easily be turned around to something like "use emacs, lisp and the trusted framework you already know, or try to learn PHP with its inconsistent naming and verbose syntax and ..."

Essentially he's judging languages by "wall-clock time", but only including time-to-learn in one of them.



He's not making that argument!

From the article: "You can learn PHP in a day or two if you're familiar with any other language. You can write PHP code in any editor or environment you want. Emacs? Vim? Notepad? nano? Who cares? Whatever floats your boat. Being a stupid language also means that everyone knows it. "

The author didn't spend a lot of time talking about learning PHP because there's not much to learn. There's nothing surprising in the components in the PHP stack. If you know HTML, adding PHP has low overhead. DB reads and writes are simple. If you can program in another language, you know all of the logic statements you need to write an application. If you need an example, there are probably tens of thousands of bad PHP tutorials online with bad sample code that still manages to work.

I've learned PHP and Common Lisp from scratch at different points in my life, and PHP had a much lower barrier to entry. I installed and configured PHP on my local machine and made a stats-tracking webpage all on the same day. This was my first server-side web application ever, plus my first database program ever.

Fast forward 4 years, and I worked through "ANSI Common Lisp" for a month before I felt comfortable writing regular applications in Lisp. Then I installed Hunchentoot and stumbled around for a while, but was able to figure out how to generate static content. Most of the Hunchentoot tutorials online were for older versions, but I found one that proved invaluable. I then ended up patching S-XML, because it was only written to support 5 or 6 of the 250+ "&" style HTML character codes. I sent that patch to the mailing list, but I bet nobody ever got it. I tried to hook up a database, and found Postmodern, which was nice. Thank God I already knew Emacs, but I wasted more than a day fighting with upgrading SLIME and SBCL at the same time.

The Common Lisp path doesn't sound so bad, but compare it to my PHP experience - I wrote an application on the same day I first looked at PHP. By the time I was integrating Database code, I was well over a month into learning Common Lisp.


Please don't say familiarity with "any other language" prepares you for PHP. Not every language teaches you that when you get an error with a line number, you need to look at previous lines for a missing semicolon. Not every language teaches you that = is not for comparison. Not every language teaches you the difference between && and &. Having seen PHP newbies struggle with issues like this, I am confident that the list of languages where prior experience makes PHP "easy" is short and specific.


As someone with a lot of experience with teaching new people PHP, you're missing something. The other language portion generally refers to another programming language. Most people with those problems suffer from not knowing another programming language, or fundamentals in programming.

People with the problems you mentioned are one of two types of people:

1. No prior programming experience. 2. Do not understand fundamentals of programming.

These are the people that use $var1, $var2, and $var3 instead of arrays.

Beyond that, if you can't be bother to learn the difference between =, ==, and === in PHP, you aren't bothering to learn, and have no reason to complain.


I totally meant programming languages. C syntax and conventions are not "fundamentals of programming"; they're C syntax and conventions. We agree that effort is required to learn them. That's my point. It's easy iff you know something similar already.


OK, basically the argument boils down to "if you have to write a webapp and don't know how to program in Lisp or PHP, you'd be better choosing PHP".

It's very close to trite. Yes, PHP is easier to learn. But if you're already proficient with Lisp, would you still be faster learning PHP? And if you are not up to speed with lisp, why the hell would you even be considering it for a time-sensitive quick-n-dirty job?

The question he set out with was "why is PHP more popular"? His answer is "because it's easier to learn and more popular".


Well, it's more than trite, because a lot of very smart people run off distracted by shiny things like Lisp. I remember writing Scheme in Scheme in under 500 lines in college! It was so elegant!

I still have a Clojure book on my shelf, read almost the whole thing, got emacs off the ground with SLIME a few times, and haven't actually solved a business problem with it. I have existing code bases in Python and Java, and I can create way bigger wins by fixing the obviously wrong things with them than by bolting on some component in Clojure and creating a new area of "nobody knows what happens here".

Mayyyyyybe if you have specific needs then a lisp is a good idea -- if you're in a green field situation, have sufficiently complex application logic to justify an unusual web setup (this is much more rare than people think), and either know what you're doing with lisp and/or have a long timeline to figure out what you're doing. But it's pretty uncommon, and as awesome and elegant as LISP is, it's refreshing to see someone writing from everyday experience rather than "this is cool!" once in a while.


Learning bad PHP may be easy. But from my exposure to PHP I find learning to write good PHP code to be fairly hard. Because you have to work around all the limitations of the language.

Common Lisp may not be a paragon of elegance, but it's not nearly as awful as PHP. And Common Lisp is a fairly conventional, mostly imperative language. Nothing as scary as Haskell or Prolog, or even Scheme.


It's not an argument over which language helps a programmer produce better code. It's an argument over which language helps a programmer generate an almost-correct solution faster.

It's the same as Worse Is Better: http://www.dreamsongs.com/WorseIsBetter.html


Yes. I buy your argument, if you say "small-scale good-enough solution".


To be clear, it's not my argument. I'm just trying to clarify what argument the author is making.


Understood.


Well, that's the problem, it's possible to be somewhat productive in PHP, even as a bad programmer. Sure, such people code notorious SQL injection flaws, but... well, I can't think of a but.


Isn't the problem with Common Lisp that you have to start with a lot less?

I've dabbled with Common Lisp for webdevelopment and I failed, miserably. I tried various the Mandriva package manager, downloading latest releases from the web, automatically and manually. It was already hard to get a bunch of packages together that where stable, somewhat current and compatible so I eventually quit.

If someone in the Common Lisp community could put together a web stack to get started it would help people like me tremendously. Lisps superiority is no point of discussion for me.


> use emacs, lisp and the trusted framework you already know

It took me 2 years to finally get comfortable with Emacs to the point I trust doing stuff in it, and I still don't know what I'm going to do if I ever start working in a language that doesn't have an editing mode available (it's not Textmate where you can define a syntax file in an hour).

For a whole month I studied Clojure, trying to wrap my head around it. I still have problems.

And now if I'd want to do stuff in Clojure, all web frameworks available suck for me (no, I don't like Compojure) ... which would mean I'd have to write my own ... or use Django, Rails 3, or even asp.net mvc 2 (even that is preferable).

Of course, being the yak-shaver that I am, I'll probably attempt to write a web-framework for Clojure of my own, but not when the clock is ticking.

On PHP ... doing PHP programming / copying popular websites was my first job. It took me exactly 1 week for going from a complete zero to someone that could get the job done.

I don't love PHP as there are truly better options out there, but libraries/frameworks are more important than languages. If Java frameworks would've been designed with an eye towards their users and not to please managers, it would've crushed all other high-level languages by now (and it did in many ways).


Why not just write servlets in Clojure?


Because I just don't need dumb request dispatch.

There are a couple of things a web-developer needs ... data-models, with validations, form/request handling with validations (forms that render themselves are a plus), authentication/authorization (OpenID/Facebook/whatever support should be available of course), CRUD generating (I don't want to work on stupid admin interfaces that show tables of existing items more than 10 minutes), session handling, caching support backed in, a nice templating language that doesn't suck ... and a (lazy) ORM querying language would be nice (bonus points if it has integration with NoSQL databases). And all of them nicely integrated of course, as I don't want to lose time trying to figure out how to blend them in.

That's not much to ask, and these are problems devs have struggled with in the last 10 years ... it is unacceptable to work just with servlets.


Clojure has solutions for many of things your are talking about. If you don't want go looking for them, fine. All you're illustrating here is your ignorance of the "other side" and your unwillingness to find out.

Clojure doesn't suffer for capability or libraries. It has that in spades and then some. The main thing missing is a site that documents how to use these pieces in concert to accomplish common web programming tasks.


Clojure (or any functional language) doesn't have a tiny fraction of the libraries/frameworks/documentation that PHP does. Design a language that only the top 25% of the programmers in the world are smart enough to use and you'll get 2% of the infrastructure blub languages have.

The challenge is to prove that those smart programmers working in that smart language are still more productive than the average programmers that started with the problem 75% solved out of the gate. For basically solved problems like CRUD webapps you won't be able to do this. For harder problems like scheduling air travel you might but then you're working in a problem domain too difficult for at least 3/4 of the working programmers today so you're in an even smaller niche.


"Clojure (or any functional language) doesn't have a tiny fraction of the libraries/frameworks/documentation that PHP does."

PHP is pretty bad when it comes to reusable libraries. PEAR is a pretty unusable mess, the Zend "framework" is a bit better, but still not that all-encompassing. Core PHP is a huge hodgepodge of very bare wrappers around C libraries, without a decent module system or OO layer.

The documentation is often centered around newbie questions and most frameworks really reinvent the wheel -- and quite often Ruby on Rails (which is pretty painful considering the PHP execution model).

I'd rate the library repositories of Perl, Ruby and Python above that, and even with some paradigm mismatch, Clojure's access to Java libraries is at least on par with PHP (PHP/C vs. Clojure/Java).


I've avoided PHP like the plague so I'll take your word for it. I'd consider using it for a couple of quick & dirty simple pages but for anything more complex I'd definitely use Rails (or Django etc).

As another poster noted, Clojure gives you access to the Java libraries, which is a huge, huge win for Clojure vs most other functional languages but gluing that stuff together is still going to be more work than it's worth if you're not doing something really unusual with your site.

The functional web stack that looks the most promising to me at the moment is the Play framework with Scala. It seems a lot simpler and more manageable than Lift and Scala drops in pretty nicely in place of Java. From what I can tell there are still a lot of rough edges but I think it's a combination worth keeping an eye on.


    Clojure (or any functional language) doesn't have a tiny
    fraction of the libraries/frameworks/documentation that
    PHP does. 
Well, you get all those Java libraries out there for free ('free' as in automatically, not necessarily 'free' as in without paying)


> The main thing missing is a site that documents how to use these pieces in concert to accomplish common web programming tasks.

You know, not to get dragged into a stupid language debate, but for any language, a proposed solution without documentation is not a solution.


what is the app you're trying to build?


I do consulting mostly ... I'm building many apps for business that want to optimize workflows, but I'm also doing crazy shit ... like in a cinema room I built software for scheduling/synchronizing movies on digital and analog projectors (also in tandem with lights and sound).

Clojure I'm evaluating for my own project.


Yeah, he's essentially saying PHP is familiar and popular because it's familiar and popular.




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

Search: