This blog has moved here: Yogeshsaroya.com | FOLLOW ME ON TWITTER @yogeshsaroya

Monday, April 23, 2012

Interview – PHP’s Creator, Rasmus Lerdorf


Rasmus Lerdorf (Creator Of PHP)

PHP (PHP hypertext pre-processor), the language which has revolutionized the way web is today, was brought into existence way back in 1993. Since then it has undergone numerous changes and assisted budding web programmers to create professional websites, quickly and efficiently. Though, initially developed to serve as a hammer for Rasmus, to ease up his daily tasks, today it empowers 35% of the websites hosted on the World Wide Web. So amongst the hustle and bustle of Cognizance 2012, we catch up with Rasmus Lerdorf, the creator of PHP himself, to know more about the language and about Rasmus himself.

GG: Your take in one line on PHP.
Interview - PHP's Creator, Rasmus Lerdorf
Interview - PHP's Creator, Rasmus Lerdorf



RL: In one line…it’s a web hammer – the one tool that you can use to solve any web problem you have.
GG: Can you give us a brief about your career?
RL: So, I went to high school in a place called King City, north of Toronto in Canada. My first programming job was there. I was developing software for the QNX machine, a very early Linux, on 80186 computers which were not very widespread. It was a weird architecture. To me programming is not something that feels like a job because programming itself doesn’t serve any purpose.
I also did a program called Euro Rail sometimes back in 85-86. It was educational software which simulated a rail trip around Europe. You could go to any destination, the train’s doors would open and it would show an image of the city you were in along with facts about that city- how many people live there, attractions and things like that. It was a fun job to do. Then, in my spare time I was building a BBS system (a Bulletin Board system). That was the first internet related thing that I did. Back then, everyone used their modems to dial into another computer. The real advancement came when the BBS systems started talking to each other- you could be on one BBS system and send e-mails that bounced to another BBS system.
When I went to university, I played with IRC (early versions) and GOPHER. GOPHER basically predates the web. Before Tim Berners Lee came up with the World Wide Web as we know today, GOPHER was a way of linking documents, similar to the modern day “href”. Back then, it was really cool. Today, it seems obvious. You guys have lived with it your whole lives. The University of Waterloo had a programme where I could go to school for 4 months and work for 4 months for my undergraduate degree. I had this one job working for a company that did scrolling LED signs. All of this information would be delivered via a satellite linked to their signboards. A lot of information gets scrambled up when sent via satellites. So, I wrote an error correction algorithm that sends all the data three times and select the two that are closest. I also developed a broadcasting system wherein every signboard would have an ID and the message or advertisement was embedded with a target ID. So, a single message could now be sent to say, all the signs in United States.
I also ended up in Brazil for a while working for a company down there, then I went to IBM in North Carolina where I worked with a really complicated Java based application server. I wasn’t with the IBM team for a very long time because it didn’t really fit with how I saw that the web problem should be solved and I was already very well into the PHP project at that point in time. So, I left IBM and went to work for a small company in SFO called Linux care that did support services around Linux. Then, I took some time off. Wrote an O’ Reilly book on PHP, had a baby and finally I joined Yahoo in 2002. I stayed with Yahoo for many years. I have visited India many times for Yahoo (Bangalore office). Yahoo was a fun job because it was very big with so many different things happening and I was always able to work on something new and interesting like we did the FIFA World Cup site in 2004. I helped debug performance issues and things like that.
Recently, I joined Etsy in NY. It’s kind of like an eBay for hand-made goods and it also supplies vintage products. I find the job really interesting. Because of the hand-made aspect, it gets to a non-technical audience and building a product that appeals to someone who can barely click a mouse button that is a challenge. One thing that I am really interested in is what it can do for markets like Mexico- a relatively poor market that has a rich market close to it. So, if we can open up rural Mexico to the American markets, then that could really change the economic situation.
GG: More than 35% of the domains all around the world using PHP, including some of the most visited sites like Facebook and Wikipedia. Had you foreseen this?
RL: No, not all. I built it for me, initially. Then I saw that it might be useful for other people. I still used to think that somebody or something else would come along that would solve the web problem more efficiently. I really didn’t believe that I would be the one to do that. Mine was just a temporary solution until the mainstream caught up. I was kind of waiting… When are the real guys going to catch up? The web just moved so fast and PHP evolved so quickly that nothing really caught up. New things did emerge, but they weren’t really out there. A lot of technologies came up that cared more about the language, the style than substance. The new solutions didn’t really build an ecosystem around them. That’s where they fell down. I concentrated mostly on the ecosystem and very little on the language itself and resulted in something which was very practical and direct. Apart from .NET, I still don’t think anybody has gotten there.

GG: After PHP2, what is your role in its development?
LR: Until v3, it was really just me. People would submit patches and I would re-write them. But, every line of code was something that I had put into PHP. At v3, I started to figure out that this just wasn’t going to scale. We moved from supporting 3-4 to 12-15 databases. So, as PHP became wider and wider, it became really difficult for 1 person to do the job. The big change in v3 was that I opened up the CVS repository to anyone who might have a clue. It transformed from “my project” to “our project”. That was a bit hard. It’s hard giving up control and to see people do things with your code that you don’t agree with. So, you need to give up control and let people make mistakes. Even though you may know that this is not the right thing to do, you just have to let it happen. And sometimes you may be proved wrong. There are about 1500 people who have access to some part of the repository. But, people working on the core code on PHP are actually less than 50. Some are on the documentation, some on the Q&A side. It seems like a project involving a lot of people, but when it comes down to the details, it’s essentially 1 or 2 guys who know something about one particular feature of PHP. Sometimes the volunteers are really young. There is a kid in Berlin who is 17 and he is into a lot of heavy duty work in the core of PHP that affect multi-billion dollar companies like Yahoo and Facebook.
GG: What is your take on having PHP as a procedural or an object-oriented language?
LR: It’s both. There are things that are not objects. There are times when you need a procedural top-down approach to solving web problems. And I really don’t believe that every problem can be boiled down to an object oriented model. So, naturally a language like PHP, that is meant to solve web problems, has to do both. With PHP 5.3 and 5.4, I think the Object Oriented PHP has really taken off. With v5.4 specifically, we are ahead of the game in terms of the modern-ness of our OO implementation.
GG: What is your take on the various frameworks that are coming up for PHP these days?
LR: I still find them to be too focussed on developer convenience and not enough on end-user performance. All the frameworks advertise themselves as tools to make life easier to build stuff. They are too heavily reliant on run-time decisions. But the trade-off is that you end up with something that is really slow and inefficient. We have made the same trade-offs with PHP. It is always necessary to strike this balance. But I feel many frameworks go too far towards developer convenience from end-user performance.
Take the hook system for example- there are hooks everywhere. You can hook in and make changes to control what happens at various stages. WordPress has the hook mechanism as well. This also means that there are continuous checks as the code is running- do we have a hook here or not. And these run-time decisions in an interpreted language can really slow things down. I would love to see a framework that had some kind of a concept of a deploy mechanism where it could figure out that you use MySQL and whatever other technologies and only deploy the code that is related to the technologies that you use. The present frameworks are dependent on a lot of run-time decisions.
GG: What is your take on Hip-Hop?
LR: I find Hip Hop to be a kind of a strange approach. Facebook’s approach to Hip Hop of converting PHP to C++ and then compiling- it’s rough because you also need to convert every extension and Facebook doesn’t need all the extensions. So, they’ve only converted a subset of the PHP extensions to Hip Hop. So, for somebody other than Facebook to use this, they have to only use the same extensions that Facebook uses which is somewhat limiting in the sense that you have to use the same databases and other libraries. Otherwise, you can’t use Hip Hop. That’s why I am not super confident that Hip Hop is the future of PHP. There’s also the issue that people don’t necessarily want to recompile and re-deploy every time they make a trivial change to their code.
Maybe, if we can turn into a real Open Source Project with lots of contributors where everyone would pitch in and get every single extension converted over to Hip Hop. But, I am still waiting for that to happen. I would love to see something of the sorts come along and become the next engine for PHP.
GG: In your time, people could say that this piece of code would take so many machine cycles. But today’s graduate students may not be able to answer to that. Why do you think are the reasons behind this?
LR: Well I think computers have got way more complicated. In the early days, there were only a couple of registers and a CPU and you would be sitting there playing with machine language because you only had 1K of memory. You had to make sure that the code you were writing all had to fit into that 1K, so there weren’t room for any extra instructions. The code had to be as short as possible and there had to be minimum machine cycles.
I distinctly remember when I first started using C, I was very suspicious of this “high level language”. I didn’t trust the C compiler to write the assembly for me. So, I would always write tiny snippets of C code, disassemble them and see what the C compiler used to do-how was it moving stuff between registers and what was its approach. And when you’re doing that, you naturally count cycles. So that’s how I learnt C and this was something that everybody did in the early days of C compilers. But today, nobody dissembles the output of GCC to make sure that it’s the best assembly that you could possible get.
Kids in universities these days are doing Java, which has a virtual machine sitting on top of the OS, which talks to the hardware. So, that’s another level of interaction. The computers are so much faster today, so even if we you waste a few cycles, it doesn’t really matter. However there are times, like with PHP when we need to disassemble code. There are a couple of different ways that you can build a compiler- there is one approach called computed “go-tos” which is the default now and there is another which is just a big “switch case” statement. What we need to do is that when we get a token, we have to turn it into the associated code. Take the name of a function for example- we look it up in the hash table and relate it to the associated code. The way we do that is via computed go-tos where we say that the code for this particular token lives at off-set say 128 and then we do a go-to offset 128. This is opposed to having a big if-else statement-if it’s 1, if it’s 2 and all the way down to 128. The assembly generated in this manner is much more efficient. So, that was probably the only time when we actually looked at the assembly – for the interpreter that lives at the very core of PHP. Outside of that core loop, we no longer look at the assembly. We trust the compiler to not be stupid.
Q) How do you think students from Undergraduate level can contribute to the open source community?
ANS) You can very easily start getting involved on the QA side to begin with. You can take little snippets of PHP and see why this test fails. A lot of people have come in that way. It’s pretty easy and you start learning a lot about PHP that way. Once you know a lot about a popular technology, there is a lot of opportunity out there. Facebook and Zynga are hiring every single competent PHP developer they can find .You can avail a lot of job opportunities with practical knowledge like that. But, I want to see way more involvement than that.
Q) By qualification, you are a Systems Design engineer. If not for this, what other field(s) you would have chosen?
ANS) Anthropology may be. I am very interested in cultures. I did take some anthropology courses in University. You guys know pretty well, in an engineering course, there is not a lot of free time to play around with the non-technical courses. But my passion always has been affecting people, doing something that’s important.
Q) Some people who inspire you.
ANS) I am mostly inspired by people who do things that affect, people who care more about the outcome. I see a lot of people who are focussed on how to get there and the style. I think the people who have motivated me are the ones who have actually taken technology and touched people. Founders of various companies who have taken PHP and they have really affected people’s lives like Rob Kalin, CEO of Etsy.
Q) Personally, how do you feel about the fact that something which you started off as a hammer for own self is now serving to be the basis of income of numerous people around the world.
ANS) That’s co-incidental. That’s got nothing to do with what I did other than the fact that I was at the right place at the right time. It has got very little to do with my characteristics or my contributions. I don’t feel like it’s something that I have done, it happened by accident fuelled by a community of users and developers who all saw the same characteristics of the web. It is something like there’s a really cool party that lots of people are talking about and you happened to be the first guy who showed up at that party-that doesn’t mean anything. The party only becomes interesting because lots of people showed up and a dynamic atmosphere developed.
So, I honestly cannot in any way take credit for PHP. The only thing I can say is that I was the first guy with the seed and that grew and I feel lucky about it.
Q) Some sign off tips/advice for students in general.
ANS) Find stuff that you are passionate about, that can touch people’s lives. Don’t worry so much about grades and status. If you find something that’s really interesting, there’ll be lots of jobs.

0 comments:

Post a Comment