Why I’m Breaking Up with jQuery and Getting Back Together with PHP
When the power of code summons the power of love
Being someone with a Java and PHP background, front-end development had always been something I wanted to explore, but my heart was waiting for that one programming language to come around and pull me in. That programming language was jQuery.
- official jQuery motto
What PHP lacked — in essence the ability to select html elements by their tag name or C.S.S. names — jQuery provided, and for free! jQuery also came with a mobile version, which Flash and PHP did not offer. In the world of sports website development, where lives hang in the balance of the code I write every day, mobile development is a must. In order to keep our projects lightweight I made the decision to drop PHP and use jQuery instead.
This turned out to be a mistake in hindsight.
People would wonder why I need to compare jQuery and PHP. From cell phones, car, movies, bikes, actors. Today most of things are compared. It helps us to choose the right tools and pick what we want to learn during our journey as a growing web developer. My own journey began back in 1992. I was walking from the office to the local pub after a long day of Flash development. I had made several banners that day for a WordPress site, a personal blog for a writer friend of mine to be exact. After roll over on some banners on the website, the banners expands etc. Fast forward to about two weeks ago and I was trying to build a WordPress template but found it incredibly difficult to do without PHP. I had hit a crossroads when it came to what language I needed to move forward with, to fight and debate about, to evangelize.
What does a developer do when they have to make a choice?
This developer’s choice (me, I’m talking about me, I’m a web developer) was to port all of our jQuery code base into PHP. This was simpler than one would expect, as PHP is basically like Node except wrapped in question marks:
// jquery syntax
$someVariable.click(someFunction);// php syntax
<?php $someVariable.click(someFunction); ?>
There are two more spaces in the syntax, which means our server side code will never be quite as fast as the client side, but the beauty of server side is that its errors never show in browser developer tools consoles.
If the console has no errors, that means there are no errors in your code.
So this is my official breakup letter to jQuery, and my please-take-me-back beg to PHP. Sure, this will mean I can no longer do animations without Flash, but it will allow me to interact with tables of data — the very essence of Web 2.0. Just like my father made the sacrifice of leaving his family for his hobbies, I had to make the sacrifice and leave front-end development for back-end.
Perhaps in 15 years I’ll be walking from the office to the local pub after a long day of making WordPress sites and realize that it’s time to go back to jQuery or whatever other programming language may be at the cutting edge at that time. And you can bet your Flash job listings that I’ll let anyone who can read a blog know about it. Because if it’s important to me, it is important to the entire community. Me.
Jenn Schiffer is a father, husband, Christian.