Thursday, October 20, 2016

Testing PHP Code with Atoum – an Alternative to PHPUnit

If you’ve been around PHP for more than a little while, you’ve no doubt started to test your code. And if you ask anyone in the PHP space what to use for writing unit tests, likely the first answer that they’ll give you is PHPUnit.

It’s the de facto standard in the PHP community, and with good reason. But it’s not the only choice. Whilst it does command the lion’s share, other choices abound, one of which I’m going to take you through in this tutorial; it’s called atoum.

If this is your first time hearing about it, it is self-described as:

A simple, modern, and intuitive unit testing framework for PHP!

Atoum logo

I can’t necessarily vouch for it being all that intuitive, but it definitely is reasonably simple to use. And whilst its composer.json currently specifies a minimum version of PHP 5.3.3, one of the core developers told me that from version 3.0 support for PHP 5.3 will be officially dropped in favor of PHP 5.6. So don’t be fooled, it is a modern take on testing in PHP.

Recently, I decided to give it a test run on an existing codebase of mine, a health monitoring application which I’ve been writing to help me deal with some health problems I’ve had over the last 12 - 24 months. I found it to be an interesting take on software testing, combining several different styles into the one package.

Installing Atoum

Like all modern PHP software, we install it with Composer.

composer require atoum/atoum

For the purposes of this tutorial, I’ll assume that you’re following along using PhpStorm. No offense meant to Vim, Emacs, and other editors.

Given that, and given how atoum’s source code is structured, we should also install a supplementary library called atoum/stubs.

Without it, attempting to perform any kind of code completion in your IDE with atoum is less than straight-forward. Stubs make working with atoum much more user-friendly, as the graphic below will attest.

Using atoum stubs with PhpStorm for code completion

composer require atoum/stubs

Configuring atoum

Now that it’s installed, let’s perform some preliminary configuration. Specifically, what we’re going to do is to configure how code coverage will reported, as well as what the test reporting will look like when run from the terminal.

This isn’t strictly necessary, but as we may be looking at the test output in the terminal a lot, it helps to give a bit of life to it. Second, whilst the built-in code coverage is pretty good, sometimes viewing it through a browser is just easier to do, as we’ll see in a little while.

If this is your first time hearing about code coverage, code coverage reports the percentage of the codebase which is covered by tests. Code coverage reports help us know how complete our tests are, and how confident we can feel when making changes to the code. So, while there is some work involved in getting code coverage set up, it’s worth having in place.

Continue reading %Testing PHP Code with Atoum – an Alternative to PHPUnit%


by Matthew Setter via SitePoint

7 Steps to Write Content that Converts

How to write content that converts

This article is part of an SEO series from WooRank. Thank you for supporting the partners who make SitePoint possible.

How do you write content that is informative, entertaining, authoritative and advertises your product? All at the same time, and usually without the reader knowing they are being moved through a conversion funnel. Creating good copy can be one of the most difficult parts of a marketer’s job. Even if your content ranks well in search engines, there’s no guarantee it will convince a reader to complete a purchase, email signup, contact form or whatever conversion you measure. The good news is that we’ve come up with a 7 step process to discover what content your audience likes, what keywords they use to find that content, and how you can create your articles to encourage more sales.

Get Strategic

One of the hardest parts of writing good content is figuring out where to start. You can start by just writing, figuring out what you want to say as you go. But then how do you know if your messaging will resonate with your audience? Or if people are even looking for that sort of content to begin with? As the saying goes, if you fail to plan, you plan to fail. So, step one in writing content that converts is to plan.

1. Track the Conversation

Start by finding what people are currently sharing and linking to. People share and link to content they find useful, entertaining, informative or all three. Learning what’s currently being shared will give you insight into what resonates with your potential customers. You can use Buzzsumo or Ahrefs to search for your industry, products or topic and find pages that have been shared via social media platforms and backlinks.

Buzzsumo content that converts screenshot

Shares don’t tell the whole story, though. You also need to tune into the conversations people are having online. Twitter’s new dashboard feature, custom feeds, is a really useful tool for this. You already get notified by Twitter whenever someone mentions your Twitter @username, but you’re still missing out on the majority of the conversation. Your custom feed lets you track mentions for any words, phrases or hashtags that are relevant to your content marketing. So at WooRank, we can learn what people are saying about SEO and marketing tool needs and tailor our messaging to meet those needs.

Twitter dashboard custom feed

Finally, set up a Google Alert for your company, product and/or industry. As the name suggests, Google Alerts will send you notifications with articles or pages that mention your keyword. This is also great for brand and reputation management.

Content marketing Google Alert screenshot

2. Get In Front of Your Audience

The second part of planning your content is to make sure you’re building it around words and phrases that people are actually using to find information on your topic. That means our friend, keyword research. Start by gathering information from your Google Search Console account to find your most successful keywords — keywords that currently rank well and/or send the most clicks.

Google Search Console search analytics

WooRank’s SERP Checker will help you determine which of your keywords get enough search volume to bother targeting. Add up to three competitors so you can find where you can beat them, and identify any gaps in their keyword strategy you can exploit.

WooRank SERP Checker

Once you have that list, there are lots of good free tools you can use to find more ideas for keywords to target.

3. Segment Your Audience

One message is not going to be effective for all of your potential customers. You’re better off creating content that sends different messages, each aimed at a different buyer persona (also known as a marketing persona). Buyer personas are generalized, fictionalized versions of your various types of customers. They represent who’s interested in your business and the different ways they use your product.

Continue reading %7 Steps to Write Content that Converts%


by Greg Snow-Wasserman via SitePoint

How & Why to Use the Kanban Methodology for Software Development

Post-its for the Kanban board

You’ve probably heard of the Kanban project management methodology, but you may not know a lot about it. What are the differences between Kanban and other agile methodologies like Scrum, and instruments like the Gantt chart? What is the Kanban methodology used for?

Let’s take a look at the origins of Kanban, answer these questions, and see how it’s used in practice.

The Main Principles of the Kanban Methodology

The term Kanban comes from Japan thanks to the Toyota production system, which is well-known in narrow circles. It would be great if everyone knew about the Kanban methodology and its basic principles: lean manufacturing, continuous development, customer orientation, etc. All the principles are described in Taiichi Ohno's book, Toyota Production System: Beyond Large-Scale Production.

The term Kanban has a verbatim translation. “Kan” means visible or visual and “ban” means a card or board. Cards of the Kanban methodology are used throughout the Toyota plants to keep inventory management lean — no cluttered warehouses, and workshops with sufficient access to parts.

Imagine that your workshop installs Toyota Corolla doors and there is a pack of 10 doors near your workspace to be installed, one after another, onto new cars. When there are only five doors in the pack, you know that it is time to order new doors. Therefore you take a Kanban card, write an order for another 10 doors on it, and bring the card to the workshop that manufactures doors. You are sure that new doors will be manufactured by the time you have used the remaining five doors.

That's the way it works in Toyota workshops: when you are installing the last door, another pack of 10 doors arrives. You constantly order new doors only when you need them.

Now imagine that this Kanban system works all over the plant. There are no warehouses with spares laying around for weeks or months. All the employees work upon requests and manufacture the only the necessary amount of spares. If there are more or fewer orders, the system will match the changes.

The main idea of Kanban methodology cards is to scale down the amount of work in progress. For example, due to the Kanban methodology, only 10 cards for doors may be given for a whole manufacturing line. It means that only 10 ready-made doors will be on the line at any time during the production loop. Deciding when those doors are ordered is a task for those who install them. Always limited to 10 doors, only the installers know the upcoming needs of the workshop and can place orders with the door manufacturer.

This methodology of lean manufacturing was first introduced at Toyota, but many companies all over the world have adopted it. But these examples refer to manufacturing, not to software engineering.

How Does the Kanban Methodology Work for Software Development?

Let's start by looking at the differences in project planning between Kanban and other agile methodologies.

The difference between the Kanban methodology and SCRUM is that:

  • There are no time boxes in Kanban for anything (either for tasks, or sprints)
  • The tasks in the Kanban methodology are larger, and there are less of them
  • The period assessments in Kanban are optional, or there are none of them at all
  • There is no “speed of team” in Kanban — only average time for a full implementation is counted

Now look at this list and think: what will remain of the agile methodology, if we remove sprints, increase dimensions and stop counting the speed of the team’s work? Nothing?

How is it even possible to talk about any supervision over development if all the major tools of control are removed? This is, probably, the most important question for me in the Kanban methodology.

Managers always think about control and try to attain it, though they don’t really have it. A manager’s supervision over the development process is a fiction. If a team doesn’t want to work, it will fail a project despite any level of control.

If a team has fun while working and works with total efficiency, then there is no need for control, because it just disturbs the process and increases costs.

For example, a common problem with the SCRUM methodology are higher costs due to discussions, meetings and big losses of time at the joints of the sprints, when at least one day is wasted to complete a sprint and one more day to start another. If a sprint is two weeks, then two days out of two weeks is 20%, which is a heck of a lot. So while using SCRUM methodology, just about 30-40% of the time is wasted on supporting the process itself including daily rallies, sprint retrospectives and so on.

The Kanban development methodology differs from SCRUM with its focus on tasks. The main objective of a team in SCRUM is the successful completion of a sprint. In the Kanban methodology, tasks take first place. There aren’t any sprints and a team works on a task from beginning to end. The deployment is made when it is ready based on the presentation of work done. A team that follows the Kanban methodology should not estimate time to fulfill a task, since there is no sense in it and these estimates are almost always incorrect.

Why should a manager need a time estimate, if he or she believes in the team? The objective of a manager who uses the Kanban methodology is to create a prioritized task pool, and the team's objective is to fulfill as many items from this pool as possible. That’s it. There is no need for any control measures. All the manager needs to do is add items to the pool or to change their priority. This is the way a Kanban manager runs a project.

The team works from a Kanban board. It may look like this:

Continue reading %How & Why to Use the Kanban Methodology for Software Development%


by Sergey Laptick via SitePoint

How to Create More Fun, Playful Typography

Days App

opl-small

Slick looping demo vids within the devices in this One Pager promoting 'Days' calendar app by Matt Davenport.

by Rob Hope via One Page Love

Progressively – JavaScript Library to Load Images Progressively

Progressively is a javascript library for loading images progressively. It’s written entirely in JavaScript and super small. It will load images on when user browse to the page, saving bandwidth & server requests.


by via jQuery-Plugins.net RSS Feed

EverythingInBetween

opl-small

Minimal One Pager for London-based design studio, EverythingInBetween. The About section content is already loaded on first visit (keeping this One Page) but would have liked to return to the same slide I was on when clicking for more info. Lovely little touch how the EverythingInBetween text logo turns to EIB on mobile.

by Rob Hope via One Page Love