I am pleased to announce that I am the author of Clean Code in C#. A lot of effort has gone into this book to help you become a better programmer in C#. The book starts off by looking at bad and good code and the need to have good coding standards such as DRY, KISS, SOLID, and YAGNI. Then we move on to look at the process and importance of code reviews for maintaining clean code before it is submitted to version control. After this, we discuss classes, objects, and data structures including topics such as The Law of Demeter, immutable objects and data structures, and only exposing what needs to be exposed and hiding everything else.
We then move on to look at writing clean functions in C# by looking at functional programming, reducing the number of parameters in method calls, and avoiding duplication. Following on from this, we discuss exception handling and consider checked and unchecked exceptions, avoiding the NullPointerException, business rule exceptions, and building your own custom exceptions.
Unit testing and the fail-pass-refactor test-driven development methodology are then discussed, followed by a look into end-to-end system testing by writing three console applications that provide a good practical demonstration of this. Once we have covered testing, we move on to discuss threading and concurrency. We start by looking at the threading lifecycle and then move onto advanced parallel and concurrency issues and how to prevent them with code examples.
Next, we look at language-agnostic API design using RAML, and then build a C# API from the RAML specification. And we use Swagger to document our API. This is followed by looking at how to secure APIs with API keys and Azure Key Vault. We then move on to address cross-cutting concerns and how to use the PostSharp Aspect Framework, and even how to develop our own aspects. Then we look at various tools to help us refactor our code such as code analysis, code metrics, Resharper, dotTrace, and JustDecompile.
Finally, the last two chapters cover refactoring in detail. Chapter 13 helps you to identify code smells at the application, class, and method levels. And Chapter 14 helps you to refactor code by using design patterns. There are plenty of code examples and questions to enforce your learning, and the code is available on GitHub.
By the time you have read this book, you will understand what constitutes good and bad code, how to identify and refactor bad code to make it clean, how to design, implement, and document APIs, and will have a fully functional working secured FinTech API.
To get the most out of this book, I recommend you download and investigate the source code. And I also recommend that you hand-code the source code in the book and complete all tasks, questions, and further reading. You can obtain the book from the following sources:
If you encounter any books from Packt being made free for download on pirate websites, then please report the issue by sending an email to firstname.lastname@example.org.