Seriously Good Software
Code that works, survives, and wins
Marco Faella
Foreword by Cay Horstmann
  • March 2020
  • ISBN 9781617296291
  • 328 pages
  • printed in black & white

Building high-quality software is never simple, and it is always a good idea to reexamine the principles of good design and craftsmanship. In this book, you will find a fresh perspective that I hope you will enjoy as much as I did.

From the Foreword by Cay Horstmann, author of Big Java, Core Java, and many other titles
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.

Listen to this book in liveAudio! liveAudio integrates a professional voice recording with the book’s text, graphics, code, and exercises in Manning’s exclusive liveBook online reader. Use the text to search and navigate the audio, or download the audio-only recording for portable offline listening. You can purchase or upgrade to liveAudio here or in liveBook.

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 seven pillars of seriously good software: speed, memory usage, reliability, readability, thread safety, generality, and elegance. The Java-based examples demonstrate techniques that apply to any OO language.

About the book

Seriously Good Software is a handbook for any professional developer serious about improving application quality. It explores fundamental dimensions of code quality by enhancing a simple implementation into a robust, professional-quality application. Questions, exercises, and Java-based examples ensure you’ll get a firm grasp of the concepts as you go. When you finish the last version of the book’s central project, you’ll be able to confidently choose the right optimizations for your code.
Table of Contents detailed table of contents

Part 1: Preliminaries

1 Software qualities and problem statement

1.1 Software qualities

1.1.1 Internal vs external qualities

1.1.2 Functional vs non-functional 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


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


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


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 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


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


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


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 Naming things

7.3.2 Whitespace 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


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


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


Answers to quizzes and exercises

Further reading


Appendix A: Code golf: Succinctness

A.1 The shortest I came up with Golf

Further reading

Appendix B: The ultimate water container class

B.1 Readability enhancements

B.2 Reliability enhancements

What's inside

  • Evaluating software qualities
  • Assessing trade-offs and interactions
  • Fulfilling different objectives in a single task
  • Java-based exercises you can apply in any OO language

About the reader

For developers with basic object-oriented programming skills and intermediate Java skills.

About the author

Marco Faella teaches advanced programming at a major Italian university. His published work includes peer-reviewed research articles, a Java certification manual, and a video course.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $39.99 pBook + eBook + liveBook
Additional shipping charges may apply
Seriously Good Software (print book) added to cart
continue shopping
go to cart

eBook $23.99 $31.99 3 formats + liveBook
Seriously Good Software (eBook) added to cart
continue shopping
go to cart

Add liveAudio for only $19.99
Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks