Java OOP Done Right

Java OOP Done Right

Alan Mellor
This is a sample of the book's content.Buy on Leanpub

Table of Contents

Java OOP Done Right

  • Preface
  • Optimise for Clarity
  • What is an object, anyway?
    • What’s all this got to do with Java?
    • A simple example: Greeting users
    • The big idea: calling code is simple
    • Object Oriented Design is Behaviour Driven Design
  • Clean Code
    • Good Names
    • Design methods around behaviours, not data
    • Hidden data - No getters, no setters
  • Aggregates: More than one
    • Greeting more than one user
    • Using forEach - not a loop
    • Aggregate methods work on all the things
  • Collaboration
    • Basic Mechanics
    • Example: Simple Point of Sale
  • Test Driven Development
    • Outside-in design with TDD
    • First test: total starts at zero
    • Arrange, Act, Assert - a rhythm inside each test
    • Red, Green, Refactor - a rhythm in between tests
    • Second test: Adding an item gives us the right total
    • Designing the second feature
    • TDD Steps - Too much? Too little?
    • YAGNI - You Ain’t Gonna Need It
    • YAYA - Yes, You Are
    • Optimise for Clarity with well-named tests
    • TDD and OOP - A natural fit
    • FIRST Tests are usable tests
    • Real-world TDD
  • Polymorphism - The Jewel in the OOP Crown
    • Classic example: Shape.draw()
    • The Shape Interface
    • Tell Don’t Ask - the key to OOP
  • The SOLID Principles
    • The five SOLID principles
    • SRP Single Responsibility - do one thing well
    • DIP Dependency Inversion: Bring out the Big Picture
    • LSP Liskov Substitution Principle - Making things swappable
    • OCP Open/Closed Principle - adding without change
    • ISP Interface Segregation Principle - honest interfaces
  • TDD and Test Doubles
    • Test Doubles - Stubs and Mocks
    • DIP for Unit Tests - Stubs and Mocks
    • Mocking libraries
    • Self-Shunt mocks and stubs
  • Refactoring
    • What is refactoring?
    • Rename Method, Rename Variable
    • Extract Method
    • Change Method Signature
    • Extract Parameter Object
    • Can we refactor anything into anything else?
  • Hexagonal Architecture
    • The problems of external systems
    • The Test Pyramid
    • Removing external systems
    • The Hexagonal Model
    • Inversion / Injection: Two sides of the same coin
  • Handling Errors
    • Three kinds of errors
    • The null reference
    • Null object pattern
    • Zombie object
    • Exceptions - a quick primer
    • Design By Contract, Bertrand Meyer style
    • Fatal errors: Stop the world!
    • Combined approach: Fixable and non-fixable errors
    • Which approach is best?
    • NullPointerException
    • Application Specific Exceptions
    • Error object
    • Optionals - Java 8 streams approach
    • Review: Which approach to use?
  • Design Patterns
    • Mechanism and Domain
    • Patterns: Not libraries, not frameworks
    • Strategy
    • Observer
    • Adapter
    • Command
    • Composite
    • Facade
    • Builder
    • Repository
    • Query
    • CollectingParameter
    • Item-Item Description
    • Moment-Interval
    • Clock
    • Rules (or Policy)
    • Aggregate
    • Cache
    • Decorator
    • External System (Proxy)
    • Configuration
    • Order-OrderLineItem
    • Request-Service-Response
    • Anti-Patterns
  • OOP Mistakes - OOP oops!
    • Broken Encapsulation - Getters Galore!
    • Broken Inheritance
    • Bird extends Animal
    • Square extends Rectangle
    • Inheriting implementation
    • Broken Shared State
    • Ordinary Bad Code
  • Data Structures and Pure Functions
    • System Boundaries
    • Fixed Data, Changing Functions
    • Algorithms and Data Structures
  • Putting It All Together
    • No step-by-step plans
    • Getting Started
    • Perfection and Pragmatism
    • Getting Past Stuck
  • Further Reading
    • Agile Software Development, Robert C Martin
    • Growing Object Oriented Software Guided By Tests, Freeman and Pryce
    • Refactoring, Martin Fowler
    • Design Patterns Helm, Johnson, Richards, Vlissides
    • Domain Driven Design, Eric Evans
    • Applying UML with Patterns, Craig Larman
    • Home page for this book
    • My Blog
    • My Quora Space
    • LinkedIn
    • LeanPub page
  • Cheat Sheet
    • Behaviours First
    • Design Principles
    • Clean Code
    • General Code Review Points
  • About the Author
    • Thanks
  • Buy the book!
  • Notes
Java OOP Done Right/overview

Java OOP Done Right

course_overview

Object Oriented Programming in Java - done right. Avoid the classic mistakes. Learn how to create clean, concise OO code with Java 11

count_chapters
begin_reading
download
p_implied_book_part_name

Java OOP Done Right22 chapters

Begin ›
  1. Preface

  2. Optimise for Clarity

  3. What is an object, anyway?

  4. Clean Code

  5. Aggregates: More than one

  6. Collaboration

  7. Test Driven Development

  8. Polymorphism - The Jewel in the OOP Crown

  9. The SOLID Principles

  10. TDD and Test Doubles

  11. Refactoring

  12. Hexagonal Architecture

  13. Handling Errors

  14. Design Patterns

  15. OOP Mistakes - OOP oops!

  16. Data Structures and Pure Functions

  17. Putting It All Together

  18. Further Reading

  19. Cheat Sheet

  20. About the Author

  21. Buy the book!

  22. Notes