
I haven’t given up on PHP — yet - nreece
http://phpadvent.org/2008/yet-by-marco-tabini
======
eisokant
PHP definitely has its flaws and lack of conventions but for me that is what
makes it beautiful. It's a language which has allowed me to grow as a
developer over the years. If I look back at how I structured and wrote my code
when I first started it's nothing close to how I code now. Since PHP allows so
many different variations I didnt have to conform to one style but instead
developed my own. If I would have chosen a different language to start with I
am quite sure I would have given up on programming quickly. PHP has allowed me
to learn from my own mistakes and create my own unique way of solving
problems.

Besides how I feel about it; it's been great for all the projects I've worked
on and now for the first time I'm using a framework (Codeigniter) for my
startup and it's proving to be even more solid and progressing my style even
more.

I believe PHP code is as good as its developer. Like mentioned in the article;
you can paint a mess or a masterwork, all the colours and brushes are there.

~~~
KrisJordan
10 years ago I wrote my first web application. I was hooked. The ability able
to write an app that ran anywhere in the world was magical. My journey since
has led me to PHP4 and the LAMP stack, away to C++ and Java and back to PHP5,
away to C#, Scheme, and Python, and again back to PHP5.

The truth is I have a love-hate relationship with PHP. The linguist in me
abhors PHP sprawl and the pragmatist in me adores PHP’s simple execution model
and practical ubiquity.

Upon returning to PHP this September it felt both familiar and unsettling. The
feeling of returning to the town you grew up in. Frameworks, like familiar
faces, looked the same as when you last saw them just heavier and a bit more
mature. Nowhere as spectacular as the framework heroes of other towns like of
Pythonville or Rubyfordton. City council was still making unorthodox decisions
like enforcing backslashes for namespaces. Yet downtown was booming- many of
the greatest internet successes of the world had since established themselves
here: Facebook, Flickr, Yahoo!, and others.

So I set out to create an open source framework called "Recess!" which will be
available on GitHub in preview form "any day now".

I just recorded its first screencast that dives into how it Recess! handles
routing. Interested to hear your thoughts:

[http://www.recessframework.com/screencasts/routing/index.htm...](http://www.recessframework.com/screencasts/routing/index.html)

(disclaimer: the flash video may be slow to load - until which you'll see an
empty black page)

~~~
k4st
Controller route prefixing seems suspicious. Do you include every controller
at runtime and use php reflection with some regular expressions to parse all
of their prefixes only to figure out what single route to use?

~~~
KrisJordan
In development mode, yes. We look at every controller and form a routing tree.

In deployment mode that routing tree is serialized and cached. Only a single
(matching) controller is then touched. Unserializing the data structure is
extremely fast and finding a match is roughly an O(log n) operation.

------
raamdev
I started programming when I was 12 and sadly my path to PHP looked something
like this:

    
    
      QBasic -> Visual Basic -> HTML/CSS -> PHP
    

With what I know now (various bits of Java, C, bash, Python, OOP, etc), I wish
so much that my path to PHP looked more like this:

    
    
      C -> Bash -> Java -> HTML/CSS -> PHP
    

Everyone who uses PHP professionally knows that it's extremely easy to write
crappy PHP code. While PHP is easy for beginners to learn, it's equally as
easy for them learn bad programming habits.

After 15 years, I'm finally putting in the time to learn the language I should
have started with: C. I really wish it was the first language I learned
because it would have made learning other languages so much easier (and
learning those other languages would have made me a much better PHP
programming when I started using it).

I believe every language has its uses and PHP is no different. While its a
shame there is so much crappy PHP code out there, open-source projects like
WordPress have shown it has its place. (If WordPress themes and plugins were
not so easy for non-programmers to learn how to create and modify, I don't
think WordPress would be where it is today.)

~~~
dshah
My evolution is like this:

Pascal (object oriented) -> C++ -> C# - > PHP

Despite a reasonably strong background in developoing software, I've found it
way too easy to build crappy code in PHP. But, I think it's as much me as it
is PHP.

Perhaps PHP brings out the evil that is lurking inside of us as programmers?

~~~
raamdev
Or perhaps humans are lazy by nature and, since PHP does a very bad job of
keeping us in line, the less disciplined of us end up writing bad PHP code. Of
course, if we don't know how to write good code to start with, it's not PHP's
fault. I think the simple fact that you _can_ write good, elegant PHP code
goes to show that it simply demands a more disciplined programmer (or a
framework to help with that discipline).

------
old-gregg
I apologize for an off-topic, but this question has been itching for a while
and I just couldn't resist:

"... did so specifically to solve _his or her_ immediate problem in a manner
that catered to _his or her_ unique needs ..."

I understand that speaking/writing like that you come across as a super-
cultured, modern liberal or whatever, but am I the only one who finds this
bastardization of English awkward? I've learned this language about 8 years
ago at the age of 23 (relatively recently) and even then it wasn't so crippled
by such idioms, and to this day every time I stumble upon a sentence like
that, it pings my ear, kinda like seeing "chickenfucker" in the middle of
Declaration of Independence, totally out of place, out of context.

Does anyone else feels this way?

~~~
fizx
Kind of like "cease and desist"? Doesn't cease have the same meaning as
desist?

I read that the legal doublespeak comes from English roots. When the Anglos
and Saxons had to start getting along, their lawyers had to use a word from
both languages. Big [citation needed] here, so I hope someone obliges. I'd
love to know the truth.

But back to "his or her." I often use simply "her," to be both consise and
politically correct. ;)

~~~
old-gregg
After some googling I found something:
<http://plover.net/~bonds/genderedlanguage.html>

"... The problem is that in the English language, the "traditional" gender-
neutral form -- "his" -- happens to be the same as the masculine form. And to
say or imply that an arbitrary or unknown person must be male, as those who
use "his" are claimed to do, is discriminatory... "

------
swombat
_As an insider, it’s actually funny to see endless discussions on newsgroups
or the latest PHP-bashing entry on the Slashdot-of-the-day web site where
people who aren’t familiar with our platform disdain its ludicrous awkwardness
while marveling at its popularity._

I'm very familiar with PHP. I built my first start-up on it, and it was a
costly mistake. I know PHP very well and loathe it for many good reasons.

I think the author should try giving up on PHP now. He may well find that the
world seems like a better place after that step.

~~~
es
Could you name reasons why it was a costly mistake for you? Were there scaling
problems or issues with maintaining existing code? I'm not trying to protect
php, just curious.

~~~
swombat
PHP's main flaw from my point of view is its ugliness. It's almost impossible
to distinguish bad code from good code. All of it looks equally bad (well,
some of it looks even worse).

The downside of that is that you don't get the automatic "bad feeling" when
you put in a hack. It just doesn't stand out like a sore thumb (like it would
in Ruby), so it's very easy to ignore the hack. Since PHP is an extremely
hack-friendly language, where it is very easy to take damaging shortcuts, and
it lacks the feedback mechanism to make you aware of when you've taken a bad
shortcut, every large PHP project seems to eventually end up the same: a
monstrous pile of hacks, one uglier than the other.

I don't have that problem with Ruby at all, for the record. Ruby is very hack-
friendly too (even more so than PHP), but because of its natural elegance,
whenever you do something plain bad it is immediately visible and remains so
until you clean after yourself.

I could talk about all the cruft in the global namespace, the lack of
consistency in the API, the appalling OO implementation, the lack of a super-
successful framework like Rails... but ultimately, what bothers me is the
result of all those problems: ugly code that keeps getting uglier.

Why did ugly code bother me with my first start-up? Because it is hard to care
for ugly code. Once your beautiful start-up's code turns into a pile of
spaghetti, you start to wish you were doing something else. And that's a
pretty bad place to be when you are the sole maintainer of your start-up's
code. It won't stop you from ploughing on - but it will slow you down a lot,
and you don't need that when you're a start-up.

