Author: Manuel Lemos
Last month viewers: 3
Categories: Interviews, PHP Performance, Lately in PHP Podcast, PHP community
They have discussed several topics of interest like PHP code generation tools for speeding up PHP development, the video of Rasmus Lerdorf talk on PHP performance optimization techniques.
They also discuss the reasons and the progress status of things that sometimes annoy PHPClasses site users, like the advertising placement and the redirection during registration and login in the site.
Download Size: 41MB Listeners: 7759
Introduction music: Harbour by Danilo Ercole, Curitiba, Brazil
RSS 2.0 feed compliant with iTunes:
In iTunes, use the Subscribe to Podcast... item of the Advanced menu, and then enter the URL above to subscribe to this podcast.
- IndieConf event
- Day Camp for Developers event
- TechZing Live podcast
- AppIgnite Web application builder
- Metastorage PHP ORM code generator tool
- Metabase PHP database independent abstraction layer
- Lemon parser generator
- PHP Parser generator based on Lemon parser generator
- Rasmus Lerdorf talk about PHP performance optimization at Digg offices
IndieConf and Day Camp for Developers soft skills events (01:05)
AppIgnite - PHP application code generator (03:57)
PHP Performance Optimization talk by Rasmus Lerdorf (39:42)
PHP Programming Innovation Award nomineed of July 2010 (51:31)
The good and the bad of the PHP Classes site according to Jason Roberts (1:07:11)
Introduction (00:20)Manuel Lemos: Hello. Welcome to the Lately in PHP Podcast, this is episode number 5. As usual I have here with me Ernani Joppert my usual co-host. Hello Ernani, how are you doing?
Ernani Joppert: Hello, Manuel, I am always welcome to be here. I'm very excited about this episode and just wanted to say a warm welcome to everybody.
Manuel Lemos: Okay, this time we have a guest, Jason Roberts from the United States, I would like to welcome Jason; how are you Jason?
Jason Roberts: Thank you very much for having me on the show. I'm excited to be here.
IndieConf and Day Camp for Developers soft skills events (01:05)Manuel Lemos: But first let me tell you about a couple of events of interest.
First I'd like to comment on Indieconf that actually we have talked about it in the previous podcast episode. This is an event organized by the Michael Kimsal company, Webdev Publishing. It will take place on November 13th in Raleigh North Carolina in the United States.
This is basically an event that will help independent developers to learn interesting soft skills that will be helpful in their profession like answering questions on how do I find clients, how do I get paid, what should my contracts look like, and other than that what sort of technologies do I need to know.
Another interesting event that coincidentally will also focus on soft skills, is Day Camp for Developers that will take place actually it's a remote event that will happen on November 6th
This is an event organized by my good old friend Cal Evans. You might remember him from Zend. He used to be the Zend DevZone manager.
This event will also focus on soft skills that are interesting for independent developers to develop for themselves to evolve in their careers, and will talk about things like career management, technical writing, and things like writing a resume that gets read.
It will feature some interesting well known developers of the PHP community, so it will be probably one event that you may want to attend. This event is actually virtual unlike Indieconf which is physical, it will take place in a physical place in North Carolina, and this one you can register and attend online. So if you are interested in evolving your careers I would suggest that you try to attend these two events.
AppIgnite - PHP application code generator (03:57)Manuel Lemos: But let's get back to our guest. Well, I invited Jason here because Jason and his colleague JustinVincent have a podcast, TechZing Live, which I listen to regularly, and I think it would be interesting to invite them.
This time I'm inviting Jason because they talk about interesting things, they also do PHP development, and they also are into entrepreneurship projects. One of the projects that I have heard from Jason in that podcast is Applgnite. Jason would you like to talk a bit about your project, so we can get to know a little more about it?
Jason Roberts: Sure, Applgnite is a web app that will allow non-developers or non-technical people give them the ability to create a web application without having to write code.
Obviously you could be a developer and use it too, but I'm specifically targeting people who don't know how to code because if you want to create some web based application you're pretty much out of luck unless you know how to code and you actually have to know quite a bit; even if you know how to write PHP it can still be very difficult.
And I've just written so many web apps at this point and I've just noticed so many patterns I just felt like there's got to be a way that you can do this maybe through a series of wizards and stuff that could walk somebody through it and build most of the application without having to write code.
Manuel Lemos: Right, and basically what exactly does it do? From what I understood it is not yet available, right?
Jason Roberts: Yeah, it's not quite ready yet, I've had some people beta test it, sort of just give it a first look, and they ran into some of the same errors. So I wanted to take a step back and just get some of that stuff sorted out once and for all before I open it up to anybody else.
But, yeah, the way it works is that -- the way I would describe it if you ever used one of these form builders like Wufoo, have you ever heard of that Manuel?
Manuel Lemos: Yeah, I heard but I don't use it, but I've heard about it.
Jason Roberts: Well, it makes it very easy to create a form. You can just drag and drop some form components onto your page and you just kind of drag and drop, move them around, name them, and then presto you have a workable form.
And so I almost envision it kind of a combination of Wufoo meeting Ruby On Rails. So in Rails you can have all these complicated relationships between models or between tables. But while Ruby On Rails and the similar projects like Django or CodeIgniter, they still require you to be an expert coder to get anything built.
It might make your job easier than if you had to write it from scratch but it's still going to take you a lot of work. And where where those frameworks might take something that would've required four or five months to build and you can do it in like two or three weeks. I want to take that down to like 30 minutes or an hour or something like that.
Manuel Lemos: So it basically is a code generator or what comes out of it?
Jason Roberts: That's right. Yeah, so you go through a series of wizards or even like property pages just sort of changing the settings, adding fields, setting what the validations are going to be, things like that. And then it will generate all of the code, all of the HTML, all the PHP, all the database tables, everything. Every single time you make a change it will generate any and all code that you would need.
But it's all behind the scenes and I think if the early versions of this it's just going to be purely hosted remotely on my cloud or my servers. So that you don't actually have to get in and set up your own hosting account or anything like that.
Manuel Lemos: It sounds interesting. So is this going to be a paid application? Is this a business? What do you intend to do once you find it ready to release or to make it available somehow?
Jason Roberts: Yeah, I'm always playing with the idea if I whether I want a freemium version or just have it all pay, I mean it will definitely be a paid version, and I think for businesses that want to build software, want to build a web application, it will be extremely valuable to them because they can cut down on their costs by orders of magnitude.
But I think it could also work for small companies or startups that want to build something and maybe they want to get something up quick, because coders kind of like to do everything their way, right, they have their favorites, their libraries, their favorite set of tools. And I'm the same way, kind of persnickety about it. Well, this is the way I like to name my variables, this is the way I like to design my database tables.
But if you can say, look, you can design this thing and 10% of the time and then override some of the functions then it would probably entice a lot of developers to say alright, screw it, that's actually preferable, you know, maybe I don't have some of the flexibility I might have wanted if I wrote every line of code myself, but if everything is nice and clean and consistent and works then it's hard to argue that it would be a smart thing to do.
So, I'm thinking that, yeah, I mean it's going to be something that is going to be a paid application. There may be a free version that has sort of a limited, it limits the power but then maybe scale the price based on how complex the application is or how much activity there is. I haven't really decided how I'm going to scale that yet.
Manuel Lemos: Are there any similar applications out there or is this something that you are doing in a way that you're going to be innovative?
Jason Roberts: Well, there are a couple things that are sort of similar. There's something called QuickBase that Intuit owns. They bought QuickBase maybe 2006 or something, but it's very expensive, it's like $60.00 per user per month.
So it's really for companies to use to build these sort of database, web based web apps that you might've in the old days used Access to build but you want it to be more web based, you want it to be more powerful, scalable than say an Access application.
So they've targeted enterprises and enterprises can build these large applications and they can still do it even paying $60.00 per month per user it's still probably a very small fraction of what they would have to... what it would cost to build a thing from scratch.
Now, I don't want to go after enterprises because I think there's more room for building a business if I went after the smaller businesses. I think as David Heinemeier Hansson called it in one of his start-up talks was, I think start-up school talks, the "Fortune Five Million".
So there's like the one or two person start-ups, hey, we need this application, I wish we could just build something, and then they can use AppIgnite to just go through a series of wizards and go name their record types and their fields and the permissioning and how things are sorted and filtered on the pages, and then maybe go if they want to and edit the themes or edit the actual CSS to make it look however they want it to.
But there are also probably larger companies that have departments who would love to have some custom application that can do something they need done but they just don't have the resources allocated to them within their corporation and they can't afford to outsource it to some company to spend $50,000.00 or $50,000.00 to build.
Manuel Lemos: So does your application generate code that people have to install in their servers to run it or does it actually run the generated application code?
Jason Roberts: Yeah, so it generates everything, and what you would do is that you would just log in, create an account on AppIgnite, and let's say you said that myapp.appignite.com, okay. And you would just design it however you wanted to and then you could either make it a public application, you could create your own domain, so maybe like phpclassesapp.com maps to mywebapp.appignite.com, and so it looks like your own app running on your own server would be running on my cloud.
And that way you wouldn't even have to mess with it, but then like I said I might open it up so that people can have access to the generated code so that you can have... so what I do is I generate, so for instance like the model classes and the view classes there's a directory of say model classes, right, and let's say we were creating a project management app and you had a project model and you had a task model.
Well, each one of those you would have a sub-directory within your model directory called 'generated' and it would have the generated classes and then you would derive from those classes your project and task classes and you would have overrides for all of the major functions: before save, after save, before delete, after delete, that kind of stuff, or the functions themselves, and so you could do whatever you want. If you're like, hey, this is 95% the way I want but I need to override these functions to tie in with something else.
Manuel Lemos: Right, it sounds interesting and what about... you said you have provided access to some beta tests, what is the acceptance that you are getting from them so far?
Jason Roberts: Well, you know, that was early on and that was a few months back, and I think people... it was only like maybe a dozen friends of mine who were technical, and they all got it, they were all like this is cool; it's like when this works completely they thought it would be really exciting because they saw how powerful it would be.
But everybody ran into like two or three of the same bugs at the time because some relationships between models are automatic and some people were recreating those same relationships because I hadn't made that clear, and so things were a little confusing because the UI hadn't really been finished up, so that's why I figured I needed to take a step back and really get that squared away before I had people use it again.
But, I think it's like a lot of things, it's like the idea itself is really enticing. The question is can I execute on it? Can it work well enough and be flexible enough and easy enough to use that it's a solution?
Because you hear about these kinds of things and it's still hard to use and confusing or not flexible enough and people are like, ah, screw it, it's just not worth it, I can't make it do anything I want it to do.
So, that's where my focus is right now, I'm really just trying to get the UI complete enough so that when you walk through it it's easy to understand.
And one analogy I use is sort of like I want it to be almost as easy as say going to a bank ATM to take your money out, like automated tellers; like you go in and you say alright do I want to withdraw or deposit money or transfer. Okay, do want to withdraw or do you want to withdraw from checking or savings, I mean it's like you can't really make a mistake, right, I mean it just asks you a series of questions and then you have a few answer selections you can choose from and it's just hard to screw up.
And that's what I'm trying to do; I don't want this sort of Photoshop experience where you know if you open up Photoshop it's like alright, great, here's this powerful machine, now create something.
You're looking at it going okay, I have no idea where to start, I have no idea. You don't want people to feel like you have to read a 300 page manual before they can create something. You want somebody to just be able to walk in, they get asked a couple simple questions, if they don't understand something there's something inside that says if you don't understand what this term is click this button, here's an explanation kind of thing.
Ernani Joppert: I see. Here's one question: this tool is it database independent or is that an option for the user to export the project and run on their own boxes if it grows big enough?
Jason Roberts: Yeah, that's something I was thinking a lot about, and I think what I'll do is I'll make it so that if people want to export it they can, and that will probably come at a price, right, because if I'm charging say $30.00 or $50.00 or $100.00 a month for some application depending on the size of it, and then someone says oh I want to export it, well then I lose that revenue so I'd to charge some price if you want to take everything and generate it and move it off I'd probably charge some kind of a fee for that.
But, we'll see, I want to make something that's fair and reasonable that doesn't undermine the whole pricing model, but I've been creating it with that thought in mind because if I was a developer I'd be like, hey, this might be great for the first six months or year, but if we want to scale out or we want to do all these other things or we want to run it on our own servers in a data center or something then you want that option. You don't want to feel like okay I can't ever leave.
And you also want the code to be as clean and simple, so clean and simple that people look at it and go, oh, this is just how I'd write the code. I don't want this to be this ugly generated mess where you look at the code and you're like I have no idea what this is. Like do you remember Dreamweaver back in the day, did you guys ever look at Dreamweaver?
Manuel Lemos: Yeah.
Ernani Joppert: Yes.
Manuel Lemos: Never used it.
And one of the things that I like about code generation, and I'll answer your question about the database stuff in just one sec, Ernani, but the thing about code generation versus say like meta-code programming, like in Ruby, is meta-programming does a certain amount of magic, I think, that you just have to understand how the framework works to even make any changes.
Right, because you write something and, right, there might be like four or five lines of code and all of this amazing stuff happens but you really have no idea how it really happened. So, getting in there and changing the stuff takes either a certain amount of act of faith and also takes a certain amount of expertise.
What I wanted to do was generate only the code that you needed without the reliance on some big giant framework. So maybe there's only like two or three very small utility classes like for validation or formatting which you could look at and understand in like three minutes if you know any PHP at all. And the rest is like 100 lines of code, 150 lines of code; you can look at it and you'll be like oh, yeah, that's all it does, easy, no problem, you know, got it.
And that's what I wanted because I hate deciphering other people's code, and it's just a nightmare, and I didn't want to have to do that so I'm trying to make it as clean and standards based, you know, like the Zend style guide and how everyone else is writing their code, how they put their braces, what's capitalized, trying to make it exactly like that.
And in terms of the database stuff, the first version, see I wrote... I have one guy I'm writing this with. His name is Guyon, and Guyon and I are writing it the first version to work with MySQL, and we wrote our own object relational mapper because the ones that we evaluated at the time just either a) didn't do everything we needed to do or didn't have the documentation to support stuff so we couldn't understand how to get to do certain things.
Which, you know, obviously if there was a form that was really mature and well documented and flexible and everything I would've been happy to take it, but anyway, we ended up having to write our own. And, which is nice because the resulting generated database code is very clean and very simple.
And it works with MySQL but we've also done a certain amount of work to generate to use MongoDB, so ultimately what I'd like it to do is that you could select whatever database you want to use; a no SQL database like Mongo or you want to use MySQL or maybe at some point PostgreSQL or something, you could use that.
And ultimately maybe even go beyond PHP. Maybe say you could use Python or PHP, any one of these databases. But for starters I figured let's just start with PHP and MySQL since those are the most common and those work fine and most people understand them.
Manuel Lemos: Yeah, right, for your initial goal of providing an application that will be hosted by yourself it really won't matter because ultimately your customer will not have access to the code.
Jason Roberts: Yeah, I mean who cares, right; if it's our problem as long as it works they're not going to care.
Manuel Lemos: Right, they are paying you for that.
Jason Roberts: Exactly, and but I also understand once you get to scale sometimes the no SQL solutions can work a lot better, and I think that Guyon and I we both had a certain amount of interest in the no SQL solution, and we thought it would be really nice to design this ORM so that it can easily switch between generating the code for a no SQL versus a SQL database and that would create a certain amount of flexibility in interface.
And I just think, too, once we get to the point where people want to export the entire application to their own server and having a no SQL solution I think might be a nice selling point say a year down the road as those pick up more traction.
Manuel Lemos: Right, well, code generation solutions are very interesting, and I think sooner or later every developer reach to a point that he will be considering automating part of his development process by using some code generation tool or even develop his own tool.
And that is basically what happened to me like eight years ago. I developed a tool that generates probably not as much as you intend, but at least the model layer, basically the classes that access where the information is stored.
And you just give the tool definition of classes that you want to use with all the variables that you need, relationships and validation rules and then it generates a code that accesses the storage container which eventually is SQL based database.
And it generates several things like a definition of the schema because prior to that I developed a database abstraction layer that makes it all independent of the database, you can switch the databases, and it not only abstracts the access to the database but also abstracts the manipulation of the schema.
So you can define a schema in XML format, could be anything else, but in this case I've chosen XML, and with all the fields of the tables and of the database, and it installs the schema, and next time you need to regenerate the schema you change something in the XML definition and it just performs the changes of the database without disturbing the actual data that may be already there in the database.
And this database abstraction layer is named Metabase, and the code generation tool is named Metastorage, and I developed this to solve my problems. It basically generates code like I would do to solve those problems that all web applications based on database need to do with all the functions that I need to use in the application.
And I developed this and made it open source, and what was interesting to notice that most developers are not very interested in code generation tools developed by others because ultimately they don't like the style, the formatting
And this code generation tool that I did even not only generates well indented, well formatted code, but it would even add comments to the code where appropriate, so whoever goes in there and analyzes the generated code actually understands what it does, so still that was not sufficient to make interesting.
And this is something that gives me a lot to think about, probably most developers suffer from the NIH syndrome, Not Invented Here syndrome, that prevents them from using code generated by programs written by others.
And, I don't know, when you analyzed other solutions before you implemented yours what was if you had a similar feeling regarding the existing solutions?
Jason Roberts: Well, the existing solutions that I saw were of course really high priced enterprise solutions, so they really... and it wasn't that they didn't do a good job of, I don't know, I don't even think they... I'm not sure how much access they even gave you to the generated code. I think they had some callback functions, some events that you could handle that you could override.
But I don't know, I mean I know there are some things like PHP Maker and PHP Runner which allow you to generate some code, which kind of sounds similar to what you described with Metastorage, but I don't know, I mean I completely understand that, I mean I definitely suffer from Not Invented Here syndrome just like everybody else.
Manuel Lemos: We are all sick.
Jason Roberts: Yeah, and I think part of the thing is that's why in one sense I don't really want to target developers because developers are a pain. We're a persnickety bunch, we don't want to pay for anything, we don't want to use anyone else's stuff, so why would I really want to create a product or service for that group of people, they're not very good customers.
So, I'd rather target designers, people who are maybe founders but not that technical or limited in their technical ability, business analysts, people who want to build something, they're the kind of people who could set up an excel spreadsheet, no problem, configure their Gmail filters but they're not going to be able to write an entire web application.
And now you're giving them a tool that, or you're giving them a solution where they had none before, and I think one of the key... what I'm trying to deliver is not just a tool but a solution, so if you say well here's something that's going to help you build your web app, it's not going to give you everything but it's going to help you, then people are kind of let down because then they still have to learn a whole bunch of other stuff and it's just not going to solve the problem entirely.
And I'm hoping at least for the simpler applications, simpler class of applications, you can do everything. You can generate the entire thing. But for more complex ones you could easily call a coder in and say, hey listen, I need to do these two or three other little things and it would be easy for a coder to come in and make those changes, override some functions and tie it into some other existing systems or whatever.
So that's one of the reasons I don't want to target the programmers, I wouldn't target myself for that reason.
Manuel Lemos: Right. I think you're right in that decision because if you don't feel you have the demand on that side of the market of the developers in general, you should focus on the part that actually you think could be interested in this because to be a timesaver, a money saver.
And it's just interesting to notice that somewhat we all think alike, we developers think alike and we probably would not use much of what others did if we could unless it is a miracle solution. There are some code generation tools for not actually this purpose.Iin PHP I don't know if you know the Lemon parser generator?
Jason Roberts: I don't think I've heard of that, Lemon parser?
Manuel Lemos: Lemon is actually not PHP, not a PHP project, it's a parser generator for parsing languages, code in certain syntax and generating code to parse that code. It's usually has a lexer and a grammar tool like YACC and Bison and all those tools.
And this Lemon implementation which is used, I think is used in the latest versions of PHP to generate the core code that parses the PHP code. And there was a version written, a port to PHP to actually generate PHP code, if I'm not mistaken it was written by Greg Beaver, and the project I think is available in PEAR. Well, I'll post a link in the show notes if you want to take a look.
I've heard about it because there is one regular contributor at PHP Classes site, Cesar Rodas, that wrote a parser for the Django templating syntax, so they can use Django templates. I didn't see anything special in the Django templates, it's something similar to Smarty templates. And he developed a parser for that Django template system, and generated at least part of the code with PHP port of Lemon parser.
And I think for those things for parsers which if you have to develop by hand it's a really boring task, and to be time consuming not just to develop the first version but any upgrades that you do to the syntax of the language, it is probably a more interesting thing than generating database form access code.
And I think code generation in general it's not something to be wasted, and I think people should, developers in general, starting with myself, be more open minded to when considering those tools that exist especially if they are mature and very capable.
Jason Roberts: Right. I think that's why generators are so enticing because it eliminates all that really boring repetitive work. And I have ideas for dozens of interesting web applications I'd like to build, but there's just no way that I'd have the time or even the interest in building them all from scratch.
And I was like you know if I could generate most of this thing and then just write the interesting code that would be awesome. And that's what I think if you have a tool that's powerful enough that allows people to do that then they might be able to get over the fact that some of the code was not written by themselves.
But I'm also hoping too that like if you target all the people who are part of the application development process, or the people who sponsor the project or the people who design it or test it or conceptualize it, and those people get excited about using the tool like AppIgnite, then the developer will kind of get pulled in reluctantly at the end, right, because it's like oh we generated this whole thing we just need the custom callback functions that we need to... we want to validate this thing based on some external database thing, and the programmer will be like oh, yeah, okay fine I'll do that, and then they'll realize oh yeah this actually this does work.
That's kind of my hope you know, just so like they say sometimes the way you get a new product or service into a corporation it's rather trying to sell it from the top down, it's going to the executive management, everyone at the bottom starts using it on their own and all of a sudden the managers come by and they're like what tools are you using and you're like, oh, just put this on the credit card, the corporate credit card, and then they start using it.
And I'm kind of hoping I might be able to use a similar trick in the development process because you get the people who can't write the code using it and then the coders themselves start, you know, get sucked into it.
Manuel Lemos: Right. Well, basically I think secretly many developers that reject those code generation tools are sort of afraid of being replaced by a program that does all the work for them.
Jason Roberts: But you know what the thing is though they just move up stream, right, I mean we're all smarter than if required to do the task.
Manuel Lemos: Yeah. You don't program in assembly language anymore, right?
Jason Roberts: Yeah, do you really want to write over and over code stuff that's sticking stuff in a database taking it out and validating it and putting it on a list and sorting it, I mean come on, we've written it thousands of times, it's boring, you always make mistakes, it's cut and paste; wouldn't we like to have that done and then you get to write all this cool new interesting stuff that a code generator doesn't provide yet.
Ernani Joppert: Basically web applications can become way more than create, update and delete application, based application, right?
Jason Roberts: Yep, exactly. And I think all it's going to do is it's just going to raise the bar on what web applications can do because now, as the tools become more powerful we see better and better web applications, and so to get users they're going to do more interesting, more serious things which the generators can't do, and the generators will, they'll always do the most boring tedious stuff and then allow humans to do what computers suck at; we get to do the really interesting stuff.
And I just think it's dumb for humans to spend their time writing stuff that computers can do just as well if not better.
Manuel Lemos: That's what most compilers can do nowadays. Well, so when do you think you'll have a version available at least to a part of the audience?
Jason Roberts: Yeah, on the TechZing Podcast I talk about updates, and I initially was planning to have something at the end of the summer and that slipped a little bit. So I'm hoping to have something this fall at the very least. Hopefully it won't be the end of fall but sooner.
What I just don't want to do is release something that's going to suck, like they're going to login, there's going to be too many errors.
Manuel Lemos: Don't worry, it's always going to suck somehow more or less.
Jason Roberts: Yeah.
Manuel Lemos: All projects suck in the beginning.
Jason Roberts: That's true and I am a believer in release early, release often, I just don't want to... I want to at least be fairly confident that for most things it's not going to be break and people are going to be confused.
And I was just trying to get a few things sorted out first, like one of the things I wanted to have it do was be able to automatically generate the API so you can have a REST... an automatically generated REST API for your application.
Manuel Lemos: Right. Will your target market use that REST API?
Jason Roberts: Not necessarily, that's a good point, but I was kind of tying this stuff on with the pretty URLs as opposed to having... I'm sure you guys know what I mean when I say "pretty URLs", right, sort of REST looking URLs where you don't have these long query strings.
Ernani Joppert: Yes.
Manuel Lemos: Right.
Jason Roberts: And I was trying to get that stuff sorted out because it was sort of related in terms of how the APIs would look, and I wanted to get that sorted out early because if the URL stuff required a significant reorganization of the code base I wanted to get that sorted out now.
But, yeah, I'm looking towards probably within six weeks, two months kind of range, and at the longest get something out there and get my beta testing going.
Anybody's interested in beta testing AppIgnite go to appignite.com and just sign up and leave your email address. I want to try and get a few hundred people in before I go to a public beta.
Manuel Lemos: Right. Maybe the audience of this podcast is not exactly the audience that you are targeting but I think it probably helpful if some of the listeners go there and start trying things just to give you the initial feedback so you can see how it goes.
Jason Roberts: Right, yep.
Manuel Lemos: Okay, it was interesting to talk about your application, also the code generation aspect.
PHP Performance Optimization talk by Rasmus Lerdorf (39:42)Manuel Lemos: But moving on to another section of our podcast, commenting about some things that happened lately in the PHP world.
I would like to comment about a talk that Rasmus Lerdorf, the creator of PHP gave at Digg headquarters. Digg, for those that are not familiar is one of those sites that lets you submit news and has the users to vote on those that are very interesting, and they use PHP if not for all for many, many tasks that they implement in the site.
And Rasmus gave a talk there about aspects related with the performance of PHP. And it was very interesting; he mentioned a lot about WordPress because WordPress is probably one of the most, if not the most popular PHP applications, it is one of the most popular.
And he used WordPress as a test case also to try the Facebook HipHop PHP compiler because HipHop does something interesting which is some static analysis of the code, and it turned out to be a useful thing to detect bugs, code that probably doesn't make sense but is not invalid. And it was very interesting. I don't know if you guys watched that presentation.
Ernani Joppert: Yes, Manuel, I did and it's nice to see how different people have different approaches to define common mistakes or performance analysis.
And given that Rasmus is a Linux developer, was also useful from the standpoint that the tools that he uses are not familiar to Windows developers and Mac users as I am right now. So it gives a better understanding of how PHP works itself.
I recommend everybody who is into PHP to watch it. And it's also nice to get a brief overview of how Hiphop applications should be taken into account and where are really the key aspects of performance improvements when basically using HipHop with your application.
Jason Roberts: Manuel you mentioned when we were speaking a little bit briefly before we started recording the podcast, you said that Rasmus slammed WordPress code. What were you saying about that?
Manuel Lemos: Well, basically when he used WordPress to show problems in the code that could be spotted using HipHop and also Valgrind, and the initial intentions to detect where there are bottlenecks and problems in the code in general.
It was interesting that he spotted some bugs that, without trying to offend anybody, made whoever wrote the code look stupid because of very obvious distractions. But I think it is code that could be written by any of us that is something that we wanted to write but wrote something else, and in the end did not turn into an easy to detect bug.
And it was interesting that Rasmus showed that in the code. From what I've heard, I don't use WordPress myself for any of my sites, but from what I heard from people that use WordPress I think Rasmus submitted a large patch to WordPress including to make it work better with the Facebook HipHop compiler, so people that want to run an optimized version of WordPress could use that compiler.
He also tried to compare the performance of code generated, the applications generated by PHP code compiled with HipHop with code that runs by the regular PHP engine, and it was interesting that he detected a situation where the compiled code by HipHop was not as fast as the PHP code run by the PHP engine, the Zend engine.
And it turned out to be a problem that most people are not aware when you, for instance, when you ask the system what time is it, for instance the call time(), and the other calls that rely on the information about the time zone that you want the time, it turned out to be a problem that slowed down the PHP code a lot because it was making a lot of system calls just to get the value of the time zone system variable.
And in the latest versions of PHP, I'm not sure, I think it was PHP 5.2, there is now a warning that forces users to set the default time zone. This prevents the PHP code has to query the system, make system calls just to know what is the time zone because it will assume a default, because the time zone and it will not change during the execution of your script.
And once is set that variable I'm not sure if... or make those calls to the system not necessary, the Facebook HipHop compiled code became much faster, actually somewhat faster than the PHP engine, and this is very interesting.
Another tool that uses Valgrind, I don't know if you are familiar with Valgrind...
Jason Roberts: I've heard of it. I've never used it. What did he say about Valgrind?
Manuel Lemos: Well, Valgrind is basically a tool that analyzes a sort of logs of profiling. And when used code that was compiled with profiling options you can generate the file and then pass it to Valgrind which is a program that can analyze the points in your code that it was run, and then generate graphs, all sorts of graphs with information of how much time was spent in certain sections of the code so you can detect bottlenecks, so you can concentrate your efforts of optimizing your PHP code just to those sections of your code that are making a greater difference.
And that is very interesting. I think if I'm not mistaken I think it's the Xdebug extension that supports the generating Valgrind files that you can use to help you to guide your efforts in optimizing your code.
I have actually used this combination of PHP with Xdebug and then Valgrind to analyze code because some time ago I needed to develop an HTML parser that does a lot of things, not just parsing but also making some security analysis using a DTD to validate the HTML code.
And to do it all in pure PHP is quite performance intensive. So to prevent that it becomes too slow I used Valgrind to detect the points in the code that will be worth investing time to optimizing the code, and it was useful to do that, but actually I wonder if either of you guys have used Valgrind or similar tools?
Ernani Joppert: I've used Rational Purify in the past, and it's for memory leaks and source of code analysis and profiling, and also some profilers in Java that pretty much does the same thing.
Manuel Lemos: Right. Well, Valgrind is actually not language specific. Any system that can generate profiling files in Valgrind format could be used. In this case Xdebug extension written by Derick Rethans can do that.
So I thought it was interesting to notice. Later I'll post a link in the show notes so people can watch this presentation. It's a video, you can actually see some interesting data on screen of the results that Rasmus reached about this.
And I think that will be useful for everybody that wants to optimize their applications if they actually have bottlenecks that will be worth spending time optimizing they can watch this presentation and start learning a bit more about these optimization techniques.
PHP Programming Innovation Award nomineed of July 2010 (51:31)Manuel Lemos: So, now moving on with our podcast I'm going to have a regular section of this podcast, one which I will be commenting about a few classes nominated to the PHP Programming innovation award that goes on every month in PHP Classes site.
We will be commenting about classes nominated in July, they were voted in August so in September it was announced the results of this month award. Any classes that either of you guys would like to comment on?
Jason Roberts: I'm looking at the Redirection detector, have you seen that on. I am looking at the right one?
Manuel Lemos: Yeah.
Jason Roberts: Number six, yeah. That looks interesting, have you experimented with that one Manuel?
Manuel Lemos: Well, in theory I experiment them because I have to moderate all packages that are approved here. And it's interesting, it does something that sometimes it's necessary, it's not very obvious. Sometimes it's just pages are redirected with the location header, but other times that is done with a meta tag that refreshes the page and so to know what is the page that it is redirecting you have to actually parse the page and sometimes that could be useful.
Jason Roberts: Yeah, that seems to be kind of useful to me. I was actually working with some redirection issues, that doesn't solve my exact problem but that seems to be kind of useful. Some of the other ones, like you have an Equation, like evaluating and rendering polynomial equations. Does that just do... that draws the actual graph of the equation?
Manuel Lemos: Well, it basically generates the HTML.
Jason Roberts: But does it generate the... what's the output for the graph itself or the image, does it use like the image drawing, the PHP image drawing library?
Manuel Lemos: It's not very sophisticated but it does something that there was no class before here to do which is to render the polynomial equations, and for people that work with math that want to render these type of equations it might be useful.
Jason Roberts: Right. Yeah, I thought that was pretty interesting, and People, which is what, to manage the user accounts?
Manuel Lemos: Yeah, this is a more complex component. It's basically a user interface and actually database access to manage user records of all sorts of contacts, not specifically just the user information but the contacts or the type of contact with another person, if you have a phone number or if you have a cell phone, email.
And this component provides a solution that actually generates a user interface for managing those user contacts. It's from an author, this Michael Furman, that has supplied several other components all in the same, with the same consistency.
And there is another one that also for him, in previous months there are others, one that in this month that we are seeing July, it manages lists of tasks as in a To do list.
And these components are what I call application level components. They do not do just something basic, they do more complex things that may consist of database access to manage database records to show or manipulate the information that is being displayed, in this case there is one for managing user contacts and another is for to do lists, and there are other components from the same author for other purposes.
If you ever want this level application component in your applications you may want to try these so you can save some time to do things that are often they are common, but if you do it from scratch it will take some time for you.
Jason Roberts: So how are the winners chosen?
Manuel Lemos: Well, by the end of the month these classes are published, I nominate them. It's a simple rule, if they do something that is innovative and there is no other class in the site that does what the nominated classes do they will be nominated, And in the next month the users vote on the ones that they think they are more interesting or whatever is their criteria.
Ernani Joppert: The polynomial equations is my favorite because I tend to love mathematics and I've been writing some text, LaTeX documents in the past that is very useful for displaying formulas and stuff and in order to see this producing raw HTML, although it's simple and it's not very sophisticated the way it was done, it does the job pretty well and has my vote.
Manuel Lemos: Yeah. Your comment Jason?
Jason Roberts: Well, I don't know, it seems like there's kind of a large range in like complexity here, so like the equation renders significantly simpler than say for instance the people that manage user accounts.
I mean I just thought at a superficial level, maybe I'm wrong in looking at them, because the managed user accounts it seems like that would be very useful for more projects because that's such a common theme for most web applications where I would think the equation render would be sort of rare that people need to render equations, maybe I'm wrong.
The Password meter, is that something that's Ajax? Because a lot of times what's really cool is when you're typing in your password and it's either turning red, green, or yellow, depending on how secure it is, or is it something that has to refresh to test?
Manuel Lemos: From what I remember, I'm not looking at the code right now, but it just does that task that evaluates whether the passwords are strong or weak.
Jason Roberts: It seems like a pretty easy thing but it actually seems fairly useful.
Manuel Lemos: Right. Well, as I mentioned, the rule to be nominated is to implement something that was not provided in the site before. It may have been provided in some other site, but sometimes that's what happens, some classes may be simple but they are quite useful for whoever voted on them, so they voted because they appreciated something that does what they do, and that is the logic of this contest.
Anyway, so you understand better this contest, the fact that the class is nominated is already sort of a win for the author because what happens after being nominated is in almost all cases the author has the right to choose a prize from a sponsor, and the site has so many sponsors now that there are many interesting prizes to choose from.
And other than that is the recognition that the contest provides to the nominated authors, so if they do not get in the first place maybe it's not the most important thing but it's still useful.
And other than that, I don't know if you wanted to comment on any other classes. I also think that this password meter class which is truly quite simple, it just follows some simple rules but it's still very, very useful.
Maybe I should implement something like this in the site to prevent that users who use passwords that are too simple that may prevent that their accounts be abused, but so far I didn't get to a point that I think it would be a priority, but maybe in the future.
Jason Roberts: I'm curious about one thing, and this is a question for PHP Classes in general, do you have any requirement or style guidelines for the submission of classes?
Manuel Lemos: No, no, this is something that it would be impossible to ask people. Well, there are other repositories that impose their own rules, but what happens is that the number of contributions is very restricted precisely because of that.
So, I wanted to when I created this site I wanted to have a site that need not want to impose style rules because people's code vary in style a lot, and just because the code is not in a specific style it does not mean the style is wrong, as long as they use it consistently.
And I use my own style consistently and if I wanted to submit to some other repository that imposes style rules it will probably not be accepted, but the fact that it would not be accepted it would not mean that it would not be useful to others.
I've heard some complaints about other authors that they like PHP Classes site because it doesn't impose those restrictions. On the other hand there are people that complain that each package has its own style and the site does not do anything about it. I think it's not the purpose of the site.
And I'm curious from your perspective obviously you read through a lot of different PHP from a lot of different authors, I mean are the Zend style guidelines generally considered the standard or is there no standard, is there no sort of consensus at all about how to name your classes, what to capitalize, where to put your braces, all that kind of stuff.
Manuel Lemos: Right. I'm probably not the best person to comment about it. What I think for an author to comply with a style that is not so similar to his own style is really annoying, it's like telling somebody that writes with his right hand now you have to write with your left hand, it's kind of impossible.
But if you want to make that effort to actually generate code that is compliant with a certain style probably it will be worth thinking about a certain style. I think if I am not mistaken that Zend style guide was based on PEAR style guide, and probably with some differences, but as I mentioned I'm probably not the best person to comment about it because I do not follow any of those styles.
But I remember a long time ago that.... remember I mentioned that package, the database abstraction named Metabase? In the beginning I thought it will be useful because there is no other package that performs such a level of database abstraction, not only to the access but also to the managing database schema.
I thought about submitting it to PEAR because it lacked for a database abstraction layer that, as I said, provided this level of abstraction mainly focused on portability of code, and I remember that there were big, big discussions because... well, basically politics.
It was a very long time ago, I do not remember the exact details, it's probably all archived somewhere. But what happened in the end I suggested that somebody ported the code to the PEAR style guide because it had tens of thousands of lines, I would not have the time or the patience to do it.
And eventually it was done by Lukas Smith, he converted the Metabase to PEAR style, it was called PEAR MDB, which was a sort of merge of Metabase with PEAR DB, and then there was a follow-up package which was not backwards compatible, named PEAR MDB2.
But there was quite a great effort to make it compliant with the PEAR style, and as expected it introduced some bugs, code that was not well interpreted during the conversion, but over time I suppose they have fixed if because it was many, many years ago.
The good and the bad of the PHP Classes site according to Jason Roberts (1:07:11)Manuel Lemos: Okay, but moving on with our podcast now towards the end, we have also a regular section on which I invite the guest, in this case Jason, to comment on a couple of things about the PHP Classes site, one thing that you consider to be good and then another thing that you consider to be bad or not as good. So what would you like to comment?
Jason Roberts: Okay, I would say that I think probably the biggest strength of PHP Classes is just the depth and breadth of the classes you offer. I mean there's so much here. So that seems to me to be the best thing about it is that you really created a true repository.
The thing that I find the hardest to use about the site is it seems like I get a lot of redirects when I'm logging in, or before, it seems like I have a hard time navigating or seeing stuff unless I'm logged in. So it seems to me that you should be able to... I mean maybe I'm using it wrong or something, but I just feel like the navigation process and login process could be a little less obtrusive. Does that make sense, is that something that makes any sense to you?
Manuel Lemos: Regarding the positive thing that you mentioned it's sort of consensual. Basically it is the long tail of the PHP components. When you provide something that attracts many, many contributors, it almost has like near 3,000 contributors, it's a lot more than the double of the actual number of contributors of the PHP project, and that's sort of the result, so I'll say it worked well.
Actually one thing that helped was this Innovation Award that encourages people to contribute packages that are innovative rather than yet another MySQL database abstraction class which still appear once in a while, but with this encouragement people fortunately have been sending a lot of innovative packages that are for all sorts of purposes.
As to the login comment, this is something that is commented to the lot because it really makes people a little uncomfortable, some people more than other, others got used to it. And, I don't know when was the last time that you accessed the site; do you recall, was it recently?
Jason Roberts: I can't remember one time when I logged in versus when I've used it, I mean I've definitely been on the site recently, I can't remember the last time I logged in thought if that was... so I'll login right now.
Manuel Lemos: Was it less than one month ago?
Jason Roberts: It may have been, I'm not sure, I'm looking at the login now, so I'm trying to... yeah, I can't remember; I can't remember how long ago it was.
And because of that I didn't want users to create new accounts to access the new site. So I implemented a single sign-on system based on the OpenID protocol. And it is all based on redirects, and it requires a lot of verifications of cookies that are sent back and forth.
And lets say the process is not finished, it still has plenty of room of improvement. Some things are not yet solved because now there are two sites, the site where you have your account which is a site under the Icontem domain and the PHP Classes site or the JS Classes site, and there are redirects back and forth because they need to securely exchange tokens of authentication.
But it's something that I'm working on regularly because since I launched this new single sign-on system many problems popped up that I was not expecting, so I have to solve them one at a time and it takes some time.
But your criticism, per se, it just goes along with comments of many users, some come by mail, others by Twitter, that criticize that aspect that some people say that now it shows too many proceed links and that is a bit annoying.
I'm aware of the problem, I'm working on it, and over time it will improve, so it was just a coincidence. I asked you if logged in before more than a month ago because that was when the single sign-on system was implemented.
Jason Roberts: Right. Yeah, well, I just logged in now and it seemed like it worked pretty well.
Manuel Lemos: There are problems with it that I did not expect and the browsers take them not very consistently. Some browsers allow you to set cookies from within an iframe, others don't, and when they don't I have to show a message for the user to click on a link and that's where the proceed messages you are seeing came from.
Jason Roberts: Right. Let me ask you a question, too, I'm just curious how long has PHP Classes been around, I mean I can remember this, you've been around probably six or seven years by now haven't you?
Manuel Lemos: Actually it was started in 1999.
Jason Roberts: Yeah, so even longer, okay.
Manuel Lemos: It's old.
Jason Roberts: Wow.
Manuel Lemos: It's a lot of time. I started in '99, but only in 2001 I started dedicating to it as a full time job. Some people do not believe me but I do not have a second job. I work on this full time. I feel privileged to be able to work on my own project full time and live from it. I don't need or even less want to have another job.
Jason Roberts: That's fantastic, yeah, that's fantastic.
Manuel Lemos: That was something interesting that I noticed from all entrepreneurs, if I can call myself an entrepreneur, is that all of us would like to be able to work full time on our own projects. Maybe I'm not getting a millionaire from this because the market is not that large, but ultimately I feel privileged precisely because of that I can work full time on my own project.
Jason Roberts: Yeah, that's fantastic. The only thing I was curious about the design is you know you have different types of ads, like you have kind of the Google AdSense ads and then you have a few different kinds, I was wondering if you kind of like consolidated it to one are like down the right side or something.
Have you experimented much with your ad placement for, I don't know, just in terms of screen real estate being able to see information easily and to be able to show ads in a way that it's more so consolidated?
Manuel Lemos: Right. Advertising is something that nobody likes, but unfortunately what was, well, fortunately now it's not the main source of revenue, and hopefully I would like to eliminate it completely but currently I can't, although things are getting better in other sources of revenue, namely the premium subscriptions and the job offers, but it's still not large enough so I can get rid of advertising. As far as the placement of the advertising basically that's where Google tells us to.
Jason Roberts: Oh, really, okay.
Manuel Lemos: Google, they do not impose it, they just recommend that we put it there because most of the ads are pay per click, and if users do not see them they don't click. If they don't click I don't make money, so it would be a waste of time.
But the advertising itself is one of the greatest sources of complaints, not only because it distracts the users but also because it slows down the loading of the pages.
I would like to study to defer the load of the ads until the whole page is completely loaded, but that is just an idea that I am not sure it will work. Probably the ads will appear too late and have not been seen, but it is an idea that I've been thinking of.
As for the style and the placement of the ads I was tipped actually very recently these days, and user has commented about trying another ad network named BuySellAds to replace the current ads which are mainly Google AdSense by another type of ads which are probably more visually attractive and they probably work better.
Well, as I mentioned, if possible I would rather eliminate the ads because nobody likes them, but until that is possible maybe a solution of ads that are probably more appealing and as long as they pay more than the current ads in the site I'm all in favor of that.
So just these days I have signed up with BuySellAds and I'm still trying to make time to actually experience with that network, so lets see what can be done in terms of improving the ads.
Jason Roberts: Right. It's interesting. I have a question about the premium, what do your premium subscriptions do? What do they provide?
Manuel Lemos: Well, premium subscriptions are actually the A plan for trying to make a living from this site. I have planned them from about 2002, and they implement services that somewhat make the site better for the users.
And originally I took suggestions from users, things that they would pay to actually use. They would pay a subscription to benefit from those services, and they are a variety and there are several services. One of them is not exactly a service, but one of them is getting rid of the advertising. If the person is paying it makes all the sense to take the advertising out.
Another benefit is that you have a sort of recorded searches, you can record a search, let's say if you are looking for all components about Facebook but you don't know when they will appear, so you don't have to poll the site all the time to see if there are any Facebook components, you can record the search and when there is a new component about whatever you searched you get an email telling you, oh, there are these new packages or these new forum comments or these new blog articles in the site about this topic that you are interested in.
And there are others, anybody interested can check the phpclasses.org/premium, and one of the benefits that seems to have been more successful is that you have an early access to the job posts that are sent to the site.
The site can take a job post, you can either post a job for free or you can pay a fee and the job will be posted immediately. If you do not pay the fee the job will be posted and made available only to the premium subscribers first, so during three weeks that job will be only accessible by premium subscribers.
And it turned out to be a good incentive for increasing the number of premium subscribers. So it's something that I learned that is working probably better than anything else that is made available to premium subscribers.
It is interesting because prior to this business initiative I did not have a clue what it would be like to put a business to work, and slowly I'm learning from my own initiatives and also mistakes, and it's quite interesting. I think it's a normal process that every entrepreneur goes through but I find it interesting that it is actually happening to me.
Okay, well, this has been already quite a long podcast, I don't know if you have any final comments you would like to make.
Jason Roberts: Well, I've really enjoyed being on, it's been a lot of fun and I've used PHP Classes for years so it's really been cool to talk to the guy who runs it after all these years. You know because sometimes you use these applications web sites for a long time and you don't really have any idea of who's behind it, so this has been really kind of a unique experience to see the behind the scenes a little bit.
Manuel Lemos: It's curious some people actually know me because of my components in the site, but they don't know that it's actually me that is running the site.
Jason Roberts: Yeah, you need to put your face up on like the header so they constantly look at you.
Manuel Lemos: But nobody knows my face.
Jason Roberts: What was it, like some of the stories from sites like Tagged or something, like the founder he was your friend no matter what, so he was like your first friend.
Manuel Lemos: Oh, okay, yeah.
Jason Roberts: It's like you'll be everybody's friend on PHP Classes.
Manuel Lemos: What is interesting is some people think there is a large corporation behind the PHP Classes site running this site because it provides a lot of things, and they are very greedy because they put a lot of ads in the site and they want all the money.
And in the end it's just a regular person that is trying to make a living from a site, and the best that he knows is being the good way or not so good way, but it's an effort. But it's interesting the perception people are getting from the site and whoever runs it.
Jason Roberts: I actually have one last question for you, have you seen a change in or growth in PHP, the number of PHP users, because it seems that six or seven years ago there was ASP and PHP kind of, and JSP I guess, and they were displacing Perl at the time, and over that period of time Python and Ruby have obviously made big inroads. Have you noticed any change in sort of the number of users or the growth of the site over that period of time?
Manuel Lemos: Well, looking at the PHP Classes site I really could not come to any conclusion because I'm not comparing with any other language community, but from what I've heard PHP gets stronger and stronger.
Obviously those languages that are more polished like Java, Python and Ruby, they have a certain appeal I think to people who already have a college degree, and I don't know if that is a significant number of developers.
I know PHP has been growing a lot for instance in countries like India. Actually India has already surpassed the number of users that was before led by the United States, but that doesn't tell anything of how PHP has grown or not compared to other languages, it's just a detail relative to the PHP community itself.
The perception that I have is PHP is getting larger and larger and is having more and more acceptance even from companies like Microsoft that have their sort of competitor languages. So it is interesting this evolution of PHP, but if you ask me if the success of PHP is the language itself I don't think it's quite the case, it's probably more the applications like WordPress and Joomla and Drupal. Drupal is quite big, probably WordPress is bigger but Drupal is quite big from the number of job offers that I see appearing.
Ernani Joppert: Yeah, and not forgetting PHPBB which was the most often used forum, even Java community you could see...
Manuel Lemos: Right. I don't know if PHPBB is still big, probably for forums there... probably Joomla or other content management systems that include forums are probably being used more nowadays.
I don't know what exactly is the share of those systems, but I'm just talking about from the perception that I got from the job offers. Most of the times what I see is WordPress, Drupal, and Joomla. And the requests for the jobs of these applications is even more than any other PHP framework, for instance if you think of the Zend framework and the Cake or CodeIgniter or others, they don't have as much demand as those CMS.
Jason Roberts: Right, right. I guess that's probably because the CMS' are just more common, it's like WordPress or something, and since that there's many more people who need just something that's simple to manage a web site of a certain type. And Joomla, Joomla is based more for education isn't it?
Manuel Lemos: Well, actually I wouldn't be able to tell because I never looked at those systems more closely, but it seemed to me to be a general purpose contact management system.
Jason Roberts: Okay. Maybe I'm mistaken.
Manuel Lemos: Probably you are thinking of, oh, I forgot that there is one system that is for e-learning that is also very popular. It's not so popular or else I would remember the name, there are no job offers for that system, but I think I know what you are thinking about.
Jason Roberts: Right, right.
Conclusion (1:30:25)Manuel Lemos: Okay, if nobody else has anything to comment I would like to thank Jason for your presence, I hope also next time Justin can make it to the podcast and also to talk about this project. And I think that's all for now.
Jason Roberts: Well, thank you very much for having me on the show. It's been great meeting you Manuel. And is it Ernani, am I pronouncing that correctly?
Ernani Joppert: It's Ernani.
Jason Roberts: Ernani, I wanted to make sure it's Ernani. And Ernani it's been great meeting you too, so thanks again for having me on.
Ernani Joppert: Yeah. Thanks everyone as well.
Manuel Lemos: Okay, bye, bye.
Jason Roberts: Bye, bye.
Ernani Joppert: Bye, bye.