I was going over the Internals of the PHP developers and I really think that there needs to be a change in perspective on which features should be part of PHP. If it is up to vote, then put it up to vote for the majority of PHP developers. Those who develop in PHP and those who develop PHP. Why place such importance and decision on those who only write to the Internals mailing list? Reading the weekly reviews and Past Year reviews has bought up some really interesting features for PHP that were tossed out because either it was buggy or because more people voted it down than up. It appears that for any feature to gain support it needs (1) to have an already working implementation for everyone to test and look at and (2) support from the majority of the leaders and internal developers.
Doesn’t matter that (1) it is such a great feature that some PHP developers would look on it as an improvement over other workarounds or (2) that it would help gain further support in the outside community.
The machinery behind PHP has a certain perception of PHP.
- That PHP should only be used for quick (in their opinion) and maintainable web development and the features supported should complement that.
- That if you need speed, you should development PHP extensions.
- That if you need other syntax or features in other languages, you should use those other languages.
I know about the third point and people should learn other languages and use the best one. It seems reluctant on the part of the PHP developers to look aside from that many would rather use the other languages that offers better support for features and stay away altogether from PHP. PHP is becoming the classic ASP.
The reason I switched to PHP is because more importantly it was free and had a lot of free features that you had to pay for to use in ASP. There is almost no reason to use PHP, since the new ASP.NET is in my opinion better. I’m really debating learning C# and will probably do so over the Summer. Python is also looking damn sexy at this point and Ruby in some aspects, but I’ll rather learn Python over Ruby.
PHP is also losing a lot of great developers that use the language, gaining dissension from its current developers using PHP. Any language should look to security experts as Gods and worship the ground they walk on. I would kiss the ass of any security expert, just because they are elite. Anyone can program and develop awesome applications for OS and the web, but it takes a real expert to do security and know it well. When they leave, there will no longer be any advantage of using PHP and would be time to learn another language. ASP.NET I’m coming a knocking.
Really, I say this, but I’m unimportant. No one would miss me if I left. I suppose, but what about the rest of the developers using PHP? What if they left? Are they also not important? I doubt it. Like security experts, I would also kiss the ground of the users of my application. Without them, the product is nothing.
ASP.NET project to add support for PHP should be making PHP developers afraid. Holy shit! We have to be adding new features before we lose more users. If you can transition between two languages, many companies that have large applications in one language can do so. To switch between PHP to C# or VB.NET with ease and low cost overhead.
My Suggestion
Recreate the PHP Engine and start anew. Pull an ASP and refactor the engine with new features and keep the ease of development for extensions. Screw backwards compatibility and use a new name. PHPvolution Engine 1 or something less crappy. The only issue is that it would require the support of the Rasmus and the rest of the PHP maintainers for it to include PHP in the name. Revolution Engine for PHP would work, if “Revolution” wasn’t used already.
It is radical, and yes would require either a lot of developers or a lot of time to finish. Why not start now? I just wish I knew more about compiler theory with many years of experience. I won’t be able to gather enough support for a team that would keep together to completion. The current team isn’t going to do anything. Zend Engine 3? Doubtful for any number of years.
If something isn’t done soon, then more and more coders using PHP will move on to Ruby and Python and PHP will become the new Perl. I can hear it now, “What ever happen to PHP?” or “Pfft, no one programs in PHP anymore!” or “Man, I had to maintain legacy PHP application!”
Should I stay or should I go
I’ve been asking myself for a long time. I can either try my hardest to improve PHP by building my own compiler or I can give up and learn another language. I should do that anyway. I’m competent enough (or so I think) developing in PHP that it should be time to move on to learning another language. I can apply what I know to that other language and quickly learn its syntax, gotchas, and rules.
The goal is to hide the difficulty of developing using the features. It is possible to create link lists and trees using the PHP array, but it requires thinking outside the box and will have some gotchas doing so. If PHP already had a LinkList object it would hide how it was done from the user and allow the user to focus only on using it. The solutions are allowing the developer to use “advanced” language features to speed development and bring ease of developing in PHP. Classes weren’t added because “…they are nice to have.” They were added to abstract away the difficulty of using functions and global variables in such a way to create a similar effect. Objects are possible in C, but if you knew how difficult to read it was, you probably would never do so. The code to create an object in C++ is much better looking and easier to maintain than C objects.
Languages need to hide difficulties of development away from the developer to speed development. Just because it “looks” like another language does not necessarily make it bad or “not the PHP way.” There is no “PHP way” of doing things, either the feature is used or it isn’t used, either it is desired or it is not desired, either it is easy to use or it isn’t easy to use. It could be argued that Classes are in no way easy to use, but objects are somewhat of an advanced study anyway. JavaScript does a very nice job of abstracting objects from the developer and making it easier to use and develop them. The syntax might be a little funny looking, but I like it a lot better than some other languages.
I think PHP is worth it to build a new compiler and spend the years doing so. If I spend enough time and support enough of PHP features and extensions, I should be able to gather a team to further improve it. Two years isn’t going to push developers of PHP away and in that time PHP should had introduced better language features and extensions.
What is the problem again?
I should clarify my problem with the Internals. To often this statement appears, “It looks too much like XYZ language.”
Questions to ask when thinking about adding a new feature:
- What problem of the language produced the desire?
- What solution does it offer that wasn’t available before?
- Can the same desired result be accomplished in another way?
- What other problems (gotchas) will be introduced with the feature?
- Will the feature introduce a solution for something that was missing and be beneficial to the majority of developers?
- How will it speed development for the developers using it?
Example with Namespaces:
- Not naming prepending their functions and classes correctly causing naming conflicts.
- Using myfunc() instead of myProject_myFunc()
- Using myClass { } instead of myProject_myClass { }
- Using Iterator { } instead of myProject_myClass_Iterator { }
- Namespaces would offer saving a few key strokes of long class names because of the lack of namespaces. Instead of having to type or copying/pasting myProject_MainClass_Subclass_Subclass_Subclass throughout the code base, it would shorten to in most places to just “SubClass” from within the myProject_MainClass_Subclass_Subclass namespace. I would no longer have to refer to the classes in their full form, saving typing and having to go through and renaming when I changed the upper namespace to another name.
namespace myProject { private class Worker { } class Factory { static public function factory() { return new Worker(); } } namespace Worker { // Here the :::Iterator access the top level // php namespace for the SPL Iterator class. class Iterator extends :::Iterator { } } } - Yes, see above. It is possible with proper naming to accomplish the same result, albeit with more typing.
- It will introduce some issues with the top level namespaces and how developers will interact with it. In my example, I used ‘:::’ to access the default PHP namespace for which the STL Iterator object is in. However, STL could use its own namespace for when namespaces are added and the example would be ‘STL:::Iterator’ instead.
- It would be able to introduce private or internal classes to PHP and control the flow of objects. You’ll sometimes want to pass around objects or have functions that you don’t want the user to play with or should play with. It would be beneficial to save typing for objects in the same namespace.
- It would speed development by allowing developers to use any name they want within their own namespace, as well as saving typing, and going through and renaming complete objects whenever a the namespace name changes. If I wanted to change Quantum_Coordinate_Array and Quantum_Coordinate_Boundary to Quantum_Vector_Array and Quantum_Vector_Boundary, I wouldn’t need to go through and change each class. Also, IDEs would be able to make the namespace name changes for the developer because it would know about the namespaces and be able to tell when the namespace name changed.
What other language features can be debated using this list or a better one? Don’t tell me it isn’t “PHP’s way” or that I want it just because it will be “nice to have.” I want it because it would make my development projects easier to create and maintain.
Possibly Related Posts:
- Game Engine Development and Open Source
- Plans for Base CMS
- Bullet: E-Book Library Management and Content Server
- Using ZendFramework 2 beta1 For Directory Project
- Project Plans
From someone who uses PHP, Ruby and Python, PHP isn’t all bad. Most of its blemishes (from a user perspective) are part historic, and part developer ignorance. Folk like you and me are pretty well over the hill on the ignorance part, so the historical nature of PHP – lack of Unicode, OOP, OO internal classes, and lots of other stuff. But that’s part of PHP’s distinctiveness, the price paid for an easy to learn, scaleable programming language which excels at web applications.
Blemishes are not of course limited to PHP. PHP is often less vocal in condemning other languages – usually PHP users react to criticism rather than generate it, but it’s not like the alternatives are perfect. RoR and Rails have a few flaws, as does Python, as does Java – PHP just manages to naturally outwit others on those scores which is why it has such a following today despite years of doom and gloom about its future. Once PHP6 is released with Unicode, my biggest annoyance will be removed.
A few things though are a bit wonky – PHP structures for sharing extensions and code have historically been very weak. PEAR while a bastion of PHP, is far less attractive today than the oodles of quality, competing code making up frameworks. The “too much like xyz” excuse is also a bit sad to see since it’s in no way a useful or even rational argument against anything. Still, PHP Culture is another of those prices for a cool programming language
.
That is true, I’m not saying the other languages are perfect. A developer must adapt to the language style to use it effectively. Syntax and the way you set up code isn’t as important as design patterns, unit testing, debugging, commenting, and creating maintainable code.
I just think it is pathetic to see the argument “It is too much like xyz” and that pisses me off that most of all. Anyone using this argument should be beaten and then shot. At least explain why language xyz has it and its advantages and disadvantages to that specific language. They are arguing syntax and style when they should be discussing importance and ease of use. In that, they are just noise who “feel” that it shouldn’t exist.
Give me an reason, there is a reason it is part of the language. Is it to fix a flaw in the language or to ease development? If it is fix a flaw in that language, then it might not be a flaw in PHP. That would justify the statement.
A developer has to learn its language and develop around it, but that doesn’t mean the language is freed from doing the same. A language must also adapt to its developers requirements.
Well, it is always good to branch off to learn other languages. Kind of know C++, kind of know Java, would be good to kind of know Python since it would make application programming easier. Eh, I’m learning Assembly now, so that might count, but I’m not going to hardcore with it.
Python is a good one to learn since the syntax will prepare you for Ruby. PHP5, similarly, has syntax a bit like Java. I find it quicker to tell someone to group languages and pick one from each group – so a Python learner with minor adjusting can easily read Ruby, or vice versa.
Not sure why I said all that – it made sense at the time
.
PHP’s still feels like template system. I see no future in PHP6, even PHP7 – it should be new, different(rewritten from scratch) webdev-centered language to be the good one that each sane developer willing to see.
Hi,
Maybe you can compare PHP5 to C#, or Java, but I would not compare it to ASP.. Simply a question of syntax and code structure.
Contrarily to the post of “Xml security geek”, I’ve the experience that PHP is being more and more wanted into big companies that are usually slow on the move (healthcare, mobility, banks, gov institutions). Even for ‘operation’ systems.
This has been a very long process. As these companies are slow on the move, they also keep a technology for a long time.
A completely new language will need much time to get into those servers…
No, PHP has historically been compared to the old ASP because of syntax.
My augment is that languages need to change and adopt user needs, without bicker overing “oooh, that looks pretty!” or “Yeah, that syntax looks awful! We don’t need that!” Which sums up the entire post.