------
wenbert
PHP is a tool. Just like all other programming languages. If PHP can be used
to solve your real-world problems then okay - Go for it. It's free, easy to
use, the documentation is the best there is And lots of frameworks to choose
from. If not, then use something else. But for me, after a few years of coding
PHP, I haven't had anything that PHP can't do for me (in terms of web
development). Especially these days that Code Igniter, Zend Framework and the
likes are going more mainstream...

EDIT: just wanted to add that I have been wanting to use Tools like Ruby on
Rails, but when I think of it -- it is so much easier to do this and that in
PHP.

i have read books on RoR, etc. but haven't find the time to implement on a
real-world project yet. maybe it's just me or that i'm too lazy :D

------
scorxn
Summary: PHP is cluttered, people like to bitch about it but use it anyway,
sometimes frameworks are good. The 'yet' is merely a weak thread through the
vague, obvious noise. I want my 10 minutes back.

------
KevBurnsJr
<http://www.symfony-project.org/>

------
trezor
_If there were a product statement for PHP, it’d probably be something like
"only a drunken Martian could come up with this."_

I know I'm pretty much stating the obvious, but this is the problem that will
keep PHP cemented in its current state for years and years.

Like everyone knows, and like stated in the post, PHP is riddled with
inconsistent naming-convetions for functions, inconsistent parameter-order and
inconsistent functional behaviour. Let's also not forget how 99% of the
functions in PHP are "binary safe", like treating text like binary data is a
good thing. There is code out there working on binary data and relying on
_string-operations_ to work properly.

Let us for a second assume the PHP developers are actually capable of making
good and thought trough decisions and just ignore that whole backslashed
namespaces incident.

If the PHP developers were to address the inconsistencies of the language and
actually _standardize_ on something, even with some decent refactoring-tools,
this would still be a rather big undertaking and would no doubt lead to _more_
bugs in the core framework until all the itches get sorted out.

And for what? PHP is well known for causing applications to break between
releases, but intentionally breaking and crippling _all_ PHP code in
existence? They might as well give it a new name and release it as something
different than PHP all together.

But why would anyone actually bother to do that? Does PHP as a language have
_any_ qualities not found in other languages? Does PHP, besides existing
codebase which in this case would be a moot point, offer anything which isn't
already offered everywhere else?

For PHP to solve its problems they would have to abandon the only thing which
support it as a platform. I postulate that PHP, in its current shaky state, is
the way PHP will remain for as long as it is considered relevant.

~~~
thomasmallen
_Does PHP as a language have any qualities not found in other languages?_

Yep.

1\. Everything's a template. This is a double-edged sword.

2\. mod_php is stupid simple. Makes deployment is a cinch.

I'll update this list if I think of others, but these two are a boon for new
and impatient developers alike.

~~~
trezor
_1\. Everything's a template._

Hardly unique. Microsoft's (now deprecated) ASP had this. ASP.Net can also be
treated like this if this is desired, although most of the time it isn't.

 _2\. mod_php is stupid simple. Makes deployment is a cinch._

As I have mentioned in another reply, the easy of deploying PHP solutions is
hardly unique. Out of my mind I can think of perl, python, asp and asp.net
which offers similar ease.

In fact it can be argued that PHP's problematic compatibility betweens,
dependency on server-settings and other similar less predictable parameters
when deploying on a random hosting service makes PHP deployments more
problematic than those mentioned above.

My experience with Asp.net would lead me to believe that Asp.net deployments
are just as easy and can be done much more reliably without encountering
deployment issues.

~~~
ssharp
You're forgetting the popularity of cheap shared hosting plans. PHP is offered
on many hosting plans for $10 or less dollars a month and "just works" in that
you upload a PHP file and it works with zero extra configuration. Most cheap
hosts don't offer this low barrier to entry with Python, ASP, ASP.NET, RoR,
etc.

~~~
trezor
I'm fully aware of this, but that can hardly be accounted for as a feature of
the _language_ itself, which was what I was asking about.

