What’s the difference between a user story and an Epic when it comes to Agile?

They are very generic term actually. There is many way to interpret them, varying in the literature and how people see them. Take everything I say with a huge grain of salt.

It takes a thousand voices to tell a single story

Usually, an Epic comprise a very global and not very well defined functionality in your software. It is very broad. It will usually be broken down into smaller user story or feature when you try to make sense of it and making them fit in an agile iteration. Example :

Epic
– Allow the customer to manage its own account via the Web

Feature and User Story are more specific functionality, that you can easily test with acceptance tests. It is often recommended that they be granular enough to fit in a single iteration.

Features usually tend to describe what your software do :

Feature
– Editing the customer information via the web portal

User stories tend to express what the user want to do :

User story
As bank clerk,
I want to be able to modify the customer information
so that I can keep it up to date.

I don’t think there is really a hierarchy between the two, but you can have one if you want or if it fit how you work. A user story can be a specific justification for a feature, or a specific way to do it. Or it can be the other way around. A feature can be a way to realize a user story. Or they can denote the same thing. You can use both : User stories to define what bring business value and feature to describe constraint of the software.

User story: as a customer, I want to pay with the most popular credits cardsFeature support the GOV-TAX-02 XML API of the government.

There is also the question of scenario, which are usually a way a Feature/User story will be executed. They usually map cleanly to a specific acceptance test. For example

Scenario : Withdrawing money
Given I have 2000$ in my bank account
When I withdraw 100$
Then I receive 100$ in cash
And my balance is 1900$

That is how we define those terms where I work. Those definitions are far from a mathematical definition or a standardized term. Its like the difference between a right wing politician or a left wing politician. It depend where you live. In Canada, what is considered right wing may be considered left-wing in the United State. It’s very variable.

The important is that everyone on the team agree on a definition so you can understand each other. Some method like scrum tend to define them more formally, but pick what work for you and leave the rest. After all, isn’t agile about Individuals and interactions over processes and tools and Working software over comprehensive documentation?

To summarize, user stories should have three main characteristics:

– they are short, but descriptive. User stories do not capture every detail about the user, her background, her ideas and motivations. Instead, they give an immediate understanding of what we are trying to accomplish with our product.

– user stories define the user type. For instance in the sample user story mentioned above, we can clearly identify the user as a “frequent movie goer”. Note that we do not dive deeper into her personality, but just focus on the character traits relating to our product usage.

– user stories outline the main need or problem that our product should solve. In our example, it is defined as “have all the information… in my smartphone”.