Freigeben über


Interview with Eli White, PHP Developer and Intern on the ASP.NET Team

I had the good fortune of meeting Eli White, a junior at University of Washington and a PHP developer of 7 years, for the first time at the local Seattle PHP Meet Up a few months ago. I then ran into him recently at Microsoft where I found he is doing an internship on the ASP.NET team. I had lunch with Eli last week and we talked about the work he’s doing on Web Matrix and Razor. I thought his perspective as a PHP developer on Web Matrix and Razor were worth sharing…

Brian: Tell us a bit about your background…what are you doing now and how long have you been programming in PHP?

Eli: I’m originally from southern California and am currently entering my junior year at University of Washington. I’m majoring in computer science.

My programming focus thus far has been web based applications, things like discussion board systems and web frameworks. Some of what I’ve worked on can be found here: https://sarosoftware.com/products. I started programming in PHP around 2003 and have since then developed applications cumulating over 60,000 downloads. I am also a Zend Certified PHP 5 Engineer (https://www.zend.com/store/education/certification/yellow-pages.php#show-tiClientCandidateID=ZEND013166).

Brian: What drew you to PHP? What are some of the challenges you’ve run into?

Eli: I started programming with PHP because of the large community driven development and the set of available pre-built applications that could be dropped in to a site to start a community. Since I started PHP I have learned and developed with C# and Java. I started learning PHP by finding a type of project that interested me (discussion boards) and emailing the contact address listed for about 30 of such projects asking if I could contribute. Some projects were more welcoming than others, but I found one that was interested in getting all the help it could get. I jumped on board and began digging through the code trying to understand the flow and fixing only small, obvious bugs. I didn’t have enough knowledge with the project or PHP to contribute decent code (in 2003, there really wasn’t such thing as decent PHP code). Over time I got more involved and the project team (one other guy) dropped himself from the project leaving me as the sole developer / supporter / owner. That opportunity and kick in the pants is one of the things I love the most about the PHP community.

One of the difficulties that I have found with PHP is that it is very difficult to maintain a quality level of code in projects. PHP makes it so easy to write poor code, it takes a fair amount of discipline to have a consistent set of coding standards. It also makes it difficult to bring outside help onto a project. Even though many people claim to be experienced PHP developers, that doesn’t mean anything about their understanding of concepts like object oriented code. This is one of the reasons I’m so lucky that I found a group willing to bring on an inexperienced developer.

What I like about PHP is how easy it is to grow a prototype file that demonstrates functionality into a full blown application. By simply adding additional files, then advancing to using templates, and finally to utilizing frameworks, a prototype quickly becomes an application. There is no need for bulky projects for a single file test, this also means you can develop in notepad or any IDE with a text editor.

Brian: How did you end up as an intern on the ASP.NET team?

Eli: In the beginning of 2010 I was invited as a PHP developer to a software design review that the ASP team was doing for the razor syntax and web matrix to see how PHP developers felt about their approach. I was extremely interested in many of the demos they showed us and the ability to streamline development through WebMatrix. I had a bunch of questions, thoughts and feedback for the team throughout the software review. Apparently they found my insight useful and invited me to interview with them for an internship.

I have been able to apply what I knew from PHP to quickly pick up a new web language…I’ve enjoyed that throughout my internship. I’ve been able to work on figuring out the common scenarios that people come across during app building and build functionality to make it easier for users to build web sites and applications. I have been working on the Razor Syntax team and as a PHP developer, I’m very excited for where the Razor / WebMatrix product is headed.

Brian: What is it you like about Razor and Web Matrix?

Eli: WebMatrix provides access to the ASP.NET stack in the way that I have grown to love PHP. You can now write a single .cshtml file and click run. No need for projects / configuration / or building. This functionality isn’t a WebMatrix specific thing either, the new Razor files can be written and developed with notepad. If you do decide to stick with developing in WebMatrix or Visual Studio, you will eventually see intellisense as well. Intellisesnse has been a hard thing for PHP IDEs to do since PHP is such a fluid and dynamic language. Some do it better than others but I have never seen an IDE for PHP that gives complete Intellisense for everything in a file. Since Razor is still C# (or VB), the tools know exactly what you are writing and where things are coming from. This enables our tools to provide intellisense that far exceeds anything you could see for PHP.

I also like the syntax of Razor. The engine simply knows what is code and what is supposed to be HTML…it just works. Here’s a comparison between PHP, ASPX, and Razor syntax:

PHP (excuse the short tags):

<ul id=”products”>
<?php foreach($products as $p) { ?>
<li><?= $p->Name?> ($<?= $p->Price)</li>
<?php } ?>
</ul>

ASPX:

<ul id=”products”>
<% foreach(var p in products) { %>
<li><%=p.Name%> ($<%=p.Price%>)</li>
<% } %>
</ul>

Razor:

<ul id=”products”>
@foreach(var p in products) {
<li>@p.Name ($@p.Price)</li>
}
</ul>

Scott Guthrie, corporate VP at Microsoft, has a great blog post about Razor: https://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx. For a more complete walkthrough of the syntax fundamentals and conveniences Razor provides, I have found this tutorial very helpful: https://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax.

Brian: That’s pretty cool. What else besides intellisense and the syntax to you like?

Eli: I like the initialization files and the many helpers that are available. Initialization files make some mundane and repetitive tasks easy. For example, a start up initialization file (_start.cshtml) is executed once when an application first starts up. (This is possible because applications are compiled, not interpreted.) This file can do things like verify that certain database tables exist and initialize helpers. In PHP, this sort of thing has to be done every time a script is executed.

Initialization files are not only useful at the application level, they are useful at the folder level. When an _init.cshtml file is placed in a folder, it is executed on every request for a file in that folder. For example, I can have an init file in a folder that can require a user to be logged in to access any file in the folder. In PHP, I’d have to include code to do this on each page in the folder.

Brian: You mentioned helpers…what are they?

Eli: Well, an oversimplified explanation is that a helper is a function. Together, helpers make up a framework. One of my favorite helpers is the Membership/Security helper. With simple one-liners, razor makes it easy to create users, do email verification, verify that a user is authenticated, and even use ReCaptcha. This tutorial has more information: https://www.asp.net/webmatrix/tutorials/13-adding-security-and-membership.

Brian: That’s great, Eli. All very interesting stuff. WebMatrix and Razor definitely sounds like something I should check out in more detail. Thanks, and best of luck to you this year!

Share this on Twitter