Video description
In Video Editions the narrator reads the book while the content, figures, code listings, diagrams, and text appear on the screen. Like an audiobook that you can also watch as a video.
A wealth of knowledge to sharpen your toolset.
Joe Ivans, California Regional MLS
Practical techniques for writing code that is robust, reliable, and easy for team members to understand and adapt.
In Good Code, Bad Code you'll learn how to:
- Think about code like an effective software engineer
- Write functions that read like well-structured sentences
- Ensure code is reliable and bug-free
- Effectively unit test code
- Identify code that can cause problems and improve it
- Write code that is reusable and adaptable to new requirements
- Improve your medium and long-term productivity
- Save yourself and your team time
The difference between good code or bad code often comes down to how you apply the established practices of the software development community. In Good Code, Bad Code you’ll learn how to boost your productivity and effectiveness with code development insights normally only learned through careful mentorship and hundreds of code reviews.
about the technology
Software development is a team sport. For an application to succeed, your code needs to be robust and easy for others to understand, maintain, and adapt. Whether you’re working on an enterprise team, contributing to an open source project, or bootstrapping a startup, it pays to know the difference between good code and bad code.
about the book
Good Code, Bad Code is a clear, practical introduction to writing code that’s a snap to read, apply, and remember. With dozens of instantly-useful techniques, you’ll find coding insights that normally take years of experience to master. In this fast-paced guide, Google software engineer Tom Long teaches you a host of rules to apply, along with advice on when to break them!
about the audience
For coders early in their careers who are familiar with an object-oriented language, such as Java or C#.
about the author
Tom Long is a software engineer at Google where he works as a tech lead. Among other tasks, he regularly mentors new software engineers in professional coding best practices.
Pragmatic advice and useful tips for a career in software development.
George Thomas, Manhattan Associates
A practical, informative book designed to help developers write high-quality, effective code.
Christopher Villanueva, Independent Consultant
Smart, well written, actionable information for creating maintainable code.
Hawley Waldman, Consultant
NARRATED BY JULIE BRIERLEY
Table of Contents
Part 1 - In theory
Chapter 1 Code quality
Chapter 1 The goals of code quality
Chapter 1 The pillars of code quality
Chapter 1 Make code hard to misuse
Chapter 1 Make code testable and test it properly
Chapter 2 Layers of abstraction
Chapter 2 Why create layers of abstraction?
Chapter 2 Layers of code
Chapter 2 Classes, Part 1
Chapter 2 Classes, Part 2
Chapter 2 Interfaces
Chapter 2 When layers get too thin
Chapter 3 Other engineers and code contracts
Chapter 3 How will others figure out how to use your code?
Chapter 3 Code contracts
Chapter 3 Don’t rely too much on small print
Chapter 3 Checks and assertions
Chapter 4 Errors
Chapter 4 Robustness vs. failure
Chapter 4 Don’t hide errors
Chapter 4 Ways of signaling errors
Chapter 4 Explicit: Nullable return type
Chapter 4 Implicit: Promise or future
Chapter 4 Signaling errors that a caller might want to recover from
Chapter 4 Arguments for using explicit techniques
Part 2 - In practice
Chapter 5 Make code readable
Chapter 5 Use comments appropriately
Chapter 5 Don’t fixate on number of lines of code
Chapter 5 Stick to a consistent coding style
Chapter 5 Make function calls readable
Chapter 5 Avoid using unexplained values
Chapter 5 Use anonymous functions appropriately
Chapter 5 Solution: Break large anonymous functions into named functions
Chapter 6 Avoid surprises
Chapter 6 Solution: Return null, an optional, or an error
Chapter 6 Use the null object pattern appropriately
Chapter 6 More complicated null objects can cause surprises
Chapter 6 Avoid causing unexpected side effects
Chapter 6 Beware of mutating input parameters
Chapter 6 Avoid writing misleading functions
Chapter 6 Future-proof enum handling
Chapter 6 Beware of the default case
Chapter 7 Make code hard to misuse
Chapter 7 Solution: Set values only at construction time
Chapter 7 Consider making things deeply immutable
Chapter 7 Avoid overly general data types
Chapter 7 Dealing with time
Chapter 7 Have single sources of truth for data
Chapter 7 Have single sources of truth for logic
Chapter 8 Make code modular
Chapter 8 Design code with dependency injection in mind
Chapter 8 Beware of class inheritance
Chapter 8 Solution: Use composition
Chapter 8 Classes should care about themselves
Chapter 8 Beware of leaking implementation details in return types
Chapter 8 Beware of leaking implementation details in exceptions
Chapter 9 Make code reusable and generalizable
Chapter 9 Beware of global state
Chapter 9 Use default return values appropriately
Chapter 9 Keep function parameters focused
Part 3 - Unit testing
Chapter 10 Unit testing principles
Chapter 10 What makes a good unit test?
Chapter 10 Well-explained failures
Chapter 10 Focus on the public API but don’t ignore important behaviors
Chapter 10 Test doubles
Chapter 10 Mocks
Chapter 10 Mocks and stubs can be problematic
Chapter 10 Fakes
Chapter 10 Pick and choose from testing philosophies
Chapter 11 Unit testing practices
Chapter 11 Avoid making things visible just for testing
Chapter 11 Test one behavior at a time
Chapter 11 Use shared test setup appropriately
Chapter 11 Shared configuration can be problematic
Chapter 11 Use appropriate assertion matchers
Chapter 11 Use dependency injection to aid testability
Appendix B. Null safety and optionals