List of Listings

Chapter 2. Hello, Mikado Method!

Listing 2.1. Launcher.java

Listing 2.2. Launcher.java with parameterized setStorageFile(..)

Listing 2.3. Launcher.java

Listing 2.4. App.java

Listing 2.5. The UI.java code, somewhat reduced

Listing 2.6. Changing FileDB to Database, with compilation errors in bold

Listing 2.7. The call to the FileDB constructor is changed.

Listing 2.8. The call to the FileDB constructor is changed in UI.

Listing 2.9. Database interface

Listing 2.10. Use the interface in UI

Listing 2.11. Error in Launcher

Listing 2.12. Error in UI

Listing 2.13. The UI is done

Listing 2.14. Pulled construction to App

Listing 2.15. FileDB pulled all the way up to Launcher

Listing 2.16. Launcher in final shape

Listing 2.17. App in final shape

Chapter 5. Breaking up a monolith

Listing 5.1. The handle method in LoanHandler.java

Listing 5.2. Helper methods in LoanHandler.java

Listing 5.3. The stubbed response

Listing 5.4. The stubbed HttpServletRequest

Listing 5.5. The stubbed Request

Listing 5.6. The tests

Listing 5.7. The slightly changed LoanHandler.java

Listing 5.8. The slightly changed setUp() in LoanHandlerTest.java

Listing 5.9. Contents of the RequestHelper class

Listing 5.10. Contents of the ApproveHandler class

Listing 5.11. Contents of the LoanHandler class

Listing 5.12. Contents of the LoanRepository interface

Listing 5.13. Contents of the ApproveHandlerTest class

Chapter 6. Emergent design

Listing 6.1. A piece of code that does too much

Listing 6.2. Responsibilities distributed

Listing 6.3. What will happen if you add another game?

Listing 6.4. Refactored code

Listing 6.5. Composition approach for Square with a new interface

Listing 6.6. Rectangle should also implement the new interface

Chapter 7. Common restructuring patterns

Listing 7.1. Plain old copy-paste

Listing 7.2. Subtle domain-level duplication

Appendix C. Dealing with dynamically typed languages

Listing C.1. The initial loan_server.js code

Listing C.2. The initial repository.js code

Listing C.3. Our first test

Listing C.4. The test is growing.

Listing C.5. An ever-growing test

Listing C.6. Modified loan_server.js

Listing C.7. The test grows.

Listing C.8. The test shifts in its approach.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset