Edge cases are listed explicitly in the spec.
Edge cases são listados explicitamente no spec.Aula
Specifications and acceptance criteria C1
Nível: C1
Objetivo
Escrever specifications e acceptance criteria C1 com edge cases, error states, accessibility, analytics, privacy e operational requirements. O foco é especificação que sobrevive à ambiguidade e o que pode ser medido em produção.
Explicação
Specifications e acceptance criteria em C1 não são 'lista de requisitos'; são contratos que sobrevivem à ambiguidade. Seis eixos:
1. Edge cases
Comportamento em limites. C1 cita: 'what happens when the cart is empty? when the user has 0 items? when the input is null?'. Edge cases em C1 são listados explicitamente, não 'deixados para o developer descobrir'.
2. Error states
Comportamento quando algo dá errado. C1 cita: 'what is the user-facing message? what is the log? what is the metric?'. Error states em C1 cobrem o happy path E o failure path.
3. Accessibility
A11y não é opcional. C1 cita: 'WCAG 2.1 AA compliance: keyboard navigation, screen reader, color contrast 4.5:1'. Accessibility em C1 é acceptance criterion, não 'nice to have'.
4. Analytics
O que precisa ser medido. C1 cita: 'events: checkout_started, checkout_completed, checkout_failed; properties: cart_value, payment_method'. Analytics em C1 define o que o produto vai medir.
5. Privacy
O que não pode ser coletado. C1 cita: 'PII fields are hashed; logs do not include user_email; GDPR right-to-erasure is supported'. Privacy em C1 é acceptance criterion, não 'compliance afterthought'.
6. Operational requirements
Como o time opera o sistema. C1 cita: 'the alert fires at error rate > 1% for 5 minutes; the on-call rotation is Berlin/São Paulo; the runbook is in the wiki'. Operational em C1 é parte do spec, não 'depois a gente opera'.
Exemplos
| Inglês | Tradução | Observação |
|---|---|---|
| What happens when the cart is empty? when the user has 0 items? when the input is null? | O que acontece quando o carrinho está vazio? quando o usuário tem 0 itens? quando a entrada é nula? | Edge cases: limites explícitos. |
| What is the user-facing message? what is the log? what is the metric? | Qual é a mensagem para o usuário? qual é o log? qual é a métrica? | Error states: comportamento completo. |
| WCAG 2.1 AA compliance: keyboard navigation, screen reader, color contrast 4.5:1. | Conformidade com WCAG 2.1 AA: navegação por teclado, leitor de tela, contraste de cor 4.5:1. | Accessibility: standard mensurável. |
| PII fields are hashed; logs do not include user_email; GDPR right-to-erasure is supported. | Campos de PII são hashados; logs não incluem user_email; direito ao esquecimento do GDPR é suportado. | Privacy: regras explícitas. |
Erros comuns
- Spec sem edge cases: 'o sistema faz X' é genérico; 'o sistema faz X com carrinho vazio, com 0 itens, com entrada nula' é spec.
- Error states vagos: 'mostra erro' é genérico; 'mostra mensagem Y, loga erro Z, dispara alerta A' é spec.
- A11y afterthought: 'vamos fazer a11y depois' é tarde; C1 inclui WCAG desde o spec.
- Analytics sem definição: 'vamos medir conversão' é genérico; 'event checkout_completed com cart_value e payment_method' é spec.
- Privacy como afterthought: 'vamos cuidar de GDPR depois' é multa esperando; C1 inclui privacy no spec.
- Ops como afterthought: 'o time opera' é genérico; 'alert em error rate > 1% por 5 min' é spec.
Prática guiada
Reescreva cada spec abaixo no padrão C1.
- Edge cases: liste o que acontece em cada limite (vazio, null, 0, max).
- Error states: cite mensagem, log, métrica.
- A11y: cite WCAG 2.1 AA com critérios mensuráveis.
- Analytics: cite evento e propriedades.
- Privacy: cite regras de PII, logs, GDPR.
- Ops: cite alerta, on-call, runbook.
Resumo
Spec C1 tem seis eixos: edge cases (limites), error states (mensagem + log + métrica), accessibility (WCAG 2.1 AA), analytics (eventos + propriedades), privacy (PII + GDPR), operational (alert + on-call + runbook). Spec sem esses eixos é genérico; com eles, é contrato que sobrevive à ambiguidade.
Vocabulário
Palavras principais
Error states include the user-facing message, the log, and the metric.
Error states incluem a mensagem para o usuário, o log, e a métrica.WCAG 2.1 AA compliance is an acceptance criterion.
Conformidade com WCAG 2.1 AA é um acceptance criterion.WCAG 2.1 AA is the standard we follow.
WCAG 2.1 AA é o padrão que seguimos.PII fields must be hashed.
Campos de PII devem ser hashados.GDPR requires right-to-erasure.
GDPR requer direito ao esquecimento.GDPR right-to-erasure must be supported.
Direito ao esquecimento do GDPR deve ser suportado.The on-call rotation is split between Berlin and São Paulo.
A rotação de plantão é dividida entre Berlim e São Paulo.História
História: Specifications and acceptance criteria C1
Nível: C1
História em inglês
Writing the spec for the new checkout feature
On Thursday, I had to write the spec for the new checkout feature. I opened with edge cases: what happens when the cart is empty? when the user has 0 items? when the input is null? I added error states: for each failure, what is the user-facing message, the log, and the metric? I included a11y: WCAG 2.1 AA compliance, with keyboard navigation, screen reader, and color contrast 4.5:1. I added analytics: events checkout_started, checkout_completed, checkout_failed; properties cart_value and payment_method. I closed with operational requirements: alert at error rate > 1% for 5 minutes; on-call rotation split between Berlin and São Paulo.
Tradução linha por linha
| Inglês | Tradução |
|---|---|
| On Thursday, I had to write the spec for the new checkout feature. | Na quinta, eu tive que escrever o spec para a nova feature de checkout. |
| I opened with edge cases: what happens when the cart is empty? when the user has 0 items? when the input is null? | Eu abri com edge cases: o que acontece quando o carrinho está vazio? quando o usuário tem 0 itens? quando a entrada é nula? |
| I added error states: for each failure, what is the user-facing message, the log, and the metric? | Eu adicionei error states: para cada falha, qual é a mensagem para o usuário, o log, e a métrica? |
| I included a11y: WCAG 2.1 AA compliance, with keyboard navigation, screen reader, and color contrast 4.5:1. | Eu incluí a11y: conformidade com WCAG 2.1 AA, com navegação por teclado, leitor de tela, e contraste de cor 4.5:1. |
| I added analytics: events checkout_started, checkout_completed, checkout_failed; properties cart_value and payment_method. | Eu adicionei analytics: eventos checkout_started, checkout_completed, checkout_failed; propriedades cart_value e payment_method. |
| I closed with operational requirements: alert at error rate > 1% for 5 minutes; on-call rotation split between Berlin and São Paulo. | Eu fechei com requisitos operacionais: alerta em error rate > 1% por 5 minutos; rotação de plantão dividida entre Berlim e São Paulo. |
Notas de vocabulário
- what happens when the cart is empty, 0 items, input is null = Edge cases: limites explícitos.
- user-facing message, log, metric = Error states: comportamento completo.
- WCAG 2.1 AA: keyboard, screen reader, contrast 4.5:1 = A11y: standard mensurável.
- events checkout_started, checkout_completed; properties cart_value, payment_method = Analytics: evento + propriedades.
- alert at error rate > 1% for 5 minutes; on-call rotation = Ops: alerta + on-call.
Perguntas de compreensão
- O que diferencia spec C1 de 'lista de requisitos'?
- Por que a11y é acceptance criterion em C1?
- Por que privacy no spec?
Prática com a história
- Escreva três edge cases C1 para o checkout.
- Escreva um acceptance criterion C1 para a11y.
- Escreva um error state C1 completo para falha de pagamento.
Prática
Exercícios e teste
A próxima melhoria é transformar esses arquivos em perguntas com resposta no navegador. Por enquanto, esta página já organiza o estudo e permite seguir a aula inteira sem abrir os arquivos manualmente.