Rails vs. WordPress

I’ve been thinking about the topic of when I should use an MVC | framework, and when I should use a CMS platform ever since I discovered Drupal about 2.5 years ago. I don’t believe the topic is covered really well on the Web, and most people seem to have a shallow understanding of the topic, so I’ll share my thoughts with you.

The popular question in my company these days is “Rails or WordPress?”, but I will probably touch upon the broader questions of “MVC or CMS?” and “Ruby or PHP?”, so you can often substitute “Rails” for “MVC framework” in the article.

Something to also keep in mind is that in my experience the other MVC frameworks are much closer to being real competitors to rails than any other CMS is to WordPress, so that is something also to keep in mind (let us know in the comments if you want to propose some CMS candidates for using on projects instead of WordPress).

The Cop-out

The most common answer I hear from people, who I assume haven’t really thought about this for long, is “Rails is for web apps, WordPress is for websites.” But is my web-based system a website or a web app? Can most web-based system be put into one or the other category, or the other? Do you think you could score 5 out of 5 on a quiz which would show you a web-based system and ask you to pick a) website or b) web app?

The Gimmes

I’ve identified some traits of web-based systems which make it easy to choose one or the other.

I should say that regardless of the requirements of the system you’re building, in my opinion you should strongly consider whether the programmers you have available are much more proficient in one of the two environments. If your programmers are experts with Ruby and Rails and haven’t written even a 1000 lines of PHP, it is almost certainly better to use Rails for any system (except if you need a blog or promotional corporate website without any custom software development). Same for a team that is made up of WordPress and PHP experts with little Ruby and Rails experience.

Rails Gimmes

If you’re building a transaction processing system in which data and various views of that data are the only functionality, Rails is the natural choice. Examples that come to mind are a POS system, or a system that stores data about the amount of calls your call center is receiving, and then creating robust reporting based on that.

When looking for a Plastic extrusion company producing Angles, Flat sections, Channels & more. Visit this website lakelandplastics.com for more information.

If the web-based system you are creating does not have an element of web publishing, and your customer does not have a need for most of the screens in the WordPress admin, you should pick Rails.

If your web-based system is a web service built on top of an existing legacy database and doesn’t have a website component, you should pick Rails.

Please contribute good descriptions of projects where you’d pick Rails in the comments, and I will include them here along with a reference to a URL of your choice.

WordPress Gimmes

If you’re building a blog, you should use WordPress.

If your project will need all or most screens of the WordPress admin, you should use WordPress.

If you’re making a web publication system (CMS-based system) you should use Drupal. No, just kidding, use WordPress, since Drupal kinda sucks unfortunately. Sorry Drupal, you were an OK attempt, but WordPress is probably a better choice for any web-based system.

Please contribute good descriptions of projects where you’d pick WordPress in the comments, and I will include them here along with a reference to a URL of your choice.

The Pattern

If your team is about as proficient with both WordPress and Rails, or you’re shopping around to hire a team and both solid Rails and WordPress teams are available, it comes down to opportunities for code reuse. Will your system re-use more code if you use WordPress and its very usable admin area, myriad of available plugins and themes? Or can you re-use more code by harnessing the object-oriented design, DSLs and good software development practices mecca that is Ruby, Rails and the available libraries and tools?

In terms of the decision of Rails vs. other CMSs available, technically Rails is probably the leader of the pack for a large majority of applications. The advantage of Rails disappears if your programmers are much more proficient with Python or PHP, since there are probably good enough alternatives in their language, namely Django and CakePHP, but code re-use opportunities each MVC framework will bring should again be taken into consideration.

Writer’s Bias (Why I think I am well-positioned to write this article)

You can read about my professional travels so far.

I now work for a company that uses both Rails and WordPress, and I am actually hired and paid to help make these exact kinds of decisions. I hope you will provide valuable feedback and discussion to help reach a further deeper understanding of the topic.

WordPress and NetBeans

Here’s a few tips for how to make the most out of NetBeans for developing WordPress websites.

Making NetBeans aware of WordPress functions so it can suggest autocompletion

Working with WordPress, I often have to look up how to use a function I’ve used before, but have forgotten the order of parameters. The codex, and in particular the WordPress function reference and WordPress template tags reference pages are great places to look for such things. However, if you set up NetBeans to be aware of the WordPress functions, sometimes you can save yourself a trip to the codex. NetBeans is by default aware of any functions defined within any files in your PHP include path, as well as any functions you have defined in your project. One way to make NetBeans aware of the WordPress functions would be to have WordPress core within your project, but I would prefer to not have it there. When working on files on remote servers, main reason I would use NetBeans over vim, it is a little bit cumbersome to download all of WordPress core, and I usually only download what I need from wp-content. In such a scenario, you can teach NetBeans to also load a local copy of WordPress into memory. To teach it that, go to Tools -> Options, then PHP tab.

Code completion will then be enabled, and the PHPDocs in WordPress will be parsed shown when looking at the available functions. In the picture below, I typed ‘WP_Q’ and the autocomplete functions became available below it, as well as the documentation dialog above it.

WordPress Coding Style Adherence

The WordPress coding standard defines how your code should look so that it looks the same as the code in WordPress core. Adhering to a coding standard is a good idea because it promotes consistency and makes for easier reading of the code you write. I’ve prepared an export of the Netbeans configuration for the editor to adhere to the WordPress coding standard. I hope you find it useful! To import it, Click Tools -> Options in the top menu, then press the “Import” button in the dialog window that comes up and follow the instructions there.

What’s Next?

A nice feature that is not available to the extent of my knowledge would be templates for common WordPress files, like there are template for Java classes, and such. The way this would work is you could say “I’m going to make a new theme” and it would create all the files a theme requires. Or “I’d like to make a widget.”, “I’d like to write a shortcode.” and NetBeans would create the “boilerplate” code so you can get to coding right away.

Do you have any NetBeans tips you’d like to share with your fellow WordPress site builders? Do you know of a plugin for NetBeans that adds those templates I mention in the section above? Thanks for reading.

Patch for JWPlayer

I made a website for the Positive Parenting Program of the Manitoba Government while working at Canada’s Web Shop, and it had videos on one of the pages. Because the videos are self-hosted, I used the excellent JWPlayer for WordPress plugin, and it worked great except that when the staging site was brought down the videos stopped working.

It turns out that JWPlayer for WordPress is using WordPress guids instead of using the wp_get_attachment_url() function that makes it safe to move your WordPress website between domains. In short, the guid column in the posts table stores the original URL of the video, and if you change domains, the only way to get the correct URL is to use the aforementioned function.

I wrote a little patch, notified LongTail Video, and it is on its way to being included in the plugin.

Project Pier & Kamp Pro 2 on GitHub

I’m working with and on the Project Pier project management software again.

A colleague who was working as a project manager recently left Tactica, and I saw this as an opportunity to do more project management myself, which is what I’m always looking for opportunities for.

This week was really exciting for my project management efforts, but it also means I have to play a little bit of catch up with the development projects at work, since the project management work I do takes away time from development.

You can check out my GitHub fork of Project Pier to follow my development or get the latest version to use it for your project management needs. If you find a bug or have an idea for how to make the system better, I’d love to hear about it, and if I feel it would make the system better for me, it’s likely I will have a patch for it shortly.

For my needs, the part of project pier needing most attention is the UI. The architecture seems solid, and the project management paradigm is quite close to the one Basecamp implements.

To address the UI issues without forcing my ideas into the core, I’ve enabled the themes to overwrite any output of the system (HTML & Javascript), whereas they were only able to overwrite CSS & images before. You can follow my UI changes on my GitHub repository of the Kamp Pro 2 theme developed by the talented Andrew Dotson.

Website Data Backups with Version Control

I’ve been tasked with revamping the backup strategy at my new job, and I think I am finally happy with what I’ve come up with. As usual, I’m wondering what others have done when they were tackling such a task, and what you, dear reader, think about my setup. Please leave me a comment if you want to share your thoughts, or links to articles you’ve read that relate to anything discussed here (along with a short description of how it relates).

