Portal Home > Knowledgebase > Articles Database > Why PHP should never be taught.


Why PHP should never be taught.




Posted by jt2377, 12-12-2007, 12:50 AM
http://zestyping.livejournal.com/124503.html http://programming.reddit.com/info/62qwt/comments/ Interesting read.

Posted by dexxtreme, 12-12-2007, 01:55 AM
Oh, yes. The random perils of comparing mixed variable types and using uninitialized variables... lol I think that one reason I like Perl so much is that since the learning curve is so steep, it almost *forces* you to become a fairly decent programmer just to be able to use it.

Posted by ThatScriptGuy, 12-12-2007, 03:49 AM
No - That's why people who don't know the language shouldn't be using it.

Posted by ThatScriptGuy, 12-12-2007, 03:55 AM
Beverlyhillscop's post at http://zestyping.livejournal.com/124...08183#t1508183 says it perfectly. Don't bitch about a language until you RTFM. Sure - PHP has some...weird things going on - but as long as you know what you're doing, there shouldn't be an issue there.

Posted by Jamie Edwards, 12-12-2007, 06:12 AM
PHP allows for fast production of code to automate and make web pages dynamic, and can easily be picked up by the masses without applying or learning any theory - therefore it serves its purpose.

Posted by sasha, 12-12-2007, 09:14 AM
Some people choke on LEGO blocks. They are not for everyone. It takes some common sense and skill to use them. The same can be said for PHP.

Posted by tjphippen, 12-12-2007, 09:38 AM
I'll agree that PHP has it's flaws. If you understand it and use it right PHP can be very powerful, and has been better used with many of my projects. But it takes more than the ability to write a few scripts to call yourself a pro.

Posted by FastServ, 12-12-2007, 10:40 AM
Programming Perl without strict mode (-w / use strict) is probably just as bad as the example here. Allowing the use of unitialized variables, in any situation, is a sure way to end WAY UP **** creek.

Posted by ubersmith_boo, 12-12-2007, 03:04 PM
Using this logic couldn't it be argued that English shouldn't be taught because we have sentences like 'Draw a line.' and 'Form a line.' where 'line' has two separate meaning depending on the context it is used in? It's not impossible to understand but to someone who is new at the language it will of course be confusing until they learn it. Learning is of course easier when one is taught.

Posted by ThatScriptGuy, 12-12-2007, 03:07 PM
EXCELLENT post ubersmith_boo You put what I was thinking into words

Posted by TonyB, 12-12-2007, 05:07 PM
Silly post PHP's syntax is a little different big deal. Now lets talk about the handling of NULL between languages and various database engines. Now that's an interesting one 1 + null = error. 1 + null = 1. 1 + null = null

Posted by Biju, 12-12-2007, 05:40 PM
I think there is no point in arguing when big websites are migrating towards PHP. If so why is it so popular? I think people need to think over it. When ROR was released the same question appeared before many whether it would replace J2EE.

Posted by Codebird, 12-12-2007, 05:43 PM
a programming language is a tool, you use as long as it serves you, I think it is well serving us, if not why are many "too many" people using it if it doesn't serve well?!!! take facebook as an example, how come a bad tool build such a big application?!!! can anyone build a good somehow stable house with sand?

Posted by Jamie Edwards, 12-12-2007, 06:25 PM
Even Yahoo! has migrated their systems to PHP.

Posted by FatalError, 12-12-2007, 07:45 PM
I really like programming in PHP. The only thing I really have a bone to pick with is the function naming convention. It's not really that hard to fix when you think about it. It would also help new comers when they begin to program; of course if you program in PHP day in and day out, you laugh at such a 'silly' point as naming conventions. But when you're someone like me who learned Java, VB and C/C++ before hand, it gets some-what annoying with all the different naming conventions mixed together.

Posted by TonyB, 12-12-2007, 07:58 PM
Well I think this has been pretty much covered here. You choose the best language for the job. If you're creating a web based solution you're not going to be making it in C++ these days. You're going to use a language specifically made for the web almost always. PHP is great for web based applications due to just how easy it is to develop on. Of course as a result you have bad applications created in it due to beginners that can jump right in there and a make an application. The same can be said for languages like C and Java as well but we rarely see a poorly made application in the wild or at least do not see it's source.

Posted by delta1066, 12-12-2007, 08:20 PM
Every language has its pitfalls. PHP certainly isn't unique for it. You use the force wisely and you have little to worry about. Write sloppy code and the dark side will rear its ugly head. The only thing I really dislike about PHP (and other server side script languages) is the inability to show 1/2 decent compilation error messages. Something like "Parse error at line 182" when your editing in notepad (with no line numbering) is pathetic (It could at least echo the line in the script which is a problem to show you what to look for). As with all languages, its about how YOU cope with the limitations it throws at you. You have to find your own way of working around obstacles while at the same time ensuring that your end users are not victims of dependancy hell, OS mis-matching or update sleep loss. Is PHP still that bad?

