Seriously Good Software: Code that works, survives, and wins

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Serious developers know that code can always be improved. With each iteration, you make optimizations — small and large—that can have a huge impact on your application’s speed, size, resilience, and maintainability. In Seriously Good Software: Code that Works, Survives, and Wins, author, teacher, and Java expert Marco Faella teaches you techniques for writing better code. You’ll start with a simple application and follow it through seven careful refactorings, each designed to explore another dimension of quality. Key features • Evaluating software qualities • Distinguishing between qualities that are internal, external, functional, and non-functional • Assessing tradeoffs and interactions between software qualities • Fulfilling different quality objectives for a single unifying task • Hands-on exercises and detailed solutions • Exercises covering the inner workings of the Java API Audience For developers with basic object-oriented programming skills and intermediate Java skills. About the technology Great code blends the skill of a programmer with the time-tested techniques and best practices embraced by the entire development community. Although each application has its own context and character, some dimensions of quality are always important. This book concentrates on eight pillars of seriously good software: speed, memory usage, reliability, readability, thread safety, generality, and elegance. Marco Faella has been teaching an advanced programming language course for twelve years as an associate professor at a major Italian university. As passionate about programming as he is about teaching, Marco has published many research articles in peer-reviewed journals, a Java certification manual, and a Java programming video course.

Author(s): Marco Faella
Edition: 1
Publisher: Manning Publications
Year: 2019

Language: English
Commentary: True PDF
Pages: 328
City: Shelter Island, NY
Tags: Algorithms; Multithreading; Java; Reliability; Monitoring; Memory Management; Best Practices; Testing; Software Quality Attributes; Algorithm Complexity; Code Readability; Code Reusability

