Perfectly Idiot PHP Programmer Handbook - Introduction and Chapter 1
Everybody is aware of the important role PHP has been playing in the formation of young programmers. But I do believe few people really understand the dimension of the imminent disaster in course relating to the quality of the programmers that adopts it, and, curiously, never let it go - even when other languages are better suited to the goal of an application.
This book shall serve as funny consolation to those who see the mistakes made by unprepared PHP programmers. The critic is not against PHP. Indeed, I am myself a proud PHP programmer and I like it very much. The critic is about the programmer that write a true letter-soup on his resume so as to fool the recruiter, it happens the he or she is successful because often the recruiter is a psychologist proudly ignorant on computer sciences, therefore incapable to sort out the good candidate from the bad one.
It can be proved. Examples of this manual can be perfectly swapped from PHP to any language of choice. Yet you shall notice the pattern persists. The PHP, and perhaps Ruby nowadays, is a language powered by a very easy syntax and it enables the beginner achieve encouraging result very quickly.
Is it a demerit of this language? No. The point is if the programmer were someone with a good formation, surely would take advantage of the simplicity that each one of these languages bring. Please, before filling up my mailbox with enraged messages about my critics to PHP, keep in mind that this book is about the programmer in first place.
Family Portrait.
The perfectly idiot PHP programmer begins his bright career by the age of 15, when, by seeing website and portals, he is yet incapable to understand the difference between HTML and PHP. He starts googling and suddenly find two kinds of text: tutorials and forums.
These couple of results are perfect match: in one he effectively learns to create a web page - which, obviously does not tell one thing from another - and the other one, he is capable to talk about his doubts to other people who walked the path he is on.
Then, eventually he publishes his Home Page. He has access too to his first anti-pattern: Spaghetti Code.
By the age of 18, the idiot is not satisfied, he wants more. He come up with the idea to create a web site using some sort of database. Again he googles and finds out that 99% of PHP programmers use MySQL.
He promptedly creates applications using database, and also he learns to use the join command in tables. He join tables loudly and proudly, with no concern about such things as index or normalization. He puts in the database everything he wishes, text, numbers, images, files, well… almost everything in the Database. He discovers his second anti-pattern: In Database we trust.
The idiot, so far, only uses functions and, vaguely, very very vaguely some concepts of structured programming. Yet he doesn’t understand, and perhaps he will never understand, what is parameter passing by reference or by copy. When he needs to insert the content of a file into another, he uses the include command. When he needs access the Database, he includes the connection file in all other files. The idiot, notwithstanding the fact he has been using PHP for a long time, did not read the manual yet, and the idea set up PHP to include the files for him has not passed through his mind.
By the age of 25, he has accumulated a “large experience” and “knows a lot” about PHP, in his resume he mentions PHP and MySQL as advanced knowledge of his and highlights them. Actually, after few years programming, he is able to do things quicker than before, because he has now a library of code templates that he reuses in almost everything he does. He discovers then his third anti-pattern: Copy’n'Paste programming.
In this moment he is either graduated or graduation from Computer Science college. He might have studied IT systems or Web development. Anyway, he did not study in them advanced knowledge in programming logic, a mathematics base or network knowledge that enables him understand better how things functions within the computer.
By the age of 30, the perfect idiot is aiming for a low or medium management role. Perhaps he has heard of eXtremme Programming, Bazaar and Cathedral or Scrum. As programmer he discover the marvellous world of Object-Oriented Programming and DRY (Do not Repeat Yourself). He might have had contact with a more hostile programming language like C or Java. He also has had access to Rail-like frameworks. His life changes completely after this discovery.
At some point, the idiot thinks seriously about move in to RubyOnRails, which is much more practical and dynamic than PHP, he is not worried about scalable applications yet.
But he has feelings, and misses a lot the PHP way of doing things. He googles for something like RoR but written in PHP. He encounters a plethora of frameworks: Zend Framework, Code Igniter, PHPonTrax and CakePHP. “How great!”, he thinks, “The best of both world available to me!”. When the idiot goes to the circus he always enjoys the One Trick Pony.
However he is not familiarised with the theoretical foundations of these frameworks, and soon he feels limited on some aspects. For the first time he has contact with some of these patterns, for instance: MVC or Active Record.
By the age of 35, he is promoted to “Chief Programmer”. He is studying the Master degree. Already have a vast knowledge in programming and software engineering. At this point he decided to leap ahead in his career, and the role he has been aiming for 5 years is his at last. Depending upon his personality he might or might not be willing to pass his knowledge ahead. Oh yes, in the forums he read or asked, but the possibility to answer few questions appears only recently.
Although the idiot should prosper after his age of 35, I should stop here, because the main point of this family portrait is: the idiot is not concerned about good programming, he is concerned about getting things done, no matter how. Reinventing the wheel is not a problem to him. Is it good? I don’t know, great hackers usually studies the wheel, even reinvent it in order to better understand it. The idiot reinvent the wheels because simply never he has imagined that such a thing as a wheel could be invented before. Or even worse, he reinvents the wheel and on some perverted way he concluded that the best wheel is squared.