
When PHP Actually Is Your First Programming Language - reid
http://reidburke.com/2008/10/05/when-php-is-your-first-language/
======
IsaacSchlueter
This is dead on: "Whatever you choose to learn as your first language, the key
is to learn from great code."

It's also worthwhile to learn a lot of other languages. Do it as soon as
possible in your career, especially Lisp and C. No matter what language you
may use, you'll probably benefit from knowing these two. The danger with any
"first language" is that you may never learn a second.

~~~
lpgauth
Why Lisp? Wouldn't any functional language do the same? I'm not flaming here,
just wondering... I learned SML which was OK, but it didn't change my world. I
still like writing code in Ruby better.

~~~
IsaacSchlueter
In short, no. ESR had it right. "That experience will make you a better
programmer for the rest of your days, even if you never actually use LISP
itself a lot."

My primary bread-and-butter language is Javascript. When done "right",
Javascript is a very expressive functional/prototypal object oriented language
with a lot of very interesting features. If you can do it in lisp, you can do
it in Javascript: <http://foohack.com/tests/ycomb.html>

I've seen in myself and in coworkers, the best Javascripters know at least a
little lisp, and as their lisp skills increase, so do their javascript skills.
I suspect it would have the same effect on Ruby or SML or Erlang programmers.

Their attitude towards boilerplate code tends to change as well, and they
begin seek solutions that are as concise and expressive as possible.

Lisp is unique because it effectively has no syntax. You write the abstract
syntax tree directly. By removing the scaffolding, Lisp exposes the programmer
to the fundamental nature of any programming language in a way that no other
programming language does.

That's why C and Lisp are the best languages to learn, as early as possible:
if you know these two pretty well, you're in a good position to master any
language you might come across.

Misc is a promising cousin of Lisp: <http://will.thimbleby.net/misc/> I've
played with it a little, but not enough to really have a strong opinion of it.

------
jlujan
It is still shooting yourself in the foot. There are a lot of questionable
design decisions that will take a while to unlearn when PHP is your first
language. The OO model is still a little screwed up, and uglier than C++ even,
because of lack of namespace. There are arguments for and against it, I wont
get religious. But if you want to be a "programmer" then you must move quickly
from PHP. If you want to only be a web developer... fine. PHP is a baby step,
even if you stick to dynamic languages.

------
ryan-allen
My first was PHP, I was able to get useful things off the ground, mostly by
trial and error, from what was initially very simple examples.

PHP's strength is it's so damn easy to write useful, simple scripts. And it's
so fast to provide feedback, and it works with an existing metaphor many
people understand (upload file to FTP, hit it in your web browser, bob's your
uncle).

I found it very, very difficult to learn OO as the stdlib at the time was full
of nothing but functions. I think you learn a hell of a lot from working with
well designed APIs, and let us be brutally honest, PHP's stdlib is about as
well designed as a shit-moulded santa claus.

I tried learning Java well enough to get some kind of commercial project off
the ground but was befuddled, book after book why it took so damn much code to
do _anything_. Though I did learn a lot about OO from reading these books, I
never got an opportunity to get stuck into any Java to learn how to do things,
at the time I perceived as the 'right way'.

But unlike PHP to get anything off the ground in Java, you had to install
Tomcat, write about 20 lines of something and set up a web container and god
knows what else. Compare this to plonking <?= $_GET['test'] ?> in a text file,
call it 'blah.php' and hit it. Instant feedback.

Since then I've been working with Ruby for about 3 years, and I've finally got
my head around how to write decent code, and it's mostly been because of
exposure and experience with nice APIs, and being able to work with the higher
level patterns that you are just simply not exposed to with rudimentary PHP.

Sure, today you have CakePHP, the Zend Framework but they only popped up in
the last couple of years, and mostly in response to Rails' influence.

In between Rails and PHP I had toted with Perl and Python and enjoyed them
thoroughly. I would suggest writing as much damn code as you can in a bunch of
popular, and different languages, and you'll be fine :) I'm still yet to play
with LISP and OCaml, though I'm keen to have a crack at Lua...

~~~
jamongkad
I've often wondered if the PHP community in general is more reactive than
enterprising. Had it not been for Rails would we see the crop of well
engineered PHP frameworks? (when I say well engineered I mean these frameworks
work hard to put lipstick on a pig sort of way).

------
dryicerx
Yup, One thing to add is PHP is good language to start out if you want to be a
PHP Programmer / Web Developer and no plans to move over to something else.

But if you want to be a generic programmer or get in to the field, it will
save a lot of time and hassle if you start out with C/C++/Java. Those cover
all the major concepts to begin with, and switching to PHP or any similar
language would be very quick if not instantaneous.

Then again, I think it's even a better idea to start with something fun and
something you really and feel like you are getting rather than jumping to
something really complicated.

There is no one-size-fits-all language to start with, it depends from person
to person.

~~~
unalone
Could you think of any big flaws with starting out with PHP? Problems you'd
want to avoid?

I don't care much for programming: I'm much more interested in design. As
such, I really don't think I'll need to learn anything beyond PHP and
Javascript. Are there things that I, and people like me, will run into because
we don't know any better from other languages?

~~~
emmett
The main problem is the popularity of PHP. There are some great PHP developers
out there, but because of the popularity many of them are not good. And you
learn how to code from the people around you.

The other problem is that both Javascript and PHP encourage implicit casts,
which are great but lead to subtle issues you probably won't understand unless
you learn a stricter language.

~~~
ars
>The main problem is the popularity of PHP.

Yup. All those people saying it's bad - there is only one problem with it -
it's too easy, and too many people use it.

Rather than repeat myself: <http://news.ycombinator.com/item?id=324895>

------
sunkencity
PHP is no different from any other scripting language in that it's a language
tailored to get things done, and done quick. If you do something quick with
ruby, perl, python you can make it as crappy and sloppy as you can with php.

The problem though is that almost every thing written in PHP looks like shit.
So PHP programmers trying to learn a good writing style by looking at PHPbb or
similar are shooting themselves in the foot. Aha! I could put PHP code in the
database and run it by 'eval' - smart idea! Must be really secure templating /
programming design since this is such a big project... And what's up with
wordpress, a more programmer hostile templating engine is hard to find still
people use it.

------
ashleyw
Each task has a language or two which will fit the task the best, but don't
get hung up in the finer details like which language you should use. Use which
ever language feels right, and invest your time into the application itself.

(just don't use BASIC)

------
ars
"it was horrible. Procedural, PHP inline with HTML, calls directly to mysql
library functions"

There is NOTHING wrong with any of that! Making something more complicated
does not make it better.

PS: I use a very strong templating library personally. It's called PHP.

~~~
reid
Good point. I was trying to convey that, taken all together, the code was an
unmaintainable mess of spaghetti. It was difficult to read and it was
difficult to change.

When done right, all of those things have a place. My point is usually (with
PHP at least) it's not done right.

------
begemot
My first programming language was mircScript, and I turned out okay.

------
kajecounterhack
Thing to note: Facebook is written in PHP.

I laugh so hard.

~~~
arockwell
So is Wikipedia, Yahoo and countless other sites. What's your point?

