Learning JavaScript At WordCamp Miami | @thetorquemag
“All The Word That's Fit To Press.”
A WP Engine
Publication
Feature

Learning JavaScript At WordCamp Miami

Last month, WordCamp Miami featured a track completed dedicated to learning JavaScript. This full-day track covered everything JavaScript — from the fundamentals to more in-depth talks on frameworks — and was inspired by Matt Mullenweg’s 2015 State of the Word homework assignment to “learn JavaScript, deeply.”

I presented on AngularJS basics and how to use Angular with the WordPress REST API. As someone who has wanted to see WordPress move towards more dynamic interfaces for a long time now, seeing this interest in API-driven JavaScript interfaces is very exciting.

In the past, JavaScript has been more of an afterthought, mainly using jQuery to modify CSS. But the newer parts of the WordPress admin — the media manager and the theme viewer — are actually mini Backbone apps and are quite useful.

While the status of merging REST API default routes into core is unclear, the infrastructure for custom APIs is already there. This means that plugins and site-specific, API-driven interfaces can now be easily built.

The track was full of discussions on these topics and more. In this post, I want to share my takeaways.

Is This The New Way?

I suspect that more new plugins will ship with their own custom endpoints built in. In a sense, this has always been the case, but instead of using admin-ajax, which has no declarative structure for endpoints, more developers will use custom REST API endpoints.

Of course, for existing plugins, backwards-compatibility with the existing plugin code and older versions of WordPress is an issue. For example, Ninja Forms 3 has been completely rewritten as a Backbone app to support users running older versions of WordPress that have not yet adopted the WordPress REST API standard. This makes sense as they have a lot of users and not all are able to update to the latest version.

I asked Gennaro Piccolo, a developer at Time4Learning.com, how this new approach is affecting his work:

“As a developer, not accounting for user experience is no longer an option. Users are getting more and more accustomed to very fast, very easy to navigate UIs,” Piccolo said. “In order to keep up with user demands, I am forced to constantly reevaluate how my application is being used and roadblocks people face in accomplishing their task quickly and efficiently.”

The moderator of the track Michael Schofield agreed,

“The future of the WordPress front-end is JavaScript. Where I am, we have already been using WordPress as a largely headless CMS using the old WP JSON API to broadcast content to decoupled front ends,” he said. “Recently, several of these have been Angular apps.”

The Line Between JavaScript And PHP

While JavaScript is all the rage right now, it’s important to remember that WordPress is still a PHP and MySQL application. Moving more of the UI to JavaScript is helpful, however, no one is talking about using JavaScript to connect directly to the database. There is, however, this one cool looking project I saw that does just that. But while that looks cool for some site work, it’s not something that could happen in core without a total rewrite of WordPress.

Nobody can predict what WordPress 7.0 will be like. But for now, these REST API driven interfaces require a well-written, decoupled set of REST API endpoints written in PHP.

You should determine the amount of PHP or JavaScript you use to build your plugin or app on a case-by-case basis. Personally, I like Angular because it’s great for adding a thin UI layer on top of a PHP application. If I was writing the whole thing in JavaScript or wanted more of my business logic to be handled in JavaScript, I might consider another option.

What’s Next?

Many people I spoke with at WordCamp Miami expressed how excited they were to work more with Angular. I am not sure if I made the case that well, or they were just being nice because I’ve been the “Angular Guy” for the last few months. Many people I spoke with also had a new interest in Backbone, since it’s bundled in core.

I share that enthusiasm and would like to learn more about it. I’ve used it a few times, and while it’s not as easy as Angular, it is very stable and has a great WordPress REST API client. Backbone is old and uncool, but it’s extremely stable and opposed to other JavaScript MVC frameworks since it is bundled in core there is a “one true version.”

While I learned a lot at WordCamp Miami, and had several conversations about “what’s next for WordPress,” the truth is I don’t know and I don’t think anyone else does either. That’s what’s so exciting, we are all learning new things, trying new things, and building in new ways.

Although it is possible that we might settle on one new way of doing WordPress, it’s more likely that WordPress core will continue to provide a standard set of tools, and that more and more developers will use those tools to build solutions for their specific situations. WordPress, at the adoption rate it’s at today, can’t be all things to everyone. The best it can do is enable developers to make different interfaces for different types of users.

So keep learning new things and trying new things. Learn your JavaScript deeply and if you’re a WordCamp organizer, I strongly recommend having a “learn JavaScript, deeply” track.

Josh is a WordPress plugin developer and educator. He is the owner and a developer for CalderaWP, makers of Caldera Forms, a different kind of and the native WordPress A/B testing solution.

More WordPress News From Torque:

There are 2 comments

Your email address will not be published. Required fields are marked *

TOP