Tuesday, May 28, 2013

Learning PHP, My Observations and Comparisons to Notes & Domino

I decided a while back, that not only am I going to study topics that I need for my job, that I am going to study the alternatives to what I do.  This past long holiday weekend, I decided that first up, I was going to learn PHP.   I spend a good part of my Memorial day weekend, completing a 5 hour course on Lynda.com, as well as selected chapters of another older PHP course.   I also spend time researching the present state of PHP, and the community behind it.

PHP has been around since the late 90's and rose to prominence around 2000.  It is mature and widely adopted and is used on up to 70% of the web.   Here are my observations in no particular order.
  • It is a server-side language like SSJS or Lotusscript
  • PHP is the "successor" to CGI/Perl scripts
  • It has syntax similar to C and Java, with the use of curly braces, and semi-colons at the end of each line.   
  • You mix the code in with your HTML, like JSP and ASP.  It is analogous to using inline javascript using <script> in your HTML instead of having all your code in external files.     (You can include your code and keep it elsewhere, which I would think would be the best practice.)
  • It is like javascript in that it is a scripting language, made for a certain purpose.  It is like JS in that you can use a function, before actually writing it in the same page.   
  • It has some really weird syntax.   Instead of a dot operator it uses a " =>", and uses a "." for string concatenation.   There are also times where you actually need to leave off the closing tag.
  • It is used mainly with Apache servers as a plug in, although it also runs on IIS.   PHP will never be used in conjunction with xpages unless IBM adds it to Domino server and doing so wouldn't make a bit of sense.
  • There are loads of built-in functions to learn and use, and you can also make your own.
  • Documentation seems to be excellent.
  • Debugging looks like it is a major downside of PHP.   Without good standards, it can convoluted and become a maintenance nightmare.   Error messages are crptic (some even contain the Hebrew language).
  • PHP uses the confusing term "variable variable" which is I think is the iterator in an array of variables. There is even a special character '%' to signify a variable variable.  After learning this, I thought that they made it harder and more confusing than it needed to be.
  • There doesn't seem to be any console for debugging.  You can debug by writing variable values as HTML, and reloading page to see the value. You then remove your debug code when you get it right.
  • There are many frameworks that are built on top of PHP, the most popular being CakePHP.
  • Wordpress is built on top of PHP
  • There are Object Oriented like parts of PHP, in a similar way that there are OO like parts of Lotusscript, but it is not considered an object-oriented language.
  • PHP is usually tied together with a MySQL backend database
  • The many built in functions are like @Functions in Formula language    Think of it as combining LotusScript and @Functions together in one language.
  • You wouldn't use PHP to do anything outside of a webpage.  That is not a limitation, the language is intended that way.
  • If I was a PHP developer, I would definitely learn another language like Java or C# as a back up.  
  • In some circles, PHP is not considered a real language.  I don't know enough to form that opinion myself, but on the surface it seems untrue.   I will say this, that I think it would take the same effort for a PHP developer to learn Java as it would take for a LotusScript only developer to do the same.  
  • PHP is in decline, but will still be used for decades.  
  • PHP has a strong community that seems to have begun "circling the wagons' in it's defense.  The proponents seem a bit defensive to me, of course as a Lotus guy I understand that.
  • There seems to be quite the rivalry between Ruby and PHP, those that know both prefer Ruby
  • Since PHP is free, I don't think the PHP community has too much to worry about.   Good enough free, usually beats better paid in the eyes of most companies.
  • The general trend in web development, is for more processing to move to the client-side using javascript and ajax and away from server-side processing like PHP.   I believe that you can use PHP with ajax together.although the course I took didn't cover that.
  • It is fairly easy to begin writing PHP, and write code quickly.  Despite its quirks, it looks like a fun language to work with and to learn! 
  • Xpages > PHP.  A more fair comparison would probably be xpages compared to a PHP framework, but I do not have the knowledge yet to make that comparison. 
Those are my high level observations of PHP from a Domino/Xpages Developers perspective.   I might spend some time learning about PHP frameworks from here.  Also in the future, I intend to devote extended time to learning Node.js, Ruby on Rails, Wordpress, ASP.net, and especially Sharepoint 2013.

1 comment:

  1. PHP is a very important programming language to learn in web design and development field. There are so many resources to learn PHP. One of the best ways to learn PHP is trough online tutorials. Learning PHP through online tutorials will save you time and provide you fun.

    web design Melbourne