

PHP and the Lean Startup - suhastech
http://blog.mayflower.de/archives/819-24.12.-PHP-and-the-Lean-Startup.html

======
AlexMuir
I've just moved from years of PHP to RoR. And there's a lot that I miss about
PHP. Deploying Rails Apps is still a motherfucking nightmare - I hanker for
the days of just git pulling and changing a couple of config vars. I can
google any error message in PHP and find dozens of answers - not so with
Rails, where I end up really have to scrabble around for a solution.

But there's also a lot to love about RoR. I just needed to calculate the
number of business days between two dates - step forward the business_time
gem. Five mins later and I've got a stable, tested solution.

I've built and sold businesses on PHP, I run some sites on it still. But I've
never got into testing with PHP, it just isn't seamless. And because of that,
I've always hated going back into the code and improving things later -
projects have tended to stagnate. With RoR you have to make an effort NOT to
write tests, and making minor tweaks isn't like moonwalking across a
minefield.

If you just want to whack up a prototype right fucking now then PHP and a
Framework are for you. But if you think that you're working on something more
than a punt then either put in the effort to write decent tests in PHP, or use
a framework that will force you to do so.

In summary - PHP and Yii Framework do _almost_ all of what Rails do. It's
fast, stable, clean and easily deployed. But the weight of the developer
community is now behind Rails. And Ruby is a neat language that I enjoy
working with.

------
tensor
The key point of the article seems to be embodied in this quote:

 _So we PHP people are good at failing early, fast and cheap. If you want
enterprise grade fail, ask the java guys, if you want scalable fail, ask the c
guys. If you want smart fail, ask the clojure guys. But early and cheap, ask
us._

The claim here is that one can get to a working product using PHP
substantially faster than with other languages. However, the article has no
data to back this claim up. Indeed, one of the big goals of newer languages
like Clojure, Python, and Ruby (the latter two not being explicitly mentioned)
is to write code faster and with fewer errors. Java, while verbose, also has
strengths: a great many excellent frameworks and libraries. This is also true
for web development (e.g. <http://www.playframework.org/>). Including C in the
argument is a little strange. As far as I've seen, it's one of the least used
languages for deploying web applications these days!

In summary, I am wholly unconvinced by the claim of this article. And I say
claim as it's missing any substantial argument. Does anyone have any actual
data here? There are certainly many case studies for the newer languages and
frameworks if you dig a bit. It's an interesting topic.

------
Domenic_S
People bag on PHP a lot (was a truer sentence ever written?). But the fact is
that it's fast to prototype with, it has a number of mature frameworks
available, and time-to-productivity is quick. That's what business people want
-- quick and cheap.

With proper engineering, PHP can be quick, cheap, AND good (see: Facebook. You
want to argue the point, fine, but I don't see you becoming a billionaire on
the back of your Haskell application).

Like every language, there is an appropriate place for it -- I would probably
not write code for the Space Shuttle or a medical device in PHP. But, a great
place for a language like PHP is web applications, especially for businesses
who have to consider things like hiring people.

~~~
fragsworth
> With proper engineering, PHP can be quick, cheap, AND good

This is true for any language. It is also true for any language that poor
engineering can make things really bad. PHP is in a unique position, though -
it is so easily accessible to non-engineers that they begin writing
applications without the slightest idea what they're getting themselves into.

This results in lots of improper engineering, and people blaming the
_language_ for the world's problems.

Javascript and Actionscript have this problem too. They get a lot less flack,
though, because I think client-side scripting isn't held to the same
standards.

~~~
jayferd
I don't know about ActionScript, but javascript is actually a pretty beautiful
language. It's basically scheme with Java syntax.

Also, we're stuck with JS for the time being. PHP is easy to ditch by
comparison.

~~~
silentOpen
No TCO makes it very much not scheme or lisp or anything fp.

~~~
viscanti
Having lambda expressions, closures, and being able to construct higher-order
functions makes it pretty "functional" in my book. Having to be careful about
recursion is a negative, and TCO would be a welcome addition.

It's really a hybrid language. You can do a lot functional stuff with it if
you'd like. You can also do a lot of the OO thing with it. Neither is perfect,
but if you stick to the "good parts", it's a strong language.

~~~
silentOpen
Lambda expressions implies currying because lambdas take only a single
argument unless you think of function application as implicitly constructing a
tuple of arguments (but JS lacks tuples and only offers maps and arrays).
Javascript has first-class anonymous functions, not lambdas.

Closures in JS are broken due to everything being a reference cell by default.
This causes closures to be annoying to construct correctly and more expensive
than they should be. "Functional" languages typically treat mutation as a
side-effect and require reference cells to be explicitly declared. This helps
enforce function purity and referential transparency -- functional-ness.

"Being careful about recursion" is like being careful about looping except
recursive expressions are a superset of succinct iterative expressions making
Javascript weak when it comes to, say, describing state machines. Lack of TCO
makes Javascript a terrible compile target as CPS is impossible.

Javascript is an ambiguous, unsafe, difficult-to-analyze language. It supports
some constructs that look like constructs in functional languages but because
it does not enforce any functional or type systemic restrictions, these
features are mostly cargo.

If you write a recursive algorithm in Javascript, you pay like O(n) for stack
frames. The same iterative algorithm costs O(1) for stack frames. Thus, many
developers eschew recursion in favor of iteration. This means that the logical
code that developers write _could_ be both mathematically sound and run
efficiently on the machine but instead developers must either resort to
temporal reasoning or perform recursion -> iteration transforms in their
heads. This is broken.

Just because Javascript is ubiquitous doesn't mean it's good. I don't
understand Javascript evangelists -- they seem to be spreading half-truths.

~~~
viscanti
I'm not a Javascript evangelist. I'm the first to admit that it has flaws.
Some (like recursion) are fundamentally broken and a trap to unknowing
programmers. I think you'd be hard pressed to find anyone with any real
javascript experience who says the entire language is perfect.

There are good parts though, and if you stick with them, it's not bad. In
fact, it can be a pleasant experience to work with. Just because it's
ubiquitous doesn't mean it's all bad.

------
ricardobeat
Blah blah blah PHP blah blah startup blah blah blah blah lean blah pivot blah
blah we're special blah blah.

I don't see how the unstructured development of the past has anything to do
with using PHP in startups today. It's not about the language capabilities
(90% of business aren't doing anything special in code), but developer speed
and happiness. If you're happy with PHP then so be it, but that doesn't make
it better.

~~~
dguaraglia
Exactly.

The part that bugs me the most about the post is when it says "that's what we
PHP guys do well: fail fast, fail cheap". Basically what he is stating is:

1) PHP developers are going to hit a wall earlier than other developers 2) PHP
developers are cheap in general. How is that a positive statement, I don't
know.