Posted by jstanden, 12-12-2007, 10:15 PM
That's really a BIG part of the move toward PHP too. It's less about making things easy on the programmers and more about simplifying for the end-users who want to host their own scripts. I'm not saying it should be as extreme of a shift as it is now, but that's how it ended up. In a perfect world, we'd be cruising along with software-as-a-service and getting the best of both worlds (simple for the user and well-structured, current tools for the developer). Until more people are comfortable with their apps as services we're still a long ways from developers being able to choose all their own tools.

Posted by Biju, 12-12-2007, 10:37 PM
Since PHP is easy to learn compared to other web programming languages, you tend to find loose coding by new comers. I code in JAVA, that does not indicate my code are well secure. people make silly mistakes often like forgetting to close the connection opened etc etc. I cannot blame the language, morally i would blame the programmers.

Posted by Biju, 12-12-2007, 10:39 PM
Now that hurts, but u have to either migrate to JAVA where you have more freedom in expection handling, but the simplest to use a editor[advanced and free] which would easily find the line.

Posted by jstanden, 12-12-2007, 10:50 PM
Yeah, that's the hardest part about using Java/Eclipse for things at the same time you're still using PHP -- it's impossible to forget how nice it is to have code changes (method signatures, class/method names) instantly break in red in the GUI. By the time you run it you've usually already caught the sleep-deprived nonsense. (Then it's just logical/UI nonsense) I think everything should be taught. There isn't a good professional reason to get complacent with a single language, or too used to an editor or high-level language doing the heavy lifting. Programming transcends syntactical choices. You should be able to map your experience to different languages. I've brought a lot of the conceptual things I've learned over the years from J2EE/Tapestry/Hibernate/Jasper/RCP back to my PHP5 projects.

Posted by canvas, 12-13-2007, 02:47 AM
If memory serves, ColdFusion was originally developed so "web designers" could play "developer" and not have to spend the time getting formally trained to use more traditional scripting languages. CF even "looked" like HTML so it wouldn't scare off the newbies. I once had the honor of shaking hands with Rasmus Lerdorf, one of the founders of PHP. I assure you, PHP was not invented to make a developer's life harder. There's no sense blaming the tools, especially when one like PHP has such a well-documented and successful track record. At the same time, I can agree that not everyone is cut out to be an instructor or teacher. And when dealing with a highly technical field, it's important to break down the concepts especially if some are new to those trying to learn. I've picked up many a manual in my time (covering a wide range of IT topics), and shook my head in wonder that the person writing the manual was actually able to get it published. Thankfully, when it comes to a development environment like PHP, there is an ample supply of resources and active developers you can turn to. I hope those here who are not in favor of PHP give it a second glance, and form their opinions for the right reasons.

Posted by delta1066, 12-13-2007, 05:44 AM
I do use a nice little editor called Notepad++. It's truly wonderful however when working on someone elses machine, (or the built in cpanel editor) things become harder than they need to be. I was not slating php, just pointing out some of its weaknesses compared to my favourite win32 counterpart (Delphi) which gives much stronger compiler errors which are almost helpful (plus it highlights the area it doesn't understand). PHP is a great language providing it is used in the right way - Thats all I'm saying!

Posted by holmesa, 12-14-2007, 06:47 PM
Using uninitialized variables in PHP is great. Some might say it is hard to debug, but you can also take a lot of advantages when doing class inheritance.

Posted by Architect, 12-16-2007, 02:36 AM
Ctrl + G to go to a line number in notepad. Obviously make sure word wrap isn't on. Hope that helps.

Posted by delta1066, 12-16-2007, 08:59 AM
Heh, well theres something i never knew! EDIT: That works in notepad++ (which has line numbering anyway) but it doesn't work in windows notepad

Posted by holmesa, 12-16-2007, 01:37 PM
Are you really thinking it is a good idea. I believe showing the code on the web page is a never a good idea. I've seem a lot of .NET 1 websites that through parts of code if an error occurs. One time it was an DB connection string containing admin password. The website served a very large vendor.

Posted by delta1066, 12-16-2007, 03:00 PM
Fair comment but then wouldn't it make sense for PHP to have a debug mode which you can turn on and off to prevent this? Just one of many points I could make about the things it lacks. I do like PHP I just think there is a lot more that it could improve on.

Posted by jstanden, 12-16-2007, 05:48 PM
php.ini: display_errors = on/off

Posted by delta1066, 12-16-2007, 06:23 PM
Yeah I'm aware of that but then surely php should when errors are turned on, show the line of code which is causing the conflict? What holmesa was saying was that by doing so it would be a security risk however as you have pointed out, errors can be turned off once debugging is finished. I don't think holmesa has much of a point in reality...

Posted by DevMonkey, 12-16-2007, 07:13 PM
PHP does show the line of error, depending on the error!

Posted by bqinternet, 12-17-2007, 04:59 AM
Ctrl-G does work in the regular Notepad that comes with Windows. It's also in the Edit menu as "Go To". As Architect mentioned, you have to turn off word wrap (Format menu) to use it. If you have word wrap on, the option is disabled.

Posted by delta1066, 12-17-2007, 06:04 AM
Heh, yeah your right! I forgot to disable word wrap and stupidly had no luck getting it to work in windows notepad. Just tried again and I was impressed! Thanks for that!



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
csf and china (Views: 633)
MySQL on Nginx problem (Views: 595)