Refactoring in Java Improving Code Design and Maintainability for Java Developers
Master code refactoring techniques, improve code quality, design, and maintainability, and boost your development productivity with this comprehensive handbook Key Features Get a thorough understanding of code refinement for enhanced codebase efficiency Work with real-world examples and case studies...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing Ltd
[2023]
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009790331606719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Contributors
- Table of Contents
- Preface
- Part 1: Introduction to Refactoring
- Chapter 1: What is Refactoring?
- What do we mean by refactoring?
- Refactoring and clean code
- Misconceptions about refactoring
- Why you should consider refactoring
- Improving the design of your software
- Maintainability and scalability
- Understanding, avoiding, and fixing bugs
- Faster development
- When you should refactor
- The "Rule of Three"
- Preparatory refactoring for smooth feature implementation
- Refactoring for bug fixing
- Comprehension refactoring
- The "Boy Scout Rule"
- Planned refactoring
- Long-term refactoring and "Branch by Abstraction"
- Refactoring in a code review
- What you should refactor
- Impact analysis
- Risk assessment
- Value estimation
- Prioritization matrix
- Further considerations
- Refactor or rewrite?
- Summary
- Further reading
- Chapter 2: Good Coding Habits
- Characteristics of good code
- Good code is readable
- Good code is reliable
- Good code is hard to misuse
- Good code is modular
- Good code is reusable
- Clean Code
- Why Clean Code?
- Some principles of Clean Code
- Write SOLID code
- Single responsibility principle
- Open-closed principle
- Liskov substitution principle
- Interface segregation principle
- Dependency inversion principle
- Side effects and mutability
- The builder pattern
- Causes of bad code
- Deadlines
- The Broken Window theory
- No code review process
- Insufficient domain or technical knowledge
- Summary
- Further reading
- Part 2: Essence of Refactoring and Good Code
- Chapter 3: Code Smells
- Duplicated code
- Long methods
- Replace temporary variables with query methods
- Parameter object
- Replace a function or method with a command
- Decompose conditionals
- Split loops.
- Large classes
- Switches
- Primitive Obsession
- Middle man
- Message chains
- Feature envy methods
- Divergent change
- Shotgun Surgery
- God object
- Summary
- Further reading
- Chapter 4: Testing
- Why you should test (often)
- Identifying and fixing defects
- Ensuring quality and reliability
- Customer satisfaction
- Compliance and standards
- Security
- Integration and compatibility
- Confidence and peace of mind
- Unit testing
- JUnit framework
- Integration testing
- Mockito
- Contract testing
- Be safe - checking and improving your test coverage
- What is test coverage?
- A Java code coverage tool - JaCoCo
- Test-driven development
- Advantages of TDD
- Summary
- Further reading
- Chapter 5: Refactoring Techniques
- Writing better methods
- Extract Method
- Inline Method
- Extract and inline variables
- Combining a function into a class
- Moving features between objects
- Moving a method or field
- Moving statements into/from methods
- Hiding delegates
- Removing dead code
- Organizing data
- Field encapsulation
- Replacing primitives with objects
- Replacing type code with subclasses
- Simplifying conditional logic
- Returning a special case instead of null
- Using polymorphism instead of conditions
- Removing duplicated conditions
- Guard clauses
- Simplifying method calls
- Avoiding side effects
- Removing setter methods
- Using generalization
- Pull up field
- Push down field
- Pull up method
- Push down method
- Template method
- Using enums instead of constants
- Summary
- Further reading
- Chapter 6: Metaprogramming
- What is metaprogramming?
- Exploring compile-time metaprogramming tools
- Lombok
- MapStruct
- Exploring runtime metaprogramming tools
- Reflection
- Weighing the pros and cons of metaprogramming
- Summary
- Further reading.
- Chapter 7: Static and Dynamic Analysis
- What is static analysis?
- Code errors or bad practices
- Security
- Cyclomatic complexity
- Exception (mis)handling
- Automated static analysis tools
- What is dynamic analysis?
- Debugging
- Profiling
- Fuzzing
- Symbolic execution
- Taint tracking
- Summary
- Further reading
- Part 3: Further Learning
- Chapter 8: Crafting Quality Every Day
- Code versioning
- Graph structure
- Local VCSs
- Centralized VCSs
- Distributed VCSs
- Branching strategies
- Best practices
- Code formatting and style
- Indentation
- Braces and whitespaces
- Line length and wrapping
- Comments and documentation
- Naming conventions
- Automated tools
- Code reviews
- Email pass-arounds
- Code review automation tools
- In-person (or remote) teamwork reviews
- Pair programming
- Advantages
- Disadvantages
- Styles of pair programming
- Time management
- Documentation
- Requirements
- Architecture documentation
- Technical documentation
- Good practices for documentation
- A hard dose of reality
- The importance of knowing what you're doing
- Summary
- Further reading
- Chapter 9: Beyond Code - Mastering Software Architecture
- What is an architecture?
- Development
- Deployment
- System operation
- Maintenance
- Architectural patterns
- Layered architecture
- Microservices
- Event-driven architecture
- Reactive architecture
- Monolith to microservices
- Bad smells in the microservices architecture
- Shared persistence
- Shared libraries
- Direct communication
- Summary
- Further reading
- Index
- Other Books You May Enjoy.