There's this stupid belief that by paying less for someone who does "a quick
job" you can test a feature and then "build from there". It's bullshit.

From my own experience, I've regretted time and again hiring a cowboy (the
fact that he was a PHP dev is not unrelated) developer just because we needed
something "quick". What was supposed to be a 10-day deliverable turned into a
4-month mess of a codebase that I couldn't wait to rewrite. We ended up being
hostage to our own code.

------
todd3834
It feels like the longer you develop web applications the less it matters what
language you use. I highly recommend experimenting with as many languages as
you can because each one has something unique to offer. You are often able to
take lessons you learned using one language while using another.

This seems to go a long way with frameworks as well.

------
fasteddie31003
PHP's biggest strength is also it's greatest weakness: flexibility. For a
beginning programmer it is great because you can just do simple stuff in
minimal number of lines. For advanced programmers it is great because you can
build a flexible framework that fits your unique business situations. However,
for intermediate programers there is enough flexibility to really write
terrible code that somehow works, but could never be maintained.

------
aGHz
"The only difference is that today it's organized, tested and validated."
Unbelievable. Those are the three reasons developing in PHP was such a pain
back in 2000: procedural web code was a pain to keep organized, don't even get
me started about testing PHP code back then, and at least the projects I was
working on suffered from horrible unvalidated feature creep.

Yes, I would say that's the "only" difference. ಠ_ಠ

------
paulhauggis
I hate Rails. Why? Because of the type of people that make up the community.
They defend Rails to the death and won't admit it has any faults. It reminds
me of the people that are pro-universal health care. Because of this, I won't
use it for any of my projects. I will only start using it when there is no
other choice.

I use PHP for almost all web development. However, I'm not against using other
languages.

I admit, PHP has its faults, but it's still a great web dev language. PHP 5+
has really added some great OO functionality.

~~~
pavel_lishin
> It reminds me of the people that are pro-universal health care.

Thank you for lumping all of them together.

~~~
paulhauggis
Well, it's the truth in my experience. Very rarely will I ever see anyone that
is pro UHC tell me the the things that are wrong with it. Same with the people
that love ruby.

I love PHP, but I freely admit there are issues. I love private care, but I
also admit it has problems.

It's this sort of intelligent discussions that we need for me to take those
sides seriously.

~~~
pavel_lishin
It seemed like a very needless comparison, and a politically charged one at
that.

------
shingen
These debates are always silly at best, and painfully indicative at worst.

Indicative of what exactly? A certain type of nerd (emphasis that I mean a sub
group) that is likely to never accumulate wealth or create anything
particularly successful on their own because they're too anal-retentive to
understand that success in building a Web app or business is not defined by
whether you use PHP or Ruby or Python or even ColdFusion.

