Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
C# and .NET Core Test-Driven Development

You're reading from   C# and .NET Core Test-Driven Development Dive into TDD to create flexible, maintainable, and production-ready .NET Core applications

Arrow left icon
Product type Paperback
Published in May 2018
Publisher
ISBN-13 9781788292481
Length 300 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ayobami Adewole Ayobami Adewole
Author Profile Icon Ayobami Adewole
Ayobami Adewole
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Exploring Test-Driven Development FREE CHAPTER 2. Getting Started with .NET Core 3. Writing Testable Code 4. .NET Core Unit Testing 5. Data-Driven Unit Tests 6. Mocking Dependencies 7. Continuous Integration and Project Hosting 8. Creating Continuous Integration Build Processes 9. Testing and Packaging the Application 10. Other Books You May Enjoy

Difficulty in maintaining code

There are two types of code—good code and bad code. The syntax of both types of code may be correct when compiled and running the code can give the expected results. However, bad code leads to serious issues when it comes to extending or even making little changes to the code, due to the way it was written.

When programmers write code using unprofessional approaches and styles, this often results in bad code. Also, the use of unreadable coding styles or formats as well as not properly and effectively testing code are all precursors to bad code. Code can be written poorly when programmers sacrifice professionalism in order to meet approaching deadlines and project milestones.

I have come across a few software projects that rapidly become legacy software projects that are abandoned because of incessant production bugs and the inability to incorporate change requests from users easily. This is because these software applications were deployed into production with a severe accumulation of technical debts through bad code written by software developers as a result of making poor design and development decisions and using programming styles known to cause future maintenance problems.

Source code elements—methods, classes, comments, and other artifacts—should be easy to read, understand, debug, refactor, and extend if required by another developer other than the original developer; otherwise, bad code has already been written.

You know you have bad code when, extending or adding new features, you break the existing working features. This can also happen when there are portions of code that cannot be decoded or any changes to them will bring the system to a halt. Another reason for bad code is usually because of nonadherence to object-oriented and Don't Repeat Yourself (DRY) principles or wrong use of the principles.

DRY is an important principle in programming, which aims at breaking down a system into small components. These components can easily be managed, maintained, and reused in order to avoid writing duplicate code and having different parts of code performing the same function.
You have been reading a chapter from
C# and .NET Core Test-Driven Development
Published in: May 2018
Publisher:
ISBN-13: 9781788292481
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image