Skip to content

Learn to Write Clean Code with Java. Get Hands-on with 20+ Code Examples involving 4 principles of Simple Design, Refactoring and TDD.

Notifications You must be signed in to change notification settings

in28minutes/clean-code

Repository files navigation

Clean Code with Java: Learn Simple Design, Refactoring & TDD

Learn to Write Clean Code with Java. Get Hands-on with Code Examples involving 4 principles of Simple Design, Refactoring & TDD.

  • Step I : Understand Clarity of Code (Unit Tests)
  • Step II: Focus on 4 Principles of Simple Design
  • Step III: Get started with Refactoring
  • Step IV : Understand TDD

Exercises

GildedRose

  • Goal
    • Understand Clarity of Code
    • Give importance to Unit Testing
  • GildedRoseADefaultItemTest.java
  • GildedRoseBAgedBrieTest.java
  • GildedRoseCBackstagePassesTest.java
  • More details - Gilded Rose Exercises

4 Principles of Simple Design

  • Refactor Code
    • StudentHelper.isGradeB()
    • StudentHelper.getGrade()
    • StudentHelper.willQualifyForQuiz()
  • Write Code
    • TextHelper.swapLastTwoCharacters()
    • TextHelper.truncateAInFirst2Positions()
  • Refactor Unit Test
    • CustomerBOTest

Refactoring

  • CustomerBOImpl.getCustomerProductsSum(List<Product>)
  • Movie.isValidRating()
  • MenuAccess.setAuthorizationsInEachMenus(List<MenuItem>, Role[])
  • UserLoginChecker.isUserAllowedToLogin(long, String, boolean, User, List)

Try on Your Own (With Solutions)

  • UserLoginCheckerTest
  • MenuAccessTest

TDD

  • More details - TDD Exercises
  • Truncate A in first 2 positions of a String
  • Check if first two and last two characters in the string are the same.
  • Bowling Kata

Step By Step Details

Getting Started with Clarity in Code

  • Clean Code with Simple Design, Refactoring and TDD - Getting Setup
  • Step 00 - Clarity in Code - Problem 1 - Gilded Rose - Introduction
  • Step 01 - Clarity in Code - Problem 1 - Gilded Rose - Refactoring Unit Test 1 - Default Item
  • Step 02 - Clarity in Code - Problem 1 - Gilded Rose - Refactoring Unit Test 2 - Default Item
  • Step 03 - Clarity in Code - Problem 1 - Gilded Rose - Refactoring Unit Test 3 - Aged Brie
  • Step 04 - Clarity in Code - Problem 1 - Gilded Rose - Refactoring Unit Test 4 - Backstage Passes
  • Step 05 - Clean Code - Attitude for the course

Getting Started with 4 Principles of Simple Design

  • Step 01 - 4 Principles of Simple Design - An Introduction
  • Step 02 - 4 Principles of Simple Design - Exercise - StudentHelper.isGradeB
  • Step 03 - 4 Principles of Simple Design - Exercise - StudentHelper.getGrade
  • Step 04 - 4 Principles of Simple Design - Exercise - StudentHelper.willQualifyForQuiz
  • Step 06 - Most difficult challenge in programming - Naming
  • Step 07 - 4 Principles of Simple Design - Exercise - TextHelper.swapLastTwoCharacters
  • Step 07 - Should you have comments in code?
  • Step 08 - 4 Principles of Simple Design - Exercise - TextHelper.truncateAInFirst2Positions
  • Step 09 - 4 Principles of Simple Design - Exercise - CustomerBOTest
  • Step 10 - 4 Principles of Simple Design - Exercise - CustomerBOTest
  • Step 11 - Attitude towards Unit Testing
  • Step 12 - Unit Testing Principles

Getting Started with Refactoring

  • Step 01 - Introduction to Refactoring
  • Step 02 - Refactoring - Exercise - CustomerBOImpl.getCustomerProductsSum
  • Step 03 - Refactoring - Exercise - Movie.isValidRating
  • Step 04 - Refactoring - Exercise - MenuAccess.setAuthorizationsInEachMenus
  • Step 05 - Refactoring - Exercise - UserLoginChecker.isUserAllowedToLogin - 1
  • Step 06 - Refactoring - Exercise - UserLoginChecker.isUserAllowedToLogin - 2
  • Step 07 - My 10 Tips for Good Programmers

Getting Started with Test Driven Development

  • Step 01 - Introduction to Test Driven Development - TDD
  • Step 02 - Test Driven Development - TDD - Exercise - StringHelper.replaceAInFirst2Positions
  • Step 03 - Test Driven Development - TDD - Exercise - StringHelper.replaceAInFirst2Positions
  • Step 04 - Test Driven Development - TDD - Exercise - StringHelper.areFirstTwoAndLastTwoCharsTheSame
  • Step 05 - Test Driven Development - TDD - Exercise - Bowling Kata - Introduction
  • Step 06 - Test Driven Development - TDD - Exercise - Bowling Kata - Getting Started
  • Step 07 - Test Driven Development - TDD - Exercise - Bowling Kata - Spare
  • Step 08 - Test Driven Development - TDD - Exercise - Bowling Kata - Strike
  • Step 09 - 3 Tips for Test Driven Development - TDD

Thank You

  • Clean Code with Simple Design, Refactoring and TDD - Thank You

About

Learn to Write Clean Code with Java. Get Hands-on with 20+ Code Examples involving 4 principles of Simple Design, Refactoring and TDD.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published