Unless you think you're the next Facebook or Tumblr, then extreme optimization
is necessary. Otherwise, the rest of the discussion is bullshit stacked on top
of bullshit.

If the common wisdom were followed, Plenty of Fish should have never existed,
given their infrastructure and development approach. And Stack Exchange should
have never existed with their 'lame' Win stack (popular opinion of the Windows
development environment among a certain class of developers =) ).

There are a lot of ways to 'skin a cat'. The only thing that matters is
whether you can get to the finish line, build something people want to use,
and perhaps monetize it so you can keep putting resources into making it
better. Who gives a shit what you use to get there, just so long as you get
there.

~~~
aGHz
What a pleasant attitude painfully indicative of a certain kind of
entrepreneur that can only see green in the world.

You see, what you call a "certain type of nerd" are actually craftsmen who
enjoy things done well. You can be all the IKEA you want, and you're surely
gonna rack up some interesting profits. But if I'm the kind of furniture maker
who enjoys taking 6 months to build the perfect cabinet, you can be sure I'll
pay special attention to selecting tools that I love. And none of your
monetization arguments are going to count really.

So the bottom line is that PHP vs Ruby vs Python etc is a craftsmen's
discussion. (If it's a serious discussion at all, that is - comparing it to
Lean Startups isn't a serious discussion.) Bringing arguments like yours to
such a setting just makes you look silly (especially when you think it's about
"extreme optimization", then you just look like you really have no idea what
you're talking about).

~~~
rickmb
It's not a craftsmen's discussion. A craftsman picks the tools they feel the
most comfortable with to get the job done.

Sure, craftsmen like to discuss their tools, but as an open exchange about
their experiences in order to learn from it, or maybe even simply out of
professional curiosity.

The whole "my stack is better than your stack", and the "PHP sucks" thing that
is commonplace on HN, proggit and other forums is not a craftsmen's
discussion. It's a juvenile playground pissing contest that has nothing to do
with craftsmanship.

By the way, anybody who thinks that real crafsmen typically use the _"best"_
tools available has never seen neither an artist nor a plumber at work.

~~~
tluyben2
<blink>By the way, anybody who thinks that real craftsmen typically use the
"best" tools available has never seen neither an artist nor a plumber at
work.</blink>

Should go on top of proggit/hn (yes, including blinking tags :).

------
billpatrianakos
Articles like this really make it seem like PHP developers have a big chip on
their shoulders from all the trash talking that goes on about PHP. I'm a PHP
dev and I have to admit, PHP isn't cool. It's thought of as a language for bad
programmers because it's so easy for beginners to pick up. That's precisely
the reason why I'm a PHP developer to begin with! And boy have I given
ammunition to the side that argues that PHP is a "bad programmers language".
But oh well. That's really a good thing that total newbies can pick it up in a
week like I did some years back.

But really no one cares about your language except other people with chips on
their shoulders too. When people use a product they really don't care about
the tech specs no matter what the product may be. They care about what it does
for them. I can clone Facebook in Runy or Twitter in PHP with both clones
being more "optimized" than the original but no one cares. They just want to
write on their friend's wall or retweet something so they'll tell me to go to
hell with my .235ms improvements in page load times, DB queries, whatever.

A truly good developer doesn't waste time convincing people his stack is best.
He proves his skill instead by shipping and iterating no matter what the
language. The rest is just too-cool-for-PHP bragging (looking your way Ruby
guys) and sour grapes (looking at you PHP).

------
ropman76
LOL

------
jayferd
Maybe it's just me, but I don't think having a crappy development environment
is a very good way to build things quickly. Perhaps in the days when there
were few stable alternatives, this may have made some sense, but there are so
many easy alternatives these days.

Perhaps the PHP community is different now from when I left it a few years
ago. I'd never go back to that.

~~~
jayferd
Honest question to the downvoters: All the libraries available at the time I
was coding required a day or two of getting lost in documentation before I
could use them. Has this changed in the past couple of years?

~~~
zalew
I'm not a downvoter, but as a Django dev who was forced to grab a quick
project in PHP after almost 3yrs not touching it - no, it hasn't changed much.
Doc comments and discussion boards are still filled with one gazillion
solutions to every simple task, of which most is crap (even when it comes to
fresh frameworks). Language features aside, what makes me stay away from PHP
is the low quality of it's ecosystem (no offence to the good guys who put
quality code out there), especially when you get used to the level of Python
solutions and community engagement.

------
listrophy
Yes, I'm a Ruby fanboy, but this is ridiculous. These days, Ruby and Python
are the lingue franche of quick web development. PHP had its heyday, and it's
still terribly useful for Drupal-y and MediaWiki-y things... but building
something from scratch?

Not a chance.

~~~
devs1010
Couldn't agree more

