Drupal Development: A Solved Game
by Michael Cooper
Way back in the olden days (around the year 2000) how we developed for the web was a solved game. An example of a solved game is Checkers (English draughts, if you will). Given that both players play perfectly, the outcome of the game can be predicted at any point.
Web development was the same: Use the lightest text editor you can find and find a good FTP program like Filezilla and that was that. The code you had to write wasn’t solved by any means, but the surrounding infrastructure, stack, and knowledge-set was.
As the years went on, websites moved from static HTML pages to dynamic systems powered by a lot more than just Apache. PHP, MySQL, Memcache, APC, Nginx, Varnish, etc… appeared on the scene and things got a lot more complicated. Add to that the fact that you certainly don’t want to have front-end systems doing backed tasks and suddenly even your own software has to become a service providing data to other parts of your software.
In the context of solved and unsolved games this is the “search space”. The larger the search space, the harder it is to solve the game. Over the last decade the size of this space has increased astronomically for web software development. Your toolkit has to be a lot bigger and the breadth of your knowledge must encompass multiple systems and even disciplines.
This new search space is not solved, but just like an aspiring chess player can lean on videos and books to improve their game the list below can help you improve yours. Over the next several months we’ll be talking about what you need to know to be a successful Drupal developer. Below is a quick list of the sorts of tools you need to know about and the methodologies and practices with which you need to be familiar.
This list is by no means exhaustive, but in understanding the items below you will be exposed to other solutions and technologies and have the foundation to broaden your understanding and appreciation of what is involved in being a top-notch web-developer in the Drupal space.
Here’s our list ‘o things:
The Methods and Ideology
Agile: If you’re not agile then... well, you’re not agile. Agile is a software development methodology that accelerates development of software, takes a more iterative approach and focuses on reducing uncertainty in the development process.
Continuous Integration: The ideal way to write and release code is in the smallest snippets possible. You’ll have the least chance of regression and the easiest recovery in case of error. CI also involves design, build, test, deploy, learn loops that you use to improve with every release.
Version control system (VCS): Git or SVN, you’ll need to know one and understand the tenants. If you can’t roll back to the code you ran yesterday, diff a change, or know by whom and when a piece of code was changed, then there are efficiencies that you are missing.
The Backend, Stack, and Database
PHP: This ain’t your grand-pappy’s PHP anymore. Namespaces, autoloaders, composer, symfony2, PHP 5.4, oh my! Many of us got to PHP 5.2 and took a moment to catch our breath. That moment is over and you ought to head over to php.net and read some release notes.
Reverse Proxy Caching (Varnish, et al): Most visitors to your site are served the same HTML as the last visitor. Why bootstrap Drupal hundreds of times when it doesn’t have to be. Reverse proxy caching will make your whites whiter and your brights brighter!
MySQL: It’s been around the block and it’s still one of the best ways to store your data. It’s not the only way, so you need to know when is the right time for MySQL and when it’s the wrong time.
Memcache: It’s a NoSQL store, it’s a key/value store, no, its memcache! Redis makes a better cache for Drupal (IMHO), but better than sticking stuff on disk in MySQL when you don’t need it to be persistent.
Redis: If you want the glory of a fast key/value store with the power of a NoSQL persistent storage engine, then Redis is the database for you!
Load Testing: No one likes the unknown. Will your site fail when it goes live? You need to know how to load test. From simple tools like apache benchmark to more complex setups using Jmeter it pays to be prepared.
User Testing: How will your users use your site? Did the code you just push cause any regressions? User testing services like Utest can answer some questions, while front-end browser emulators like Selenium can test your website to ensure that it functions as planned.
Jenkins: He’s not just a butler for your door, he’s the butler for your tests. Jenkins can manage your tests, show you your regressions and with careful care and feeding give you the coveted green test board.
SaSS: Ever wanted to set a variable for a hex code and just use that everywhere? Now you can! It’s like the stylesheet for stylesheets.
Static Code Analysis: You can know if you’ve written insecure code before it goes live. Check out PHP Code Sniffer and find your security flaws before attackers do.
Instrumentation and Analysis
Statsd and Graphite: There could be dragons living in your site and you don’t even know. Instrumenting your code is an important step in building a house of data. If things happen on your site that you don’t see, then this is a must.
New Relic and Traceview: Application monitoring tools can tell you if your app is healthy or if it is getting close to its breaking point. Know that the site needs help before your boss calls you to tell you it’s not loading.
Yottaa: Does your site deliver HTML quickly, but then have dozens of DNS calls and other assets to load? Optimize your site with a front-end optimizer and CDN. Yottaa can make your site load as much as 80% faster!
Logs: The answers to all your problems are in your logs. Tools like Logstash, Graylog, Loggly, and Splunk are the difference between you spotting a trend and smashing your head against your keyboard.
Chances are that your IDE knows exactly what your code should look like and can tell you if it sucks. Free IDEs like Netbeans or Sublime can do everything from format your code on save to tell you if it passes your unit tests. Netbeans can even integrate with tracking tools like JIRA, manage Git or SVN and cook your supper!
I’ve often heard it being said that Drupal is an awesome thing to build a CMS on. If you don’t know how your users want to use their CMS, then you won’t build the right thing. Learn about who you’re building for, what they’re trying to solve and propose solutions that will make them more efficient.
The open-source explosion has littered the web’s landscape with a sea of options. Getting your feet wet is the first step, and the list above is a great way to start. The teams at Acquia use the software, systems and methodologies above (plus several more) every day to do their jobs and deliver the best possible solutions to their customers.
As I’d mentioned, this list is by no means exhaustive, but meant to be a solid starting point. Think I missed something foundational? Throw a comment below, I’d love to discuss.