
Why you PHP guys should learn Golang - mikespook
http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/
======
slurgfest
It doesn't seem to me that there is a whole lot of overlap between the virtues
or sweet spot of PHP and those of Go.

Go is not a particularly hard language for the level it's designed at (though
I'm not sure that remembering keywords is really a primary usability concern
for any language)... but if you are just trying to slap together a web app and
feel intimidated by deploy details and want to use cheap shared hosting and
plug into existing libraries as much as possible, Go is somewhere between
inconvenient and totally infeasible.

I'm not saying Go is a bad choice... there are good reasons to look at it,
particularly if you intend to work at a somewhat lower level (e.g. for
performance) and want some of Go's benefits (like the concurrency model, or
some of the benefits of static typing and compiling without so much time or
effort on managing dependencies as you would otherwise spend, etc.)

I'm saying the priorities which would make PHP attractive would tend to make
Go quite unattractive. I can certainly see how PHP programmers (like many
other programmers) can benefit from learning another language with abilities
complementary to what they already know.

~~~
andrewfelix
Agreed. I was interested up until this point... _"Your PHP scripts will be
evaluated by SAPI components: web server module, PHP-fpm or CLI. All needed
for PHP deploying is a SAPI environment."_

What? Sorry but I know nothing about deployment. Should I? In the past I've
only used PHP to solve simple problems.

~~~
Mikushi
You don't necessarily need to know about the SAPI, but what he says is true.
Any environment (Apache, Lighttpd, FPM, CLI, ...) that runs PHP, is built on
top of the SAPI provided by the Zend Engine.

That's interesting stuff, but not on the "must know" list.

------
vhf
How can you possibly write an article telling PHP programmers to develop in
Golang instead without writing anything about web programming in Golang ?

Why do people use PHP mostly ? For web development.

 _Why PHP guys should learn Golang_ should at least tell PHP guys if it's
possible to do web development in Golang, and how, and show them how it's
better suited (without telling them only "it's a better language").

~~~
reedlaw
Last line of the article:

> This is my writing exercise. If you find any grammatical or spelling error,
> plz tell me!

Also notice that it's a predominately Chinese blog.

~~~
vhf
Well, thanks for pointing this out, although I think it should be possible,
for a Chinese author who's not very fluent in written English, to write about
Golang in a web dev perspective.

I don't really care about the author's English skills, I'm no grammar nazi.

------
erangalp
No offense to the writer, but it seems to me he doesn't really understand web
development. In 99.9% of web applications, the bottleneck for scaling is the
database and not the language. Web application processes are generally not CPU
intensive and are short lived, something PHP handles very nicely.

On the other hand, PHP has a huge list of existing resources, libraries and
excellent documentation and community.

Look over at the language used by the largest sites on the Internet, and
compare the number that use PHP to the number that use Go. Not saying Go can't
handle those applications, but obviously PHP was used in scale effectively on
many occasions, while Go hasn't proved anything yet.

~~~
thirsteh
It powers YouTube, among other things: <http://code.google.com/p/vitess/>

Go documentation is very good, the standard library is extensive, and it has a
very active community, but it does lack certain libraries that web developers
might find attractive, e.g. a comprehensive ORM.

Insinuating PHP is better because it's deployed in more places is silly.

~~~
erangalp
Stop reading between the lines, I didn't say PHP was better as a language.
What I was saying was that trying to convert PHP developers into Go
programmers with those kind of arguments shows a basic lack of understanding
of how web applications work, or what is the real strength of PHP.

~~~
thirsteh
Most web developers who read Hacker News don't host their stuff with a hosting
provider that doesn't even provide shell. With Go you just need to be able to
execute a binary.

You sounded a lot like Go hasn't proved it's viable for "web scale." It has.
Is it as widely deployed? Of course not, it's new.

I'm not sure what strength of PHP you're referring to--I'm assuming the
ubiquity with shared hosting providers--but it's not even that great of a
language to interface with databases, which was your example before.

Not arguing for Go particularly, just arguing against PHP. Its ubiquity is
basically all it has going for it, but yes, that's a big deal.

~~~
erangalp
Again, you assumed wrong. Makes me wonder what your actual experience with PHP
is. The strength of PHP is its focus on the web environment through features
and functions that make it simpler to develop in that environment, that have
be implemented in code on most other languages. In addition, the huge amount
of available mature libraries for a variety of purposes and the large
community that supports it, is something I really find hard to believe Go can
compete with. Saving development time with mature code is much more important
than learning a language that doesn't provide much tangible benefits for the
web environment.

~~~
thirsteh
I've used PHP for 15 years. You keep making these "I-know-better-because-I-
use-PHP" statements, but ironically you probably have never even touched Go.
Give it a try. Don't be the guy who hates anything that's new.

