Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Clean Code in C#
  • Table Of Contents Toc
Clean Code in C#

Clean Code in C#

By : Jason Alls
4.1 (8)
close
close
Clean Code in C#

Clean Code in C#

4.1 (8)
By: Jason Alls

Overview of this book

Traditionally associated with developing Windows desktop applications and games, C# is now used in a wide variety of domains, such as web and cloud apps, and has become increasingly popular for mobile development. Despite its extensive coding features, professionals experience problems related to efficiency, scalability, and maintainability because of bad code. Clean Code in C# will help you identify these problems and solve them using coding best practices. The book starts with a comparison of good and bad code, helping you understand the importance of coding standards, principles, and methodologies. You’ll then get to grips with code reviews and their role in improving your code while ensuring that you adhere to industry-recognized coding standards. This C# book covers unit testing, delves into test-driven development, and addresses cross-cutting concerns. You’ll explore good programming practices for objects, data structures, exception handling, and other aspects of writing C# computer programs. Once you’ve studied API design and discovered tools for improving code quality, you’ll look at examples of bad code and understand which coding practices you should avoid. By the end of this clean code book, you’ll have the developed skills you need in order to apply industry-approved coding practices to write clean, readable, extendable, and maintainable C# code.
Table of Contents (17 chapters)
close
close

Knowing when to send code for review

Code reviews should take place when the development is complete and before the programmer of the code passes the code on to the QA department. Before any code is checked into version control, all the code should build and run without errors, warnings, or information. You can ensure this by doing the following:

  • You should run static code analysis on your programs to see whether any issues are raised. If you receive any errors, warnings, or information, then address each point raised. Do not ignore them as they can cause problems further down the line. You can access the Code Analysis configuration dialog on the Code Analysis page of the Visual Studio 2019 Project Properties tab. Right-click on your project and select Properties | Code Analysis.
  • You should also make sure that all your tests run successfully, and you should aim to have all your new code to be fully covered by normal and exceptional use cases that test the correctness of your code against the specification you are working on.
  • If you employ a continuous development software practice within your place of work that integrates your code into a larger system, then you need to make sure that the system integration is successful and that all tests run without failing. If any errors are encountered, then you must fix them before you go any further.

When your code is complete, fully documented, and your tests work, and your system integration all works without any issues, then that is the best time to undergo a peer code review. Once you have reached the point that your peer code review is approved, your code can then be passed on to the QA department. The following diagram shows the Software Development Life Cycle (SDLC) from the development of the code through to the end of the life of the code:

The programmer codes the software as per specifications. They submit the source code to the version control repository and issue a pull request. The request is reviewed. If the request fails, then the request is rejected with comments. If the code review passes, then the code is deployed to the QA team that carry out their own internal testing. Any bugs found are raised for the developers to fix. If the internal testing passes QA, then it is deployed into User Acceptance Testing (UAT).

If UAT fails, then bugs are raised with the DevOps team, who could be developers or infrastructure. If UAT passes QA, then it is deployed to staging. Staging is the team responsible for deploying the product in the production environment. When the software is in the hands of the customer, they raise a bug report if they encounter any bugs. Developers then work on fixing the customer's bugs, and the process is restarted. Once the product reaches the end of its life, it is retired from service.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Clean Code in C#
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon