Giter Site home page Giter Site logo

katapasswordvalidation's Introduction

PASSWORD VALIDATION KATA

created by: Emmanuel Valverde and Fran Iglesias

Iteration 1 - Basic password validation

Goal

Design and implement a software that validates a password applying TDD.

The password will be introduced by the user (as an argument of the method) and should return if the password is valid or not.

A valid password should meet the following requirements:

  • Have more than 8 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains a number
  • Contains an underscore

Technical requirements:

  • We want a method that answers if the password is valid or not.
  • We don't want to know the reason when the password is invalid (the return value is a boolean)

Iteration 2 - Rules abstraction

Goal

Design and implement software that can adapt to different password validation rules TDD and focus on the OOP principles.

Let's pretend that now we want to create another type of password validations because on our app we need different type of passwords, such as:

Validation 2:

  • Have more than 6 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains a number

Validation 3:

  • Have more than 16 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains an underscore

Things to practice

In this iteration, we should try to identify a good abstraction and try to work on OOP principles as well as on design patterns like Builder and Factory

Interesting restrictions

Use object calisthenics.

Iteration 3 - Multiple errors

Goal

Now we can know if a password is valid or not, but we cannot understand why, in this iteration, we should be able to return a list of errors for each invalid password, so we could know why the password it's not valid.

Things to practice

Identify how maintainable it's the code that you've built so far, and how it adapts to change, this iteration could change depending on the programming language that you use.

Iteration 4 - Validation strategy

Goal

Up untill this point we've been able to create a list of validation rules and validate the password passes all the validation rules, but now we want a new password with the same rules but allowing to fail only one of them.

Validation 4

  • Have more than 8 characters
  • Contains a capital letter
  • Contains a number
  • Contains an underscore

Examples:

  • Have more than 8 characters ✅
  • Contains a capital letter ✅
  • Contains a number ✅
  • Contains an underscore ❌

This password it's a valid password

Things to practice

This will help to enforce encapsulation for the lists of rules and have a better design for validation strategies [preventing us from using inheritance], this also could help us work on the Strategy pattern.

katapasswordvalidation's People

Contributors

davidisla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.