10 reasons why WordPress is a better starting point for a project than you thought, even though you’re an advanced PHP developer

I didn’t quite mean to make this a “top 10″ list, but it did work out to 10 items, and it’s indeed a list.

UPDATE: I didn’t make a few points clear originally, so let me add some context here.

The impetus for writing this post was of 3 weekend projects that never got off the ground because I got bogged down with the setup. I was familiar with the framework I was using, it gave me all the tools I needed to get the project going, and as I started building my functionality I started realizing I needed X, Y and Z to keep going. So I grabbed packages (some I was familiar with, others less so, but all were modular and would fit right in with the framework I was using) and spent a bunch more time getting them connected and playing nice with each other, realizing I needed to modify my database schema to support certain features from those packages, etc.

By the middle of weekend #2 I still hadn’t really started coding what I wanted to work on. During the following week I had a bit of an epiphany that everything I’d spent a bunch of time doing to get my project started using simple, existing modular components that were easy to plug in and use already existed within WordPress. At the start of weekend #3, I started fresh with a WordPress install and just started coding the thing I wanted. I just never realized how much time I spent wrangling modules and components before.

Google App Engine provided a similar feeling. At the time I started playing with App Engine it didn’t support PHP, so I used Python, and I was able to just start coding. Users, permissions, access, etc, were all taken care of. The only thing I was mildly annoyed with was that I couldn’t find any existing themes, but it wasn’t too time consuming to grab a WordPress theme and make it work with Jinja2. Having to define my routes was a little annoying / time consuming too. I realized that WordPress would have made even those two things inconsequential, but they weren’t burdensome. But I digress.

Any CMS or Framework can do most of this stuff. The point isn’t that only WordPress does it, nor is WordPress necessarily the best at it. The point is just that WordPress already has these building blocks in place so when you just want to get your idea out there, there’s a bunch of stuff you just don’t have to deal with.

  1. User management and roles.  Has a fully functional user system available, and easy to hook into or customize.  So much better than rolling your own.
  2. Database structure and abstraction/access.  Fully functional database abstraction layer, and supports custom data types (just imagine custom post types are your default storage engine, not “posts”; and custom taxonomies are your relationships).
  3. Control/Admin panel.  WordPress has an admin panel “for free”. Easy to add pages, customize who can see what, etc.  This includes a fully-customizable user experience and WYSIWYG editor already present, which can be easily attached to anything.
  4. HTTP client.  WordPress has a pretty smart HTTP client, and can handle a lot of situations (mostly encountered by shared hosts).  It’s no Guzzle but it’s very reliable, and functions as expected under most normal circumstances.  It even allows non-blocking requests (these are asynchronous but may still trigger handlers on failure/success, just not in the same process or request).
  5. Scheduled tasks.  WP Cron leaves a lot to be desired, but it’s there, and it (mostly) works, and having even a half-assed solution pre-built beats building your own half-assed solution that you’ll never get around to finishing.
  6. Cache client.  With automated fallback if no persistent cache is available.
  7. Route management / pretty URLs / SEO URLs are already present, and works by default when implementing custom pages, post types, taxonomies, and kind of archive or detail page..
  8. Pretty much everything has an observer pattern built-in.
  9. Search.  Like scheduled tasks / cron, WordPress search kind of sucks out of the box, but it’s there, and plugins (+ the observer pattern for searches) are available to allow you to search using any kind of actual search engine you want. But again, it’s at least got a “good enough” search already available until you implement an improvement.
  10. It’s “legacy” code, and ugly, but that doesn’t mean your code has to be.  There’s nothing to stop you from writing modern PHP code for your classes and themes.  (Except that WordPress can be a little weird about namespaces, due to the way the observer pattern is implemented.)   Incidentally, it’s improving.  Thing is, these are things you just have to deal with when your software has millions of users and requires backwards compatibility, and also so that your software can reach hundreds of millions of users in the first place.

10 thoughts on “10 reasons why WordPress is a better starting point for a project than you thought, even though you’re an advanced PHP developer

  1. Ok, I’ll just play the devil’s advocate here. ;)

    User management and roles

    There are many packages out there which let you to put in user management & ACL in a cinch, like just loading them up, setup basic config & then start using the API (similar to what one has to do in WP).

    Database structure

    Thats just it – it can be a pro & a con – depends on what you need. Creating your own DB schema is not much of a burden though.

    abstraction/access

    Unless you’re writing all the code of an app from scratch – thats not much of a pro for WP. Every sane developer uses some framework or basic stack of libraries to build an app these days and all of them has one form or another of DB abstraction layer. You can also easily plug in an ORM like Doctrine.

    Control/Admin panel

    Again, packages are there which can do this. An advanced level developer (the kind you referenced initially) would already have one (3rd party or his own) which is re-used across different projects.

    Scheduled tasks

    A decently good framework comes with a job queue & scheduler. If not, again, off the shelf packages are available.

    Cache client

    All decently good frameworks come with a cache library which can cache data uning multiple methods – filesystem, memcached, redis, etc.

    Route management / pretty URLs / SEO URLs

    Anything that calls itself a framework has route management. Even micro-frameworks like Sinatra for Ruby, Slim for PHP & ExpressJS for NodeJS have route management bundled with them if not any fancy bells & whistles. ;)

    Pretty much everything has an observer pattern built-in

    Again, quite common these days in full stack frameworks.

    It’s “legacy” code, and ugly, but that doesn’t mean your code has to be.

    It definitely doesn’t have to be….. at all. :D

    Like

    1. You’re very right. A few details to nit-pick:

      User management and roles

      There are many packages out there which let you to put in user management & ACL in a cinch, like just loading them up, setup basic config & then start using the API (similar to what one has to do in WP).

      That’s true, but the key difference (which applies to database structure as well), is that other tools give you the building blocks while WordPress gives you a fully functioning package — you turn it on and it’s there, no additional coding or setup required, and you can further customize it. Little things like that can be a huge timesaver when getting something up and running.

      Database structure

      Thats just it – it can be a pro & a con – depends on what you need. Creating your own DB schema is not much of a burden though.

      Agreed that it can be both a pro and a con. The part that’s a “pro” is that you are already up-and-running — and you have a pre-built API for interacting with the DB schema. With custom post types, custom taxonomies, and post meta it even has a bit of EAV built into it to allow you to query and sort by custom data without much trouble. Of course, you have to know WordPress pretty well already to take advantage of that, unless you decide to start adding your own tables (which WordPress is kind enough to let you do without wrecking anything). It’s also not going to perform very well unless you know a lot of WordPress internals, or are doing something very simple. For a proof-of-concept or low-traffic site, those caveats don’t really matter.

      I totally disagree that creating your own DB schema isn’t much of a burden. Especially when you’re trying to get something up quickly. I can’t tell you how many times I’ve had to revamp a custom database structure because my data models changed. For example deciding how much to normalize your tables isn’t a simple decision, and is a very difficult decision to make up-front. Going back and refactoring your database is a chore. Choosing the right data type for your schema, foreign keys, etc, take a fair bit of planning, and if you skip all that when designing your tables then you’re just building technical debt — you won’t get very far before you need to address those things. So having WordPress deal with all that is a great time-saver.

      Your other feedback can be addressed by a general response:

      What I’m hoping to highlight is that WordPress makes for a good framework, it’s worth investing some time to learn because you can basically turn it on and start working on your actual project code. It’s not something I took seriously when I started developing, largely for many of the reasons you mentioned. However I started realizing how much time I spent just setting up my projects, and then I started using WordPress for them and realized how I was able to just jump in and code my features/functions without spending hours or days setting things up.

      I mentioned the observer pattern because one of the easy ways to dismiss WordPress is that it does something you don’t like, but because it’s implemented actions and filters everywhere, it’s super simple to change its default behaviour.

      Routing is certainly commonplace now, and while I’ve seen it implemented better than WordPress does, I’ve never seen it implemented nearly as nicely. For example, you register a new custom post type and boom — you get archive URLs and SEO-friendly slugs out of the box, no work required. You don’t have to specifically register your routes, and you don’t really even have to think about them because the defaults are very good.

      While many frameworks include some of these tools, the timesaver is that WordPress has *implemented* the tools. Other frameworks and packages give you the building blocks.

      Like

      1. For example deciding how much to normalize your tables isn’t a simple decision, and is a very difficult decision to make up-front. Going back and refactoring your database is a chore. Choosing the right data type for your schema, foreign keys, etc, take a fair bit of planning, and if you skip all that when designing your tables then you’re just building technical debt — you won’t get very far before you need to address those things. So having WordPress deal with all that is a great time-saver.

        Instead of a highly specific schema you can always go for a loose schema like WordPress for your building block. :)

        For example, you register a new custom post type and boom — you get archive URLs and SEO-friendly slugs out of the box, no work required. You don’t have to specifically register your routes, and you don’t really even have to think about them because the defaults are very good.

        Yes thats a bit common place as well these days, with full stack frameworks as well as many not so full stack ones. In full stack ones there are 2 ways to go about it – you can register a resource (just call a function & pass it resource slug and controller name) which will create RESTful URIs for that controller to handle. Or you can go with automatic ones where your URIs become like /{controller}/{method}/{optional-param-1}/{optional-param-2} which will be similar to what WP does for custom post types.

        While many frameworks include some of these tools, the timesaver is that WordPress has *implemented* the tools. Other frameworks and packages give you the building blocks.

        Well, all you need to do is call up the API and most of these building blocks are available (just like you’ll need to do in WP). As for config you need the basic stuff like set project URL, database creds etc which you need to do in WP as well.

        What I’m hoping to highlight is that WordPress makes for a good framework, it’s worth investing some time to learn because you can basically turn it on and start working on your actual project code.

        I agree and its the same with frameworks as well, many of them have matured a lot over years. If you recall the app I showed you, the one I made for Barcamp Delhi, thats pretty much what happened with it. I installed Laravel, did some basic config (DB creds etc) and I was up & running. I just wrote the code to handle different entities (talks, time slots, tracks) and thats it. I’d have to write that in WP as well had I used it as base. Sure I had to make an admin & user auth (Laravel has auth API, I wanted to try make my own) but thats mainly because I didn’t have one I’d made previously. If I need to make another app I can reuse my code. For the admin UI, the only additional work (that I’d have avoided in WP) was the UI container. Once that was setup quickly (I used Twitter Bootstrap – instant boilerplate, UI styling & components and responsive design) then it was no sweat – only thing left to do was create UI for different parts of app which I would’ve had to do in WP as well.

        Like

  2. Personally, I think there is only one reason to use WordPress and that’s the plugin ecosystem of epic proportions. It allows you to build (smallish) sites in a more cost-effective way than any other framework I’ve seen.

    As for the list of reasons you outlined – there are other frameworks and CMSes which do each and every one of those things so much better. It’s true that you can write well organized, object-oriented ~MVC code in WP plugins and themes, but in my experience the areas where you interface with WP Core still tend to get really messy.

    Stacking additional layers of abstraction on top of WP (Advanced Custom Fields, Timber, etc) makes both the dev process easier and the end result much cleaner, but after building a project with Laravel4 I still sometimes feel like crying when I have to work with, say, wp-login.php

    Like

  3. I’m very new to working with WordPress, so apologies. How viable is WordPress for modifying and integration of ongoing custom code? In other words, I’d like to potentially use a WordPress Theme for an initial launch of my web startup and integrate custom code modifications for there as I go along. I love the clean/sleek look of the WordPress Themes I’ve found, but I’m not sure how scalable and “open source” WordPress is for my startup purposes.

    More details: my startup is initially building a niche job board with all the modern features (profile, job match, applicant mgmt., social integration/authentication, xml job pull, etc.), and eventually integrating future innovations which might include things like integrating another open source functionality like CRM or recruitment tech. Having “open source” availability is important to me so that I can modify algorithms if need be (such as the job matching), integrate new code features as I scale, and so I can have access to underlying customer data for analytics, etc.

    I would appreciate any helpful feedback. Please let me know if you have any questions. Thank you!!

    Like

    1. WordPress is good with custom code and modifications. You can pretty much do anything you need to do via existing action and filter hooks (basically that’s what plugins do). In fact, any time you think you may need to modify WordPress code to do something, it’s almost certain that a way actually exists already. That’s definitely where familiarity with the software comes into play.

      You should definitely check out http://buddypress.org/ for your project. It’s basically a huge WordPress plugin that adds a lot of user features, such as profiles.

      Like

      1. Thanks, Gabriel! I’ve completed more research and WordPress definitely seems to be viable to build upon and has numerous themes and plugins available as you mention. Right now I’m more looking into the General Public Licensing around WordPress and open source in general. I want to ensure that any theme I customize/rebrand, and other open source code I modify and integrate into the WP theme, will be protected under my IP. From my best current understanding, since I will not be “distributing” my software, instead it will be a service based website, I will not be required to provide my code to anyone. If you have Licensing resources you could point me to that would be great! Thanks! Hope you had a great Christmas!

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s