When I started learning to program in PHP around 2 years ago, one of the things that excited me the most about it was the vibrant following it had. The community was strong in numbers, loyalty and willingness to help alike. I was always able to find help with almost anything PHP related that I needed. It wasn’t the ‘cut and paste’ kind of help, it was the ‘detailed explanation’ kind of help. There were numerous resources which I could use to learn the basics of the language and a vast number of examples I could draw from to get an understanding of how to apply the basics that I had learnt in order to build a useful application. It appears however that those days may be long gone.
Please, don’t get me wrong, I am not at all implying that the PHP community has gotten any weaker. In fact I think that it is strengthening at a rapid rate due mainly to the fact that the language itself is becoming more robust and mature. The issue I have however is that it is becoming increasingly more difficult to learn PHP. Just pure PHP. Beginners nowadays are being hit over the head with grandiose concepts such as ‘dependency injection’ and ‘favouring composition over inheritance’ which really have nothing to do with PHP itself. Whatever happened to <?php echo 'Hello World!'; ?> ? I understand that these are concepts which, when thoroughly understood and properly applied, aid in the development of scalable and robust applications. However, why are we forcing newcomers to our community to build their PHP homes from attic to basement? As a result of this foolishness we now have PHP developers going around developing inferior software. The fallout is then of course not limited to the guilty developer, oh no. Much of it lands squarely at the feet of the PHP programming language. ‘PHP sucks!’. ‘PHP is a hobbyist language!’. ‘PHP is not suitable for enterprise!’. We have developers obsessed with micro-optimizations and zombie followers of design patterns when the truth of the matter is that had they just been introduced the language properly in the first place many of these concepts would become like second nature or at the very least much easier to understand and expand upon.
Now I understand that the onus is on these newcomers to ensure that they learn the language correctly from the ground up. However, as developers who have all been at the newcomer stage, senior members of the PHP community need to, for the sake of our beloved language, shift some of the focus of our discussions and our articles back to PHP. Just pure PHP. It may seem at first like taking a step backwards but I can assure you that there will always be something new to learn about PHP that you either overlooked or never encountered before. <rant>This is one of the many reasons that I hate PHP frameworks. They do absolutely nothing to aid in the learning of the language and, at the rate that they are going, we’ll soon find that PHP frameworks abstract away PHP itself.</rant> That however will have to form the subject of another blog post. Remember guys (and gals), PHP Depends on You!



