Skip to content

sammancoaching/Person-Refactoring-Kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Person Refactoring Kata

Can you spot any code smells? We think you should be able to find Primitive Obsession. Refactor to remove it.

If you want to really practice doing refactorings safely, you'll want to do it in a series of small, safe steps. This is the outline of a path that will take you there:

  1. Encapsulate Variable on the "personalNumber" field.
  2. Replace Primitive with Object on the "personalNumber" field. You'll create a class "PersonalNumber".
  3. Move Function to move the "birthYear" function to the "PersonalNumber" class.

At this point you should have fixed the primitive being used for the swedish personal number.

  1. Repeat the steps for the phoneNumber field. Create a class PhoneNumber and move countryCode to it.
  2. Repeat the steps for the role field. Create a class Role and move canDeleteUsers to it.

About

to practice refactoring away Primitive Obsession

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •