Building Maintainable Software: Ten Guidelines for Future-Proof Code
by Joost Visser
Copyright 2016 Software Improvement Group, B.V. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Acquisitions Editor: Rachel Roumeliotis
- Editor: Nan Barber
- Production Editor: Matthew Hacker
- Copyeditor: Rachel Monaghan
- Proofreader: Marta Justak
- Indexer: WordCo Indexing Services, Inc.
- Interior Designer: David Futato
- Cover Designer: Randy Comer
- Illustrator: Rebecca Demarest
- February 2016: First Edition
Revision History for the First Edition
- 2016-01-25: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781491940662 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. Building Maintainable Software: Ten Guidelines for Future-Proof Code, the image of a grey-headed woodpecker, and related trade dress are trademarks of OReilly Media, Inc.
While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-4919-5352-5
[LSI]
About the Authors
Joost Visser is Head of Research at the Software Improvement Group. In this role, he is responsible for the science behind the methods and tools that SIG offers to measure and master software. Joost also holds a position as professor of Large-Scale Software Systems at Radboud University Nijmegen. He has obtained his PhD in Computer Science from the University of Amsterdam and has published over 100 papers on topics such as generic programming, program transformation, green computing, software quality, and software evolution. Joost considers software engineering a socio-technical discipline, and he is convinced that software measurement is essential for development teams and product owners to thrive.
Pascal van Eck joined the Software Improvement Group in 2013 as a general consultant on software quality. Prior to joining SIG, for 13 years Pascal was Assistant Professor of Information Systems at University of Twente, The Netherlands. Pascal holds a PhD in Computer Science from Vrije Universiteit Amsterdam and has published over 80 papers in areas such as enterprise architecture, IT security, and software metrics. Pascal is chairman of the program committee of the Dutch National Conference on Architecture for the Digital World.
After obtaining an MSc degree in Software Engineering from Delft University of Technology in 2005, Rob van der Leek joined SIG as a software quality consultant. Working at SIG is for Rob the closest thing to being a software doctor. In his role as a consultant, he combines his thorough technical knowledge on software engineering and software technologies to advise clients on how to keep their systems in shape. Next to being a consultant, Rob fulfills a leading role in SIGs internal development team. This team develops and maintains the companys software analysis tooling. Its Robs ambition to leave the IT industry a bit better than he found it.
Sylvan Rigal has worked as a software quality consultant at SIG since 2011 and has advised clients on managing their IT since 2008. He helps clients achieve lower software maintenance costs and enhanced security by prioritizing improvements in software design and development processes. He holds a MSc in international business from Maastricht University, The Netherlands. As an active member of SIGs software security team, Sylvan trains consultants on analyzing software security risks. When he is not assessing the technical health of software, he is training in Brazilian jiu jitsu, enjoying Amsterdams restaurants, or traveling through Asia. Approximately in that order.
Gijs Wijnholds joined the Software Improvement Group in 2015 as a software quality consultant in public administration. He helps clients get in control of their software projects by advising them on development processes and translating technical risks into strategic decisions. Gijs holds a BSc in AI from Utrecht University and a MSc degree in Logic from the University of Amsterdam. He is an expert on Haskell and mathematical linguistics.
Preface
In der Beschrnkung zeigt sich erst der Meister. (In simplicity one recognizes true skill.)
J.W. von Goethe
After 15 years of consulting about software quality, we at the Software Improvement Group (SIG) have learned a thing or two about maintainability.
First, insufficient maintainability is a real problem in the practice of software development. Low maintainability means that developers spend too much time on maintaining and fixing old code. That leaves less time available for the most rewarding part of software development: writing new code. Our experience, as well as the data we have collected, shows that maintaining source code takes at least twice as long when maintainability is measured as below average, compared to when maintainability is above average. See to learn how we measure maintainability.
Second, lack of maintainability is to a large extent caused by simple issues that occur over and over again. Consequently, the most efficient and effective way to improve maintainability is to address these simple issues. Improving maintainability does not require magic or rocket science. A combination of relatively simple skills and knowledge, plus the discipline and environment to apply them, leads to the largest improvement in maintainability.
At SIG, we have seen systems that are essentially unmaintainable. In these systems, bugs are not fixed, and functionality is not changed or extended because it is considered too time-consuming and risky. Unfortunately, this is all too common in todays IT industry, but it does not have to be like that.
That is why we have written the 10 guidelines. We want to share the knowledge and skills that any practicing software developer should master to consistently write maintainable source code. We are confident that after reading and understanding the 10 guidelines, as a software developer you will be able to write maintainable source code. What is left, then, is the environment to apply these skills to maximum effect, including shared development practices, appropriate tooling, and more. We cover these development environment essentials in a second book, called Building Software Teams.
The Topic of This Book: Ten Guidelines for Building Maintainable Software
The guidelines in the following chapters are independent of the type of system. The guidelines are about the size and number of parameters in units of code (methods in Java), the number of decision points, and other properties of source code. They are well-known guidelines that many programmers may have heard about in their training. The chapters also provide examples, mostly in the form of refactoring patterns, of how to apply the guidelines in practice. Although the guidelines are presented in Java, they are independent of the programming language used. Eight out of 10 of them are are derived from the SIG/TViT a set of metrics to systematically rate source code maintainability.