J from Montana, United States on
Stephen Orr from Walsall, United Kingdom
Corve from Saint Andrew, Jamaica
{ 6 trackbacks }
{ 24 comments… read them below or add one }
You’re absolutely right man. When you forget the basics, you’re doomed!
I will tell you something, I used lately PHP for a project and it was a fresher, I mostly do Java development and if we compare Java and PHP about complexities PHP its like a walk in the park. Java is verbose and its so complex and stagnate, PHP have advantages its an Open Source Project and you can have closures and fancy stuff anyday. Java devs we are crying to have those but its not possible so we are searching for alternatives as Scala, PHP, Python, Ruby etc. Anyway Im still like Java because Im comfortable but its a more heavy language than PHP. You should be proud to work with PHP everyday. PHP still have a strong future and still a lightweight dynamic language.
I think there are framework that “gets it right” and others that introduce many levels of abstraction. In the first category I put Zend Framework and its views which are a simplified, running in a controlled environment version of plain old php scripts.
Twitter: @SamuelFolkes
@OtengiM – I am very proud to work with PHP. I love the language and I can only foresee it growing from strength to strength. I think though that more emphasis needs to be placed on learning the fundamentals of the language. As a Java developer the switch to PHP for you may have been relatively easy because you were already a programmer. There are certain programming concepts that are universal. I bet however that in Java you did not have to deal with say magic quotes for example. Learning PHP you would need to learn about some of these basic PHP specific concepts.
@Giorgio – That may indeed be so. However I am sure that you will agree that introducing a beginner to Zend_Db rather than mysql_connect is not a very good idea. Beginners aside, personally I try to stay away from frameworks because I always like to know EXACTLY what my code is doing. So basically i’ve studied a few frameworks, Zend included, and sort of created my own much smaller version of a framework that I know inside out. Maybe I have a do-it-yourself complex
I’ve actually been thinking the same thing about resources for beginners at the moment. When I started of with PHP it was a walk in the park! It’s a couple of years down the line now and I have to say I love PHP. I code in PHP everyday. Mostly working on online multiplayer games. I think people who are more skilled with PHP just need to reach out and help others, it will help you in the end of the day!
Anyone looking for help give me an email! Usually more than happy to help once your literate!
Great post Sam – agree wholeheartedly on not losing sight of pure PHP. I’ve been writing a blog post series attempting to demystify some of the concepts of functional programming that is now possible in pure PHP 5.3. Not quite aimed at fresh-eyed PHP developers but definitely targeted at folks learning the language, and especially the new, less documented aspects of the language. Here are the first three posts, of five, to check out:
1. What are anonymous functions, lambdas, and closures?
2. Introduction to functional programming, function types, and higher order functions by implementing map/reduce.
3. Dynamic invocation in PHP with callables, is_callable, call_user_func, and call_user_func_array.
You said that you hate Frameworks. I started learning PHP 2 or 3 years ago too. When I tried an MVC Framework “to finaly build robusts web apps”, I started with Symfony and then… developped in “symfony”.
After Symfony, I tried Zend Framework…
Developping in OOP with PHP and ZF is nice : that’s PHP, not any other Framework who are trying to build a new language… However, it’s came from Zend.
PHP is strong, keep it real
( Sorry for my english… I’m a frog
)
Twitter: @SamuelFolkes
@Paul – I’m glad you’re willing to extend help to newcomers to our language. Reading your comment actually gave me a pretty good idea regarding providing resources for PHP beginners.
@Kris – Good move! I’m not so versed on functional programming and may need to look into the demystification of it myself. I’ll be sure to check out your series.
Twitter: @SamuelFolkes
@Swifty_core – You are the second commenter thus far to speak well of the Zend Framework when compared to other PHP frameworks. I may have to take a look at it again. If they’ve managed to provide a solid foundation which allows developers to build robust applications while still programming in PHP (not some bloated abstraction layer) then my hat goes off to the Zend guys. They would have achieved what many other framework developers tried to and failed.
Hi Sam. I’m another relative newcomer to PHP, from a previously non-technical background (3 years PHP, only 2 full-time, however). I am self-taught, through excellent beginner resources I found online and from Jason W. Gilmore’s fantastic book Beginning PHP and MySQL.
I agree that we have become so focused on becoming a “grown up” language (frameworks, anonymous functions, namespaces, etc.) that nobody is really talking and sharing about simple (and good) procedural code. I finally figured out OOP and classes about a year ago, but before that I struggled to find good OOP resources that didn’t fry my brain.
I am like you in that I eschew frameworks (for now at least) because they tend to exempt you from growing as a coder. Having said that, I do need to at least experiment with some frameworks so I can carry on a conversation at the next PHP conference.
Great post. I’m adding you to my blog roll! -Chris
Twitter: @SamuelFolkes
Thanks Chris! I can relate to not really getting OOP at first, but with a few good books and a bit of practice it became a piece of cake. Luckily for me, at the time when I was learning OOP (my first language was C maybe 6 or 7 years ago) I didn’t have advanced concepts being hurled at me from all angles. I got a chance to absorb it all at a pace I was comfortable with. I’ll certainly be checking out your blog, I think I got a pingback from you before. Thanks for the add!
I disagree with your post. Yes, the language has matured and many features have been added to make PHP more powerful and to make it a suitable solution for a wider range of applications. But the core is still there. Your main question is “where has all the PHP gone?” and you use this example:
Whatever happened to
What exactly IS the answer to that question? The answer is: “nothing!” That line of code still works today exactly the way it worked 10 years ago. That also means that the way we all learned PHP is still available for those who needed.
However, PHP now not only offers something easy and simple for those new to the language, it also allows a carreerpath for those newcomers; they can grow their development skills, make increasingly more complex (note: ‘complex’ is different from ‘complicated’) applications and pick up some software engineering skills along the way.
So while the simpler, procedural, easy-to-use features are still there, there’s now a whole range of features that cater to the software engineers among us. This is not bad for PHP, it brings more people to the community and enables more developers to build their applications with it.
The hello world sample got cut from my comment; there are features in php nowadays to safely display such a comment without it harming your system
Nice post Sam, I agree wholeheartedly with the concerns you have expressed. I am in the unusual position that I program Java full-time “to pay the rent”, but do all of my personal projects in PHP through choice, because I honestly believe that LAMP is still the best stack for web application development (and yes, I have looked at Rails in some detail as a possible alternative). This position allows me to observe trends in Java and PHP and draw comparisons.
My feeling on the PHP community, in particular the core developers, that they are too focussed on developing “me too” features in PHP, e.g. Java has namespaces, we need that too, Ruby has lambdas and closures, we need that too. This is particularly true of the current trend in focussing on design patterns and frameworks in the PHP community, where we are firmly on the coat tails of the Java community.
Do they not realise that many of these design patterns exist solely as workarounds of issues in Java, e.g. a singleton in Java makes sense when Java persists objects in memory between requests, but what about PHP with its radically different (and in my opinion superior) shared-nothing architecture?
Why are we following others, and not leading? Why is the PHP community not setting the new trends in language development, but instead focused on replicating the work of others?
Twitter: @SamuelFolkes
@Ivo – Ivo I think you misinterpreted me completely. I have no issue with the new features being introduced in to PHP, I actually welcome them. They afford me the flexibility to build better applications. This article was less about PHP itself and more about the PHP community. It is about teaching beginners
< ?php echo 'Hello World!'; ?>before sending them scurrying off trying to figure out ‘late static binding’ and ‘dependency injection’. Its about providing beginners a stable foundation rooted in the fundamentals of PHP which will translate into them becoming better PHP developers.P.S. I think the ‘feature’ you’re referring to is wrapping the PHP in <code></code> tags
@John – You must be a mind reader, my latest post is actually about the misuse of design patterns
Its good to see feedback from someone who develops in Java as well as PHP. You have interesting insights, particularly on the effect Java has on the direction that PHP as a language is going in. I can tell you one thing though, ever since there where computer chips, programming languages have all experienced the ‘me too’ effect to some extent. I believe that its so much more powerful in PHP because for so long PHP developers have been criticized out the wazoo because PHP was missing certain features that are considered ’standard’.
I cannot say that I agree with you. Point you are missing that, we are not just trying to teach people to write PHP, we are trying to teach people how to programming without being limited to only one programming language. The best part when you are a PHP developer, you are not a language evangelist, yet someone who has an idea which needs to be implemented and PHP is the fastest way to it!
While it’s the faster way, it may become the pretty problematic and unsecure way to do it too. As there can be lots of copy-paste code in your library, because there are really lots of code. You may simply copy and paste it and see that it works. However, if you are a newcomer, you have a lot to learn from OOP to Sql Injection which maybe a problem because you didn’t know that magic_quotes is now disabled:). It’s not wrong to throw these concepts to newcomers as what we are really trying to is to make them aware of these concepts and tell them that while it’s good to write hundreds lines of code, it’s also better to write hundreds lines of secure code!
I think that PHP community is not just trying to give it’s newcomers only the concepts of the language but the concepts of programming. Because it’s not really the language but your programming skills which helps you understand PHP better or it’s concepts. It’s good to be able to write a Hello World! app in one line, but you have to know that, some other languages requires a dozen to write it. Only by this way, you can appreciate the real power of PHP I suppose.
Sam, I currently work for a web development company called Clock near London that takes on placement students every year from universities across the country (of which I was one 2 years ago), as well as people straight out of school and colleges who have taught themselves the language.
So far, I don’t know anyone that has come into the issue of PHP not being easy to pick up and play with, and none of them had a need for late static binding until they start developing enterprise applications. I think your argument shouldn’t be directed at the frameworks, their main goal is to make complex programming simpler, not to hide PHP, and also to help coders avoid the common pitfalls and mistakes which are made when learning. In generic terms, the student can only be as good as the teacher (bad PHP examples can lead to much worse code than frameworks).
Coders who want to develop can go deeper into frameworks, whereas people who just want to build a blog for their cat, can do so. People shouldn’t need a software engineering degree or years of experience to build “Mrs Muffin’s Cat Tales”, however enterprise systems are a different matter. Your argument should then be directed at those companies developing the software, and the way they help their staff develop.
Forgive me if I’m completely off the mark with this, and of course feel free to criticise
I still consider myself a PHP newcomer!
Twitter: @SamuelFolkes
@Roy – While I agree that learning these concepts make you at the very least a more rounded developer, I feel that it is essential to establish the basics first. Even a seasoned say Java progammer switching to PHP must learn some of the inticacies of the language before he/she will be able to use it effectively. Becoming a better programmer is an ongoing process that every developer will go through until either he/she dies or gives up programming altogether.
@Dom – The problem I have with frameworks and beginners is that they don’t really allow them to learn PHP. They are essentially hidden from the inner workings of the framework and so learn to make the components work together with little or no knowledge of what makes up these components. My dislike for frameworks is personal, i’m sure they have their uses and I have no gripe with developers who know what they are doing using them.
If you google for “PHP tutorial” you see plenty of very beginner tutorials for the language, so I don’t see what’s the problem.
Twitter: @SamuelFolkes
@Jani – I won’t dispute that fact at all. However, when you begin to move past static tutorials and seek interactive help in forums, IRC etc. thats where the problem arises…
If you don’t learn the basics alongside using a framework if you are a newcomer to php it will be hard to mold the code to do what you have in mind.
The first thing people want to see is a result, if a framework helps you to achieve you to get a faster result it gives the people a good feeling. If you want to create a game and you need to use python, you are not going to program everything from scratch. You use a library like pygame and use that as an entry point to learn the language.
Sure many sites don’t need a big framework but there are barebones frameworks too. Frameworks aren’t needed but i think going back to the do-it-your-way coding is a step back.
Twitter: @LynchRichard
The problem is, if you don’t yell at them early about SQL injection, PHP gets yet another blot on its name from their mistake…
If we could just nuke all the OUTDATED and BAD tutorials already “out there”, we’d be all set…
Excellent question, where are all the PHP developers? No, seriously.
All the speakers at the PHP conferences are always the same. You have marketing gurus (Ivo, Andi, Marco), social media wannabes (Aral Balkan), Flash freaks, procedural serial killers, PEAR zombies, boring C programmers who never use PHP (a.k.a PHP internals), and of course, Chris Shiflett and Sebastian Bergmann.
Once I asked in a mailing list – “What happened to Propel, Phing and other PHP frameworks that haven’t been updated for a long long time?”. To which the lead developer replied – “I no longer use PHP. I’m a full time Python developer now. Sorry”.