One Classic Article - Transcripted ---
Manuel Lemos: Hello, welcome to the Lately in PHP podcast, this is episode 23, and this time we're starting something new, an experimental thing which is basically to record and actually transmit the podcast recording live to whoever may be attending.
Pprobably this is not the best day to record, only Ernani came here to the podcast. Hello, Ernani, how are you doing?
Ernani Joppert: Hello, Manuel, I'm doing great, lots of things to talk about, I'm glad to be here and see if this goes as a different experience.
Manuel Lemos: Yes, it certainly will go, actually we already recorded the...
Ernani Joppert: The JS Classes, right?
Manuel Lemos: Right, the first edition of JS Classes...
Ernani Joppert: Oh, I see some little elephants there.
Manuel Lemos: Right. Basically these are the well-known PHP mascots, actually there is a big one and a small one, but actually as I mentioned previously, there will be a new one which will look like the original PHP mascot.
Ernani Joppert: From PHP Classes.
Manuel Lemos: Right. PHP Classes mascot, I'm trying to show it in the screen, this is a prototype, this is not the final version of the new mascot. In the end it will look like exactly as you see in the PHP Classes site.
This is just a test, they are still iterating, and hopefully it will look much closer to the logo used in the PHP Classes site which is basically a creation of Ifat Amit, a lady, that created the current design, the current theme of the PHP Classes site.
Manuel Lemos: And, anyway, we are actually moving on to the actual podcast, and today we have several topics, several interesting topics to talk about starting from the just released PHP 5.4.1 that was released yesterday, today is already the 27th, and yesterday it was released both PHP 5.4.1 and the PHP 5.3.11.
Well, there is not much to say about these revisions of PHP, probably the greatest new thing that was introduced is the support for Apache 2.4 which was not previously working, the build was not working with that Apache version, but now it seems to be working, I have not tried it yet, but I actually intend to upgrade PHP 5.3 to this revision 11, and mainly because it contains a security vulnerability fix done by Stefan Hesser in a way that magic quotes are handled.
I do not use magic codes anywhere, but since it seems to be a security vulnerability it's always good to upgrade.
Ernani, are you already using PHP 5.4, are you planning to, what is your plan?
Ernani Joppert: Yes, I'm planning to do an upgrade, I'm still with 5.3-something, can't recall.
Manuel Lemos: Well, personally I'm not planning any upgrade anytime sooner than when I really need it, and at least for me PHP 5.4 does not provide anything that I really need, like traits.
It's interesting but I do not have a great interest in them, and PHP as it is is already good enough for me, I mean prior to PHP 5.4, but other people may want to upgrade. For instance, the use of the built-in web server which is mainly meant for development environment, it's interesting but you don't need to upgrade your version in the server.
Ernani Joppert: Yeah, eventually it can also represent a problem because when you're doing development you should develop within the host environment that you will plan to deploy, so if you use Apache then you have to test it with Apache, but I understand for small testings it's a valid improvement for the solution.
Manuel Lemos: Yes, I'm sure several people were expecting PHP 5.4 to be a release to use the new features.
Ernani Joppert: Oh, yeah.
Manuel Lemos: We don't know yet if it had great adoption, it will probably only have adoption on environments in which the developer somehow controls besides the version that is available, and we don't really need it much, but people that need it will take advantage of those features and will appreciate it.
Anyway, we talked a lot about PHP 5.4 features in past episodes, so there's no need to go through the features again.
Manuel Lemos: We are going now to move on to something else that has been happening in the PHP world, actually this month was sort of intense. I'm not sure if it was intense in terms of importance, but there was a topic that is discussed..
Ernani Joppert: A little heat.
Manuel Lemos: Well, a little bit, it's just a way of saying it was intensively.
Ernani Joppert: No, I mean a little heat on the topic, like on the discussion.
Manuel Lemos: Yeah. And the topic that I'm referring to is basically the proposal to have a sort of variant of PHP source file that does not allow those PHP start and end tags, so the regular PHP scripts are basically mean to be some HTML or something else, and with PHP embedded on it using those PHP start/end tags.
So the proposal is to sort of, well, not exactly abolish because they still want to support the current form of PHP source files.
Ernani Joppert: It seems that this is an RFC proposal right, and they are trying to separate the mixed PHP with HTML and pure PHP scripts as far as could understand in order to facilitate some specifics on frameworks related code as well as naming conventions, etcetera.
Manuel Lemos: Yeah, well, actually that's probably the ironic part of the proposal because the proponents seem to want to stop people, or at least discourage people from mixing HTML templates inside the PHP or vice versa, whatever you want to see it.
And what they propose it to have a new type of PHP source file that only includes PHP code, and the current way of embedding HTML or some other kind of output in the middle of PHP would be disallowed.
And I think the ironic part is that many frameworks, many MVC frameworks they propose the use of PHP files, actually it would be HTML templates with PHP embedded on them.
And this somehow means that they still want to have that forever, embedded PHP code in the middle of HTML or whatever is the output from that. And anyway, we are just talking about this because the discussion was quite intense.
Ernani Joppert: Oh, yeah. And what would you think about having this adopted, I mean are you up to it or what's your preference?
Manuel Lemos: Well, personally I do not care because even if I was in favor of implementing a specific alteration in PHP engine to support those different types of PHP source code I probably would not care, but for those that want to use those PHP only code they can do it now, the only thing is that they still have to put those PHP start and end marks in their source files, so all this discussion because they do not want to put those marks.
Ernani Joppert: I mean I'm sure that there are some other important things to care about, right?
Manuel Lemos: Well, right, but regarding this proposal the discussion was so intense, I probably missed maybe some important arguments in favor of it, but the best argument in favor of it was that they sort of are concerned that sometimes use PHP start and end marks, and for an accident you enter an additional line break and that may break PHP code like, for instance, triggering the issue of the content type headers.
And, well, okay I understand that is a concern, it happens, it actually happened to me some time ago, but it doesn't happen to me every time, and I'm not sure if all this discussion is justified, it seems that somebody just started the idea and everybody also wanted to give their opinion.
There is not just one RFC, from what I counted there are at least three RFC's that basically propose the same, just a slight variants of the same idea.
I think because I really did not have much patience to go through all the proposals, but, well, for me it's like you said, I do not intend to use it, I'm not really concerned, I just wanted to mention it because there is this intense debate, and from what I could understand it did not yet end, and probably people will keep talking about it.
And it's just amazing how something that may not really be necessary to be part of PHP raises such a great discussion, actually a flame war, and, well anyway that's just my perspective, I don't know if you have a similar perspective.
Ernani Joppert: Yeah, I totally agree with you, I mean it should, those changes probably are useful for some people otherwise it wouldn't even be proposed, but yeah, normally changes within the PHP engine or the PHP core itself it's kind of problematic and it brings lots of ins and outs, and it's always a struggle in that sense.
Manuel Lemos: Yeah. Well, anyway, there were also other proposals despite this proposal itself took a lot of discussion there were other proposals that did not get so much attention, but I think it will probably be worth mentioning.
There was one that was sort of proposing, or at least reviving an old topic, discussion whether PHP function names should be case-sensitive or be case-insensitive just like they are currently, and the main argument in favor of making it case-sensitive is if you use certain characters to be represented in Unicode, UTF8, the upper and lower-case version of those characters is just not a matter of changing one byte.
And for me I just wonder, well, is it really something normal to write PHP code using non-ASCII characters? Ernani, I don't know if you use names in Portuguese in your code, but you don't, right?
Ernani Joppert: No, no, no, especially when there are special characters. I try to keep everything English, sometimes you just don't care and you write some variables names in Portuguese, but I try to avoid it.
And normally what I do is I use the spell correction tool just to make sure that it can understand everything, and I do this such as a reports tool for the code when I'm looking into the code. But, yes, I have never had the experience of having to write variables with special words or special characters.
Manuel Lemos: Yeah, well, for me this is a bit odd because, also despite my mother language is Portuguese which has some non-ASCII characters I never use them, actually I was not even sure if PHP supported non-ASCII characters in names, the functions.
Ernani Joppert: I don't think I've ever tried and never have used a special word or accents on a variable just to see if it works, I can't even tell.
Manuel Lemos: Yeah, well, I know that the original proposal of PHP 6 was meant to make this a common thing, if you wanted to write your code with variables and functions in Chinese you could, but, well it seems that the person that proposed this was concerned about these words in foreign languages that making the upper and lower to match names during the execution of PHP to see...
Ernani Joppert: Maybe they want to make the convention similar to what Java does with camel case script such as I guess Ruby as well requires that.
Manuel Lemos: From what I understood the idea is to avoid the overhead because if you want to see if a name is the same but with a different case you have to probably map all to lower case or all to upper case and compare the versions of the names.
And actually if you are using non-ASCII characters and you are using, for instance UTF8, some characters will be mapped to two bytes or maybe more in some idioms, some languages.
And I think the person in question wanted to avoid that overhead, but the problem is that it will cause major backwards incompatibilities, and this I don't know if that headache would be worth making all case-sensitive, and I think the main concern was to be performance.
Well, anyway, the discussion on this proposal practically died do I don't think it will go anywhere.
Ernani Joppert: Right.
Manuel Lemos: Anyway, moving on, another proposal that will probably go on because it seems to be useful and does not cause any backwards incompatibilities in PHP, is the possibility to when you call a function that has optional arguments you can skip some of the arguments and specify the last ones.
This is an interesting feature of PHP which probably makes it more flexible than other languages that do not have this thing, which is the optional values in the parameters, because this allows, for instance, if you want to evolve your code and now you want a certain function to have a new parameter you can add that parameter and assume the defaults so old code that used to call the version with less arguments would still work.
And the idea of this proposal I think it was from Stas Malyshev, whom is one of the maintainers of PHP 5.4, although this proposal does not seem to be related, is the possibility if you have several optional arguments, parameters to a function, in the call you can skip some of the middle optional parameters and only specify one or more of the last parameters.
And I can see certain cases in which this would probably be interesting because it would allow you to change the default values on some of those key parameters. And it seems the proposal got some acceptance and probably will be implemented in a future PHP release, well, we'll see. Personally I find it interesting.
Ernani, during your so-called day job you work more with Java, I suppose Java does not have optional parameters in functions, right?
Ernani Joppert: No, no, no, you have to specify them all. But in ActionScript you can specify some fields with a predefined value such as null, and if it's not passed then it takes the default, but Java doesn't.
Manuel Lemos: Well, for me it's very interesting, and I think it's one of the advantages that is rarely discussed, which is the possibility of those optional parameters.
Manuel Lemos: Okay, but moving on with our podcast, we are going to talk a bit about yet another discussion against PHP, there is this article with the title "PHP, A fractal of a Bad Design", which goes through an extensive list of I would say inconsistencies or things that you can say that in PHP are a result of something that was not well designed in PHP as a language.
And I think this discussion that showed up a lot in many sites, I think in the HackerNews forums it was discussed a lot, and when I found this article basically it was a tweet by Jeff Atwood, one of the founders of the StackOverflow site, and he is well known by his alias @codinghorror, and he has a lot of articles related with programming for which he has a lot of followers.
And I found a tweet by him that basically says that "PHP sucks but it still doesn't matter". Well, he says it still doesn't matter because in 2008 he already wrote an article precisely with that title in which he was commenting that despite all the problems that PHP has, PHP is a very popular language no matter what.
So from what I understood basically he was saying that it's sort of pointless to complain about PHP because that does not affect PHP popularity.
In my opinion PHP popularity came from the fact that it was a language created for creating web applications, and since the Web got very popular PHP also got very popular.
Other languages followed to provide better support for web programming, but they came out later. And other than that several killer PHP applications may be so popular that it's going to be impossible for any other language to defeat in the web field. I am thinking about, for instance, WordPress and others, other applications written in PHP that make PHP like a plague, you can't get rid of it.
And this is very interesting because although we PHP developers already know very well those deficiencies of PHP, we don't bother because we all got used to those deficiencies, so it doesn't matter for us if somebody claims with a well thought article with all the arguments against PHP because it won't change our minds, we work with PHP, we make money with PHP, and although we reckon that other languages are probably better designed, it will hardly make a difference for us.
And that was one point, another point is that all these articles that PHP sucks and PHP should be banned, or whatever are their intentions...
Ernani Joppert: Yeah, I guess this goes with the maturity level of the writer.
Manuel Lemos: Well, it's not just that, I think all these people that complain about PHP have an agenda to promote some other language.
Ernani Joppert: Yeah, oh, sure. And it's sort of a maturity thing as well because you see some analogies that they compare Yoda with etcetera, and then you see the drill, but it's not just that Yoda is something immature, but I'm bringing the funny part here, which it's like in order to be somebody you have to be a Jedi, and this is not a Jedi thing, and then you see the drill, you see the whole dilemma about who came in first, the egg or the chicken, and they go around and then you don't see much of a well concise frustration about it.
I mean, okay, there are better languages, but if you have to do it with a small footprint and you don't have RAM enough within your server to host a website and you need to have a blogging system write off the hand, or you need a forum, I've seen lots of other Java community sites which use PHPBB as their bulletin board.
Manuel Lemos: Right.
Ernani Joppert: So the point is there is no point in complaining about specific language otherwise there wouldn't be different languages, it's like complaining because you don't like to speak English or you don't like to speak Portuguese, and you never speak anything else, but it's ugly, and it goes nowhere, it's another language, so if you need to communicate with a team that only speaks French you will have to learn French or they would have to understand your English.
Manuel Lemos: But, well, what I think is that those people that are complaining for some reason they had to face a job on which they are mandated by their bosses, or whoever, to use PHP and shut up, and that's probably annoying them so much.
Ernani Joppert: Oh, I see. So they hope that writing these high-impact articles, well described with all the arguments against PHP, they hope that somebody sees the light and stops using PHP.
Manuel Lemos: Yeah, but it's like you working in Brazil and you don't like Portuguese-brazilian because you're from Portugal, and you complain because everybody here speaks Brazilian Portuguese, it doesn't make any sense, I mean you're in Brazil so you have to speak Brazilian Portuguese.
Ernani Joppert: Right. In Rome you have to be Roman.
Manuel Lemos: Yeah. And try to go to a certain country where they are very nationalistic about their rules, we all know that France has a very strict language rule, and it's very hard sometimes to get something out of them by just throwing out English because people are traditional, so they prefer to keep their patriotism.
Ernani Joppert: Well, in their country they are entitled to demand that everybody speaks their language, but if they are tolerant and if they are friendly they should somehow allow the fact is that not everybody knows French or had the opportunity to learn French.
Manuel Lemos: Yeah. Although if you go to France you should somehow learn the basics.