Seriously Good Software
brief contents
contents
foreword
preface
acknowledgments
about this book
about the author
about the cover
Part 1 Preliminaries
1 Software qualities and a problem to solve
1.1 Software qualities
1.1.1 Internal vs. external qualities
1.1.2 Functional vs. nonfunctional qualities
1.2 Mostly external software qualities
1.2.1 Correctness
1.2.2 Robustness
1.2.3 Usability
1.2.4 Efficiency
1.3 Mostly internal software qualities
1.3.1 Readability
1.3.2 Reusability
1.3.3 Testability
1.3.4 Maintainability
1.4 Interactions between software qualities
1.5 Special qualities
1.5.1 Thread safety
1.5.2 Succinctness
1.6 The recurring example: A system of water containers
1.6.1 The API
1.6.2 The use case
1.7 Data model and representations
1.7.1 Storing water amounts
1.7.2 Storing connections
1.8 Hello containers!
1.8.1 Fields and constructor
1.8.2 Methods getAmount and addWater
1.8.3 Method connectTo
Summary
Further reading
2 Reference implementation
2.1 The code
2.1.1 Memory layout diagrams
2.1.2 The methods
2.2 Memory requirements
2.2.1 Memory requirements of Reference
2.3 Time complexity
2.3.1 Time complexity of Reference
2.4 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
Part 2 Software Qualities
3 Need for speed: Time efficiency
3.1 Adding water in constant time
3.1.1 Time complexity
3.2 Adding connections in constant time
3.2.1 Representing groups as circular lists
3.2.2 Delaying the updates
3.3 The best balance: Union-find algorithms
3.3.1 Finding the group representative
3.3.2 Connecting trees of containers
3.3.3 Worst-case time complexity
3.3.4 Amortized time complexity
3.3.5 Amortized analysis of resizable arrays
3.4 Comparing implementations
3.4.1 Experiments
3.4.2 Theory vs. practice
3.5 And now for something completely different
3.5.1 Fast insertion
3.5.2 Fast queries
3.5.3 Fast everything
3.6 Real-world use cases
3.7 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
4 Precious memory: Space efficiency
4.1 Gently squeezing
4.1.1 Space and time complexity
4.2 Plain arrays
4.2.1 Space and time complexity
4.3 Forgoing objects
4.3.1 The object-less API
4.3.2 Fields and the getAmount method
4.3.3 Creating containers with a factory method
4.3.4 Connecting containers by ID
4.3.5 Space and time complexity
4.4 The black hole
4.4.1 Space and time complexity
4.5 Space-time trade-offs
4.6 And now for something completely different
4.6.1 Low duplicate count
4.6.2 High duplicate count
4.7 Real-world use cases
4.8 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
5 Self-conscious code: Reliability through monitoring
5.1 Design by contract
5.1.1 Pre- and postconditions
5.1.2 Invariants
5.1.3 Correctness and robustness
5.1.4 Checking contracts
5.1.5 The broader picture
5.2 Designing containers by contract
5.3 Containers that check their contracts
5.3.1 Checking the contract of addWater
5.3.2 Checking the contract of connectTo
5.4 Containers that check their invariants
5.4.1 Checking the invariants in connectTo
5.4.2 Checking the invariants in addWater
5.5 And now for something completely different
5.5.1 The contracts
5.5.2 A baseline implementation
5.5.3 Checking the contracts
5.5.4 Checking the invariants
5.6 Real-world use cases
5.7 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
6 Lie to me: Reliability through testing
6.1 Basic testing notions
6.1.1 Coverage in testing
6.1.2 Testing and design-by-contract
6.1.3 JUnit
6.2 Testing containers
6.2.1 Initializing the tests
6.2.2 Testing addWater
6.2.3 Testing connectTo
6.2.4 Running the tests
6.2.5 Measuring code coverage
6.3 Testability
6.3.1 Controllability
6.3.2 Observability
6.3.3 Isolation: Severing dependencies
6.4 And now for something completely different
6.4.1 Improving testability
6.4.2 A test suite
6.5 Real-world use cases
6.6 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
7 Coding aloud: Readability
7.1 Points of view on readability
7.1.1 Corporate coding style guides
7.1.2 Readability ingredients
7.2 Structural readability features
7.2.1 Control flow statements
7.2.2 Expressions and local variables
7.3 Exterior readability features
7.3.1 Comments
7.3.2 Naming things
7.3.3 White space and indentation
7.4 Readable containers
7.4.1 Documenting the class header with Javadoc
7.4.2 Cleaning connectTo
7.4.3 Cleaning addWater
7.5 Final thoughts on readability
7.6 And now for something completely different
7.7 Real-world use cases
7.8 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
8 Many cooks in the kitchen: Thread safety
8.1 Challenges to thread safety
8.1.1 Levels of concurrency
8.1.2 A concurrency policy for water containers
8.2 Dealing with deadlocks
8.2.1 Atomic lock sequences
8.2.2 Ordered lock sequences
8.2.3 A hidden race condition
8.3 Thread-safe containers
8.3.1 Synchronizing connectTo
8.3.2 Synchronizing addWater and getAmount
8.4 Immutability
8.4.1 The API
8.4.2 The implementation
8.5 And now for something completely different
8.6 Real-world use cases
8.7 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
9 Please recycle: Reusability
9.1 Establishing boundaries
9.2 The general framework
9.2.1 The attribute API
9.2.2 Mutable collectors
9.2.3 Adapting Attribute to functional interfaces
9.3 A generic container implementation
9.4 General considerations
9.5 Recovering water containers
9.5.1 Updated use case
9.5.2 Designing the concrete attribute
9.5.3 Defining the concrete water container class
9.6 Social network posts
9.7 And now for something completely different
9.7.1 An interface for parametric functions
9.7.2 A communication discipline
9.8 Real-world use cases
9.9 Applying what you learned
Summary
Answers to quizzes and exercises
Further reading
A Code golf: Succinctness
A.1 The shortest I came up with
Further reading
B The ultimate water container class
B.1 Readability enhancements
B.2 Reliability enhancements
index
Symbols & Special Characters
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Back cover