Book Image

Test-Driven Java Development

Book Image

Test-Driven Java Development

Overview of this book

Table of Contents (17 chapters)
Test-Driven Java Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
8
Refactoring Legacy Code – Making it Young Again
Index

Why should we care about design?


In the coding world, whether you are an expert or a beginner, there are some scenarios where code seems to be weird. You can't avoid a feeling that something is wrong with the code when reading it. You even occasionally wonder why the previous programmer implemented a specific method or a class in such a bad manner. This is because the same functionality can be implemented in a vast number of different ways, each of them being unique. With this big number of possibilities, which is the best one? The answer is that all of them are valid as they all achieve the goal. However, it is true that some considerations should be taken into account while finding better solutions. This is where design becomes important.

Design principles

The TDD philosophy encourages programmers to follow some principles and good practices that make code cleaner and more readable. As a result, our code becomes easy to understand and safe to modify in the future. Let's take a look at some...