With websites, it appears there are three distinct data components that require backups: Code, content files, and the database. If you implement a well-thought-out version control setup, you can keep only one backup of the current repository, since it in itself contains all the revisions.

  • Code only ever changes when the developer makes an update, and always changes on the development server (I swear!). The developer commits his changes to version control manually, and then uses a deployment automation tool to publish the changes to the production server.
  • With content files and the database, the changes are mainly done on the production server, and since we are not going to ask the user to commit to our version control system, this should be automated, either at intervals, like daily – or if it is plausible – just-in-time, directly triggered through the CMS when content is added.)

With incremental backups to Amazon S3, we used to pay about $1/month for this service at the medium-size call centre I used to work at, so that part should be fairly inexpensive, but the overall cost of this setup is significantly higher if you are paying for a hosted VCS.

Again, I would really appreciate your thoughts on this, and links to articles written based on what others have learned from experience in this area. Thanks for reading!

New Version of the ProjectPier Project Management Web Application

I’ve been using the Basecamp project management web app at work for a while, and although I like certain features, I do not want to use that for my freelance work. I mostly do not want to use it because there is an excellent alternative that is very close to Basecamp in it’s functionality: ProjectPier, which presents a long-awaited opportunity for me to work on the code of an Open Source project.

The excellent PHP project management web application ProjectPier saw a new release, version 0.8.6, on December 31st, 2010. There has been a great number of new features added, and now the system is even more like Basecamp.

I’ve contacted the lead developer, and he is interested in learning more about me, and collaborating. The features I am currently most interested in adding are first the things that it does not have and basecamp does. I expect they will all be done in the theme. I plan to then move on to adding some features that I would like to have in a project management tool that we use at Canada’s Web Shop, which will be additions that will require more extensive work, up to and including additions to the database schema.

Should be fun!

New Project Management Tool for my Freelance Work

Bigger Playground for my Website Building Projects

I’ve recently moved my domain, bernardic.ca, to Network Redux web hosting servers. Chris Lowry originally registered the domain for me, in return for some advice I gave him and out of the goodness of his heart. The network redux account is provided by Mark Johnston for free. Mark is my friend and mentor who I met at a call centre I previously worked at. The new hosting allows for more websites to be hosted, so I installed a project management web app written in PHP, called Project Pier.

Professional Project Management Tool

This app provides me with a way to enter projects I am working on, enter associated tasks, and indicate when the tasks have been completed. I can create accounts for clients, so they can keep up to date with the status of the project, add new tasks, and share files. I hope this will improve the communication, as well as act as a reminder of what is left to be done, and it should work well as a central repository of information and files related to a particular project. It is fairly easy to install and use, and since it is written in PHP, I will probably tweak it to my need, and contribute bug fixes & feature enhancements back to the project.

oDesk

I recently discovered odesk, an online marketplace website, and joined it. The thing I like the most about it currently is the test-taking feature.

You can take tests for knowledge within different areas of Web development, and once you are done, your profile lists that you’ve completed the test, what score you achieved, etc. They even give you badges to put on your website, and they link to the oDesk profile page:

oDesk Certified CSS 2.0 Designer
oDesk Certified SQL Database Administrator
oDesk Certified PHP5 Developer
oDesk Certified Advanced PHP Developer
oDesk Certified HTML 4.01 Designer
oDesk Certified jQuery Professional
oDesk Certified LAMP Developer
oDesk Certified YAML Professional
oDesk Certified XHTML 1.0 Designer
oDesk Certified TCP/IP Consultant
oDesk Certified DHTML Developer
oDesk Certified AJAX Developer
oDesk Certified WordPress Expert
oDesk Certified Twitter Programmer
oDesk Certified Drupal Web programmer

I can write, too:
oDesk Certified English Writer
oDesk Certified English Spelling (U.S. Version) Professional
oDesk Certified English (Sentence Structure) Expert
oDesk Certified Resume Writer

A writing writer! 😀 It’s meant to be Resume Writer.