Learning a New Codebase

Ben Ramsey - Mer, 17/09/2014 - 23:30

A few days ago, my friend Ed Finkler started a new job. Earlier this week, he posted on Twitter:

First days humble us all.


Having begun a new job myself, I shared Ed’s sentiment. Last weekend, while at the Madison PHP Conference, we were discussing what developers can do during the interview process to get an idea of the kind of codebase a company has. After all, the developer is interviewing potential employers just as much as they are being interviewed as a potential employee. It would suck to be hired only to find the code is in shambles. Short of signing an NDA and asking to see the their code, what can you do?

Here are a few tips I think go a long way in helping determine the state of a company’s codebase. If you have other ideas, feel free to leave them in the comments.

  1. Ask what coding standards the company follows. Can they articulate those standards well? Grill them on specifics. Be sure to ask this of the developers and not the managers. Otherwise, you might not get a good picture of how standards factor into their practices.

    For PHP projects, you should hear something about PSR-2 and PSR-1. If not, then at least the old PEAR coding standards should come up.

  2. Ask whether the company uses a dependency/package management tool. Answers to this question are a good indication of whether the company subscribes to a not invented here (NIH) philosophy. Companies that reuse code from a variety of third-party packages tend to—in my experience—have better structured and cleaner codebases. I’m not sure why this is, but I suspect it’s because the developers have more exposure to how others are doing things and pick up on best practices in this way.

    For PHP projects, you should hear the company talk about their use of Composer. At the very least, they should mention PEAR, but PEAR is waning.

  3. Ask how much of the code is covered by tests. There are unit tests, functional tests, integration tests, and acceptance tests. Maybe there are others that I’m not aware of. Start a conversation about which testing strategies the company uses and how many tests they have.

    For PHP and web projects, there are many different testing tools available. At the least, I would expect to hear a company talk about PHPUnit, but even if they don’t, there are plenty of other unit testing frameworks for PHP, so they may have chosen to use something else. If so, ask why. Questioning a company’s decisions isn’t important, but I think it is enlightening to understand what factors go into their decisions.

  4. Ask to have the company’s deployment process described. As a developer, will you deploy code, or is that handled by different people/teams? Will you be able to push code on your first day or in your first week? The timing isn’t as important as the processes around deploying, though. Try to get a sense for whether it’s a clean and straightforward process versus a haphazard and error-prone catastrophe.

As a follow-up, after you join a company, you are now faced with the daunting task of learning a new codebase. This morning, Ed asked in the #phpmentoring IRC channel on Freenode:

<funkatron> How do you deal with coming in to a huge code base you’re not familiar with?

Here are the two tips I offered from my experiences:

  1. Go through existing bug reports, fixing bugs. This helps you learn the code base, while feeling productive.
  2. Write tests. If they don’t have tests, start a test project and start writing them. Aim for some low percentage of code coverage (i.e. 5-10%) at first. It’ll help you learn the code base quickly.

What are your tips for questions to ask potential employers and learning a new codebase once you’ve begun a new job?

“Learning A New Codebase” was originally published at and is Copyright © 2014 Ben Ramsey.

Ben Ramsey is a web craftsman, author, and speaker. He builds a platform for professional photographers at ShootProof, organizes user groups, and lives in Nashville, TN with his wife, son, and dog named Echo. Ben blogs at and is @ramsey on Twitter.

Categorie: Not PHP-GTK

Setting Up Jenkins on Amazon Linux for PHP Testing

Ben Ramsey - Gio, 07/08/2014 - 16:45

One of my first tasks at ShootProof was to set up a Jenkins server for continuous integration and get it ready to run unit tests for PHP and JavaScript code. There are plenty of tutorials around the web to help you do just that. This is yet another one, but it’s primarily my cleaned-up notes—and less of a tutorial—placed here for my future self to find and provided publicly for all to benefit.

These instructions are specifically tailored for setting up Jenkins on an Amazon Linux EC2 instance. If that’s not what you’re running, your mileage may vary. These commands should run on RHEL-based systems, and with modifications to the package manager and names of packages, they should work on other Unix-like systems.

1. Launch and Prepare an EC2 Instance

The Amazon Linux AMI I used was the latest (at the time) paravirtual, 64-bit, instance store AMI (ami-ed8e9284), but choosing the latest for your region should work just fine. You can use an EBS-backed volume instead and set up regular snapshots of it, or you can follow these directions, create an AMI from your configured instance, and set up regular snapshots of the EBS volume we attach to the instance. Either way will work fine. I just happened to use an instance store with an EBS volume attached.

  1. Launch an EC2 instance (use this link to launch one, if you like)
  2. Create an EBS volume
  3. Attach the EBS volume to the instance you launched
  4. SSH to the instance, format and mount the EBS volume (see below)

I’m using XFS for the EBS volume’s file system, but you may use what you prefer. We’ll mount the volume at /var/lib/jenkins, so that we don’t have to do any complex trickery with the default jenkins user, home, and permissions. The EBS volume may exist at /dev/xvdf, as it does in the following example, or it may be attached at another point. See also Amazon’s guide to “Making an Amazon EBS Volume Available for Use.”

Note: All of these instructions require root access. You may prefix them with sudo, or you may change to the root user.

1 2 3 4 $ yum install xfsprogs $ mkfs -t xfs /dev/xvdf $ mkdir -p /var/lib/jenkins $ mount /dev/xvdf /var/lib/jenkins

Now, the volume is mounted at /var/lib/jenkins. We want to ensure it always gets mounted there when we restart the instance, so let’s add a line to /etc/fstab:

1 2 3 $ cp /etc/fstab /etc/fstab.orig $ sh -c 'echo "/dev/xvdf /var/lib/jenkins xfs defaults,nofail 0 2" >> /etc/fstab' $ mount -a 2. Install and Start Jenkins

Installing and starting Jenkins is fairly simple. We need to add the official Jenkins project repository to the list of yum repos, and then we install with yum, start the service, and ensure that Jenkins starts up on a reboot.

1 2 3 4 5 6 $ wget -O /etc/yum.repos.d/jenkins.repo $ rpm --import $ yum update $ yum install jenkins $ service jenkins start $ chkconfig jenkins on 3. Configure the Server for Running Tests

Now, we need to install some stuff on the system so that Jenkins can do its thing. These instructions are intended for tests that use the Template for Jenkins Jobs for PHP Projects. This will give you a basic PHP installation with all the tools necessary to run the template. If you need to use anything that deviates from the stock template, then you’ll need to make changes.

1 2 3 4 $ yum install ant git graphviz gcc gcc-c++ $ yum install php55 php55-devel php55-common php55-cli php55-intl php55-gd php55-pecl-imagick php55-mbstring php55-mcrypt php55-mysqlnd php55-pdo php55-pecl-xdebug $ sh -c 'sed -i "s/^memory_limit =.*/memory_limit = 256M/" /etc/php.ini' $ sh -c 'sed -i "s/^;date\.timezone =.*/date\.timezone = America\/New_York/" /etc/php.ini' Node.js

Since I want to use Node.js for various build tools and to run JavaScript tests, I installed Node.js from source (yum always seems to have an outdated package). If you don’t need Node.js, you may skip this.

1 2 3 4 5 6 7 $ wget $ tar zxf node-v0.10.30.tar.gz && cd node-v0.10.30 $ ./configure $ make $ make install $ ln -s /usr/local/bin/node /usr/bin/node $ ln -s /usr/local/bin/npm /usr/bin/npm

See those last two lines where I’m creating symlinks? This is because the jenkins user doesn’t have /usr/local/bin in its PATH. Rather than adjusting the user’s PATH, I chose to create symbolic links in /usr/bin, so that jenkins can find the node and npm programs.

PhantomJS and CasperJS

Finally, I also want to install PhantomJS and CasperJS to supplement and aid in my JavaScript testing. If you don’t need these, you may skip this.

1 2 3 4 5 6 7 $ yum install fontconfig freetype $ wget --no-check-certificate $ tar jxf phantomjs-1.9.7-linux-x86_64.tar.bz2 $ cp phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs $ npm install -g casperjs $ ln -s /usr/local/bin/phantomjs /usr/bin/phantomjs $ ln -s /usr/local/bin/casperjs /usr/bin/casperjs

Notice the symbolic links created in the last two lines again. This is for the same reason I mentioned earlier: to help the jenkins user find these programs in its PATH.

4. Configure Jenkins

Now, we’ve got Jenkins running, and the server has been configured to run our tests. You can go to Jenkins in a web browser to do the rest. By default, Jenkins runs on port 8080, so you can go to to set it up.

The first thing you’ll want to do is enable security. I prefer to install the GitHub OAuth Plugin and use GitHub to authenticate with Jenkins. I would also recommend setting up a proxy to Jenkins through Apache or Nginx and installing an SSL certificate to encrypt your communications with Jenkins. You might also consider using AWS security groups to restrict access to Jenkins by IP addresses. All of these are outside the scope of this post.

  1. Install the Jenkins plugins required by the Template for Jenkins Jobs for PHP Projects. You’ll also need to install the required PHP tools listed on that page, or you may choose to use my jenkins-php meta-package with Composer to install them for you when you run Jenkins builds. If you choose the latter, be sure to set up your Ant build.xml script to also run composer install on each build during the “prepare” stage and point the executable for each tool to the vendor/bin/ directory (where Composer installs them).
  2. Create the Ant build.xml script for your project.
  3. Install the job template for PHP jobs and set up your first job using the template.

Here are a few other plugins that might come in handy:

  • GitHub Plugin: this plugin allows you to configure a job to pull source from a GitHub project, and you can set up GitHub web hooks to trigger builds on each code push to the repo
  • GitHub pull request builder plugin: this plugin will allow you to trigger a build on a pull request
  • HipChat Plugin / IRC Plugin / Slack Notification Plugin: these plugins allow you to configure a job to send messages to channels on your favorite team chat servers

“Setting Up Jenkins on Amazon Linux for PHP Testing” was originally published at and is Copyright © 2014 Ben Ramsey.

Ben Ramsey is a web craftsman, author, and speaker. He builds a platform for professional photographers at ShootProof, organizes user groups, and lives in Nashville, TN with his wife, son, and dog named Echo. Ben blogs at and is @ramsey on Twitter.

Categorie: Not PHP-GTK

My First Month at ShootProof

Ben Ramsey - Lun, 04/08/2014 - 04:00

It’s difficult to write a blog post about a new gig without coming across as sounding critical of past employers. That’s not my intent, but this first month I’ve spent at ShootProof has been one of the best months I’ve had in a long time, career-wise.

My first day at ShootProof was July 1st, and as I’ve come to my one-month anniversary with the company, I wanted to share some of the reasons that attracted me to ShootProof and why I’m still excited about it, after a month of working here.

The Team

The primary reason I joined ShootProof was for the team. I had worked with Robert Swarthout and Brian DeShong previously at Schematic (now POSSIBLE). We worked well together then, and the opportunity to work with them again was almost too good to be true. On top of that, ShootProof hires the best. With folks like Jenn Downs, Terry Allen, Kevin Bandy, Josh Davies, Colin Breece, and the rest of the ShootProof team, ShootProof really is a dream team.

At PHP Tek 2009, my friend Sean Coates gave me some awesome career advice. He said, “You need to work with people who know you.” At ShootProof, I am doing just that, and it’s a great working relationship.


Another thing that attracted me to ShootProof is its funding. As of today, it’s 100% bootstrapped. Ideologically, I’m not one of those who say your company must be bootstrapped or VC funded. There are pros and cons to both types of funding. But having experienced VC funding, a bootstrapped company had a certain appeal to me: all the investors have “skin in the game” in both the monetary investment sense, as well as the agile “pig” sense.

What this means for me is that I work on a daily basis with the primary decision makers in the company, and these decision makers answer only to themselves (and our customers). There’s a great deal of freedom and trust in this relationship.

Will we always remain bootstrapped? That’s not a question for me to answer or even to presume to know the answer. There are a variety of reasons we may or may not consider funding in the future, and that’s a question for our founders to tackle, but for now, the fact that we’re bootstrapped is important to me. It all comes back to the team. We’re intimate. We’re lean. We’re agile. We’re not tied down by VC money. We work only for our customers and ourselves.

Top-notch Support Team

After meeting with Colin, I realized that ShootProof not only prides itself in building a great product, but our special sauce is our customer support team. Our loyalty builders will do whatever it takes to ensure the happiness of our customers. I know this makes me sound rather dense and naïve, having worked in the industry for so many years, but after hearing about the work of our customer support team, I realized that customer support is just as much a part of our product as the code that makes up our web properties. I’m proud of the work they do, and I’m excited to be a part of their team.

User Experience

Along with customer support, ShootProof is working to ensure we have the best possible user experience for our customers. That’s why we have ace UX folks on our team.

User experience has always been an important cornerstone of software development to me. How users feel when they interact with your software interface determines whether they want to continue using it or not. Working at Schematic showed me how UX must be a discipline to any software company. I am more than thrilled that ShootProof feels the same way and has made it a crucial tenet of our process.


As Brian said in his “Joining ShootProof” blog post, I also sought out ShootProof because I love to build products. I want to work for a company that is product-focused. Not only is ShootProof product-focused, they know their customer so well that they have been able to hone in on exactly what product to build for those customers. In fact, many of our team members are professional photographers themselves. That expertise and specificity is another reason I was attracted to ShootProof.


ShootProof is a startup and a bootstrapped start-up at that. While I said earlier that the bootstrapped nature of the company attracted me, I would be lying if I said that revenue was not important. Many times, we hear “bootstrapped startup” and assume this means the company is not making any money. That is not the case with ShootProof. I can’t share numbers, but I can say that year-over-year growth has been sizable.


I’m not interested in joining a fly-by-night startup whose desire is to jump into a market, disrupt it, and get out quickly, making tons of money. Those get-rich schemes rarely succeed and don’t appeal to me. Money is nice, but not at the expense of my family, health, and relationships. ShootProof is a company with focus, a clear direction, and respect for its team members.

Recently, Cal Evans wrote a blog post entitled, “It’s All About Culture.” In it, he wrote:

The bedrock of a good developer culture is respect. Respect for the fact that you have developers to build things on which the company is based. Respect for the fact that without developers, the company most likely would not exist. Culture is not putting developers on a pedestal and offering them trinkets as tribute. Culture is understanding that developers aren’t cogs in a machine that can be replaced on a whim.

Culture is one of those things that’s difficult to define and hard to articulate, but I think Cal hits the nail on the head here. A good culture focuses on the people who make up the team. ShootProof’s culture is one of respect for each other. The focus is on people. One of the things Robert said to me when we were first discussing the possibility of me joining ShootProof is that he wants to build a first-class team that makes others say to themselves, “That’s a great team! I want to work with that team, too.”

The people and the focus on the people are what attracted me to ShootProof, and that’s why I’m still excited about ShootProof a month after joining them.

“My First Month at ShootProof” was originally published at and is Copyright © 2014 Ben Ramsey.

Ben Ramsey is a web craftsman, author, and speaker. He builds a platform for professional photographers at ShootProof, organizes user groups, and lives in Nashville, TN with his wife, son, and dog named Echo. Ben blogs at and is @ramsey on Twitter.

Categorie: Not PHP-GTK

All Good Things...

Ben Ramsey - Lun, 02/06/2014 - 20:00

Over the past month or so, I have wrestled with one of the hardest decisions I’ve faced in my career. I’ve spent just over one-fourth of my professional career with Moontoast—4.5 years. This is a long time in Internet years. During my time here, I’ve learned a lot about startups, building Internet products, running in the cloud, and much more. There are great things happening at Moontoast—changes that make it a stronger, more effective company with an awesome product. It’s an exciting time to be a part of the company! For me, it’s been an excellent ride, but it’s time to move on.

I do not currently have another job lined up, though I do have a number of opportunities that are under discussion. One of the primary reasons for this career move is my lack of involvement in the greater PHP and general open source communities over the last three years. I believe my visibility and personal brand have diminished, and that’s something I want to change.

In particular, here are some areas I want to focus on:

  • Blogging: In 2009, I made 24 blog posts. In 2008, I made 27. In 2007, 43. Notice a trend? Since January 2010, I have made only 17 blog posts in four years. Blogging is a great way to position yourself as a thought leader; my lack of blogging shows that I’ve not been leading any thoughts.

  • Speaking at Conferences: I enjoy speaking at conferences. I enjoy teaching. Over the last few years, I have done very little of this, and that’s been bothering me. I want to return to the conference circuit in a big way.

  • Thought Leadership: Thought leadership is one of those areas of personal branding that helps set you apart from other speakers and writers. It’s a way of defining your niche and making you one of the “go-to” people in the industry for a particular topic. I have focused little on my personal thought leadership over the last few years, and I will be changing this. I will return my focus to APIs and HTTP, but I will be focusing more on practical integrations and real-world applications, rather than theory and design.

  • Writing a Book: I am currently working on the outline of a technical book. I hope to finish the book this year. More details on this later.

  • API and Integrations Consulting/Training: I have given thought to consulting or training on APIs and integrations. If this is something that interests you, let me know, and we can talk specifics.

  • Hacking on Open Source Software: I’ve made small contributions to the PHP core, as well as other open source projects, but I want to begin contributing even more to open source libraries, tools, and SDKs.

I’m looking forward to what the rest of the year holds for me. It’s an exciting time, and I can’t wait to get started!

In evaluating opportunities, I have been asking about potential employers’ comfort level with all of the above. As an employer, if these are things you like, encourage, and think can make your own brand stronger, then I’d love to talk to you. Feel free to reach out to me via email at ben at

“All Good Things…” was originally published at and is Copyright © 2014 Ben Ramsey.

Ben Ramsey is a web craftsman, author, and speaker. He builds a platform for professional photographers at ShootProof, organizes user groups, and lives in Nashville, TN with his wife, son, and dog named Echo. Ben blogs at and is @ramsey on Twitter.

Categorie: Not PHP-GTK
Condividi contenuti