("Poor library support" is a terrible argument for PHP vs. Python, Ruby, or
even functional languages with respect to web development too.)

~~~
erangalp
You're the one who's doing the hating my friend... you keep finding hidden
messages in what I write and generally piling up on PHP without good reason. I
never said anything bad about Go, or bad library support in other languages,
just not agreeing with the article on comparing PHP to it where PHP is (in my
humble opinion) a very strong option already.

~~~
thirsteh
I pile up on PHP because it's a shitty language, and basically the only
argument for using it nowadays is that it's relatively ubiquitous among budget
shared hosting providers. I don't think I ever tried to hide that I hate it.

Now you're twisting your own words.

------
alttag
Maybe I missed it, but the things that would convince me are a) a large,
strong community, b) extensive documentation, and c) code examples in the
article.

Seeing no references to any of these, I don't find the article terribly
persuasive.

~~~
genwin
Examples for Golang _are_ sparse compared to PHP-land. The books help a lot on
that. Other than that I haven't had an issue with finding stuff online. The
official documentation is extensive when you know how to look for it (namely,
"golang <package name>". Hopefully in the future the official documentation
will have many more examples.

------
stratos2
Oh good yet more comments about why PHP is trash and how your intelligence and
social status are dictated by what language you are using. I almost don't
click on posts about programming languages any more. Yet here i am,
commenting..

~~~
martswite
I primarily develop using PHP. I read the first few lines of this article, got
to this 'PHP is easy to learn. Golang is as easy as PHP!' and basically read,
'Hey thicko PHP guy, you could probably learn to use this language, cos its
simple enough for your addled brain'.

The immediate feeling of condescension turned me off.

~~~
alinajaf
Let's try this with me...

The original: "PHP is easy to learn. Golang is as easy as PHP!"

Some str_replaces:

"Ruby is easy to learn. Golang is as easy as Ruby!"

"Clojure is easy to learn. Golang is as easy as Clojure!"

"Python is easy to learn. Golang is as easy as Python!"

Hmm, I'm still not feeling offended. Are you sure this might not be some sort
of inferiority complex at play? I think a lot of PHP developers get needlessly
offended whenever we talk about PHP, positive or negative.

~~~
martswite
I'm pretty sure it's not an inferiority complex, im in no way precious over
the language that I develop in. I just don't agree with the inference that
developers that use PHP do so because they aren't smart enough to use other
more complex languages.

The particular line of the article I quoted however does, to me, infer that
php developers can only learn simple languages.

------
languagehacker
I can't really blame the guy for the off-the-wall tone and and the straight-up
poor grammar and spelling, because I'm guessing English isn't his first
language. Kudos for trying.

But some of his reasons that Go may be better or more useful than PHP don't
really stick. You can deploy a PHP web application using the PHAR format,
which is a lot like just moving a file into a folder. And static variable
typing isn't really a requirement for a successful language if you're
adequately validating input and the like.

Also, a PHP programmer would have an easier time learning another scripting
language compared to another compiled language, regardless of the overhead of
configuring a development environment.

Things that would make me consider Go would include ease of deployment,
significant speed improvements, fantastic libraries for the kinds of things I
want to get done, or smart under-the-hood concurrency that I don't personally
have to worry about coding. Go could have all these things, and I've have no
idea from this post.

------
genwin
Already sold! For my first web 2.0 project I started with PHP and, being a bit
disappointed with its performance, switched to Golang. Among other things I
didn't want to have to do ifs with parentheses or use semicolons. Those seemed
superfluous. Then I discovered Go, and it doesn't need those things and it's
way faster. A lot more benefits too. Definitely a steeper learning curve than
PHP initially but should be well worth the effort. I'll still use PHP or
Python where they make more sense.

------
Afal
> But why you PHP guys should learn Golang? Just because it is cool! Ja, I’m
> kidding, but it is true.

I stopped reading here.

I don't know. Skimming over this blogpost made me think "Why should I use
go?". I'm not even a PHP guy and this isn't even convincing me. What hope do
they have to convince a PHP guy.

I didn't see any code. Sure there's a link to the "A Tour of Go" but if I was
a PHP guy I would be confused by the syntax. No semicolons? Ok that may be an
advantage (I'm also fairly sure you can add semicolons to Go and it wouldn't
care).

I dunno, there wasn't enough here explaining why I should use Golang instead
of PHP. I didn't like the way it was formatted. I didn't like the rhetoric.

I am one of those strange people who prefers to watch videos of a language or
a web tool working and found [http://ftp.heanet.ie/mirrors/fosdem-
video/2011/maintracks/go...](http://ftp.heanet.ie/mirrors/fosdem-
video/2011/maintracks/golang.xvid.avi) which seems to go through some of
Golang's features. It's a little longer than that blogpost but it's a little
better with convincing me to use Golang.

------
a_macgregor
Hmm, found nothing in the article to really validate the claim that PHP
developers should learn GO.

It might be a cool language, but the main reason php developers use PHP in the
first place is Web Development; the article doesn't even mention the
possibility of using GO for web development.

There aren't any code samples on the article either; why is GO so good ? what
does the syntax looks like? _Don't just tell, SHOW_

I prefer to invest my time learning languages like ruby or python.

------
pan69
Where can I get managed Golang hosting for $4.95 a month?

~~~
luriel
You can get managed Go hosting for $0 a month:
<https://developers.google.com/appengine/docs/go/overview>

~~~
genwin
I love Go, so it's a shame I can't trust its initial creator, Google, for
hosting. Too many stories about accounts unilaterally yanked and prices jacked
up 3X+ overnight.

------
pjmlp
With a JVM or .NET language they would be better served than with Go.

Given the available communities, performance of current JIT and GC systems,
tools, libraries and distribution mechanisms.

If they prefer to go VM free, there are commercial native compilers for JVM
and MSIL bytecodes.

For those with VM phobia, D, OCaml, SBCL, Haskell, Rust offer native code
compilation by default, with 2012 set of language abstractions.

------
rickmb
So basically the argument is that if you are the "when all you have is a
hammer everything looks like a nail" kind of developer, you should use Go as
hammer instead of PHP.

I don't think so.

Not to mention the unfounded and insulting assumption that "you PHP guys" are
all the "everything looks like nail" kind of people. Methinks the author is
projecting too much.

------
LeafStorm
Great idea! Now how drunk do I need to get Systems so they will actually
install Go on our servers? Because I'm sure that they would just love giving
several thousand students, staff, and faculty the ability to run arbitrary
machine code!

~~~
aaronblohowiak
If you can't let arbitrary machine code run on your system, you are "doing it
wrong." *nix was designed as multi-tenant from the get-go. also, they would
not need to install Go on the servers, as the binaries are completely self-
contained.

------
tszming
Most of the benefits he explained in the post also apply to Java (e.g. easy to
use, GC, type system & concurrency).

IMHO, if a programmer only know PHP and want to explore, I would suggest
Java/Scala/Python/Ruby as the next language instead of Go.

~~~
luriel
Java and Go's type systems are very different, Go's is much more lightweight,
had implicit interfaces (aka "static duck typing") and has an improved form of
composition instead of inheritance.

And concurrency in Go compared to Java is like day and night.

Then there is the simplicity and clarity of the standard libraries, and so on.

~~~
tszming
The difference between Go and Java is one issue which I have no interest to
argue, but if you read the whole article in detail and will find `most of the
features` he discussed are already provided by Java.

1\. Golang is a compiled language with a static type system. You have no
chance to confuse veriable types

2\. You must have already felt some powerlessness to PHP. It dosen’t have
concurrent mechanism build-in..

3\. Golang has GC, there is no need to care about memory management

4\. Golang is also a C family’s programming language. Eh… with a litte syntax
difference.

and more..

------
snogglethorpe
Hmm, reduced to begging for users in the streets?

Oh well, I suppose at least it's more popular than Dart... _ducks_

------
mseepgood
I don't think that PHP programmers are capable of learning something new.
Otherwise they would have left PHP for any other language long time ago.

~~~
slurgfest
Nah...

Even if we supposed that PHP beginners all outgrew it after one year, there
are enough people always picking it up that you would still always have PHP
programmers, until there was enough of a cultural shift that people stopped
picking it up. (Unlikely since PHP's virtues or apparent virtues to newbies
are many, and whatever its problems it is still a viable way to build things)

Second, even if PHP is a relatively bad tool in some important ways - if you
actively push your abilities as you log many hours, your knowledge will
improve. And without specific numbers, PHP is certainly among the most popular
languages for web work (if not the single most popular one). So we can expect
there are a large number of people who have grown up in PHP and have therefore
gained some level of technical maturity even if they are using a bad tool
(actually, struggling successfully with bad tools might help develop certain
muscles useful in areas like maintenance coding).

People are PHP programmers not because they are stupid, but because that is
what first worked for them and they haven't had the time or reason to change
yet, or it's where their job is, or because they just have bad taste ;)

(that's a joke, I do mean to say that matters of taste are involved though)

~~~
jtreminio
Really, don't feed these trolls that pop up in every single thread that has to
do with PHP.

