Book description
Build on your existing programming skills and upskill to professional-level C# programming.In Code Like A Pro in C# you will learn:
- Unit testing and test-driven development
- Refactor a legacy .NET codebase
- Principles of clean code
- Essential backend architecture skills
- Query and manipulate databases with LINQ and Entity Framework Core
Critical business applications worldwide are written in the versatile C# language and the powerful .NET platform, running on desktops, cloud systems, and Windows or Linux servers. Code Like a Pro in C# makes it easy to turn your existing abilities in C# or another OO language (such as Java) into practical C# mastery. There’s no “Hello World” or Computer Science 101 basics—you’ll learn by refactoring an out-of-date legacy codebase, using new techniques, tools, and best practices to bring it up to modern C# standards.
About the Technology
You know the basics, now get ready for the next step! Pro-quality C# code is efficient, clean, and fast. Whether you’re building user-facing business applications or writing data-intensive backend services, the experience-based, practical techniques in this book will take your C# skills to a new level.
About the Book
Code Like a Pro in C# teaches you to how write clean C# code that’s suitable for enterprise applications. In this book, you’ll refactor a legacy codebase by applying modern C# techniques. You’ll explore tools like Entity Framework Core, design techniques like dependency injection, and key practices like testing and clean coding. It’s a perfect path to upgrade your existing C# skills or shift from another OO language into C# and the .NET ecosystem.
What's Inside
- Unit testing and test-driven development
- Refactor a legacy .NET codebase
- Principles of clean code
- Query and manipulate databases with LINQ and Entity Framework Core
About the Reader
For developers experienced with object-oriented programming. No C# experience required.
About the Author
Jort Rodenburg is a software engineer who has taught numerous courses on getting up to speed with C# and .NET.
Quotes
Worth reading multiple times.
- Prabhuti Prakash, Synechron Technologies
Packed with guidance and insights to get you there quickly. Highly recommended!
- Edin Kapic, isolutions
This book really helped me to move to the next level.
- Daniel Vásquez Estupiñan, Tokiota
This is the book you are looking for when you want to know how to code in the most idiomatic way possible with C#.
- Gustavo Filipe Ramos Gomes, Troido
Teaches excellent techniques and best practices for modern C# development.
- Foster Haines, J2 Interactive
Publisher resources
Table of contents
- inside front cover
- Code like a Pro in C#
- Copyright
- contents
- front matter
- Part 1 Using C# and .NET
- 1 Introducing C# and .NET
- 2 .NET and how it compiles
- Part 2 The existing codebase
- 3 How bad is this code?
-
4 Manage your unmanaged resources!
-
4.1 The FlightController: Assessing the GET /flight endpoint
- 4.1.1 The GET /flight endpoint and what it does
- 4.1.2 Method signature: The meaning of ResponseType and typeof
- 4.1.3 Collecting flight information with collections
- 4.1.4 Connection strings, or how to give a security engineer a heart attack
- 4.1.5 Using IDisposable to release unmanaged resources
- 4.1.6 Querying a database with SqlCommand
- 4.2 The FlightController: Assessing GET /flight/{flightNumber}
- 4.3 The FlightController: POST /flight
- 4.4 The FlightController: DELETE /flight/{flightNumber}
- Exercises
- Summary
-
4.1 The FlightController: Assessing the GET /flight endpoint
- Part 3 The database access layer
-
5 Setting up a project and database with Entity Framework Core
- 5.1 Creating a .NET 5 solution and project
- 5.2 Setting up and configuring a web service
-
5.3 Implementing the database access layer
- 5.3.1 Entity Framework Core and reverse-engineering
- 5.3.2 DbSet and the Entity Framework Core workflow
- 5.3.3 Configuration methods and environment variables
- 5.3.4 Setting an environment variable on Windows
- 5.3.5 Setting an environment variable on macOS
- 5.3.6 Retrieving environment variables at run time in your code
- Exercises
- Summary
- Part 4 The repository layer
-
6 Test-driven development and dependency injection
- 6.1 Test-driven development
- Exercises
-
6.2 The CreateCustomer method
- 6.2.1 Why you should always validate input arguments
- 6.2.2 Using “arrange, act, assert” to write unit tests
- 6.2.3 Validating against invalid characters
- 6.2.4 In-lining test data with the [DataRow] attribute
- 6.2.5 Object initializers and autogenerated code
- 6.2.6 Constructors, reflection, and asynchronous programming
- 6.2.7 Locks, mutexes, and semaphores
- 6.2.8 Synchronous to asynchronous execution . . . continued
- 6.2.9 Testing Entity Framework Core
- 6.2.10 Controlling dependencies with dependency injection
- Exercises
- Summary
- 7 Comparing objects
-
8 Stubbing, generics, and coupling
- 8.1 Implementing the Booking repository
- 8.2 Input validation, separation of concerns, and coupling
- Exercises
- 8.3 Using object initializers
- 8.4 Unit testing with stubs
- 8.5 Programming with generics
- 8.6 Providing default arguments by using optional parameters
- 8.7 Conditionals, Func, switches, and switch expressions
- Exercises
- Summary
- 9 Extension methods, streams, and abstract classes
- Part 5 The service layer
- 10 Reflection and mocks
- 11 Runtime type checking revisited and error handling
- 12 Using IAsyncEnumerable<T> and yield return
- Part 6 The controller layer
- 13 Middleware, HTTP routing, and HTTP responses
- 14 JSON serialization/ deserialization and custom model binding
-
appendix A Exercise answers
- Chapter 2: .NET and how it compiles
- Chapter 4: Manage your unmanaged resources!
- Chapter 5: Setting up a project and database with Entity Framework Core
- Chapter 6: Test-driven development and dependency injection
- Chapter 7: Comparing objects
- Chapter 8: Stubbing, generics, and coupling
- Chapter 9: Extension methods, streams, and abstract classes
- Chapter 10: Reflection and mocks
- Chapter 11: Runtime type checking revisited and error handling
- Chapter 12: Using IAsyncEnumerable<T> and yield return
- Chapter 13: Middleware, HTTP routing, and HTTP responses
- appendix B Clean code checklist
- appendix C Installation guides
- appendix D OpenAPI FlyTomorrow
- appendix E Reading list
- index
- inside back cover
Product information
- Title: Code like a Pro in C#
- Author(s):
- Release date: July 2021
- Publisher(s): Manning Publications
- ISBN: 9781617298028
You might also like
video
Code like a Pro in C#, video edition
In Video Editions the narrator reads the book while the content, figures, code listings, diagrams, and …
book
Clean Code in C#
Develop your programming skills by exploring essential topics such as code reviews, implementing TDD and BDD, …
book
High-Performance Programming in C# and .NET
Enhance your applications' performance using best practices for benchmarking, application profiling, asynchronous programming, designing responsive UIs, …
video
Design Patterns Using C# and .NET Core
Design patterns are reusable solutions to common programming problems. They speed up the development process by …