Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Tools and Skills for .NET 8

You're reading from   Tools and Skills for .NET 8 Get the career you want with good practices and patterns to design, debug, and test your solutions 

Arrow left icon
Product type Paperback
Published in Jul 2024
Publisher Packt
ISBN-13 9781837635207
Length 778 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mark J. Price Mark J. Price
Author Profile Icon Mark J. Price
Mark J. Price
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Introducing Tools and Skills for .NET 2. Making the Most of the Tools in Your Code Editor FREE CHAPTER 3. Source Code Management Using Git 4. Debugging and Memory Troubleshooting 5. Logging, Tracing, and Metrics for Observability 6. Documenting Your Code, APIs, and Services 7. Observing and Modifying Code Execution Dynamically 8. Protecting Data and Apps Using Cryptography 9. Building an LLM-Based Chat Service 10. Dependency Injection, Containers, and Service Lifetime 11. Unit Testing and Mocking 12. Integration and Security Testing 13. Benchmarking Performance, Load, and Stress Testing 14. Functional and End-to-End Testing of Websites and Services 15. Containerization Using Docker 16. Cloud-Native Development Using .NET Aspire 17. Design Patterns and Principles 18. Software and Solution Architecture Foundations 19. Your Career, Teamwork, and Interviews 20. Epilogue 21. Index

Where to go for help

This section is all about how to find quality information about programming on the web.

My books are specifically written in a tutorial style so that you can get started quickly and confidently before then switching to the official documentation for more details or specialized scenarios.

This technique is commonly used by developers to learn how to code. More than 50% use books or other physical media, and then more than 80% use other online resources, as shown in the Stack Overflow Survey 2023 at the following link: https://survey.stackoverflow.co/2023/#section-learning-to-code-learning-how-to-code.

Reading documentation on Microsoft Learn

The definitive resource for getting help with Microsoft developer tools and platforms is in the technical documentation on Microsoft Learn, and you can find it at the following link: https://learn.microsoft.com/en-us/docs.

Getting help for the dotnet tool

At the command prompt, you can ask the dotnet tool for help with its commands. The syntax is:

dotnet help <command>

This will cause your web browser to open a page in the documentation about the specified command. Common dotnet commands include new, build, and run.

Warning

The dotnet help new command worked with .NET Core 3.1 to .NET 6, but it returns an error with .NET 7 or later: Specified command 'new' is not a valid SDK command. Specify a valid SDK command. For more information, run dotnet help. Hopefully, the .NET team will fix that bug soon!

Another type of help is command-line documentation. It follows this syntax:

dotnet <command> -?|-h|--help

For example, dotnet new -?, dotnet new -h, or dotnet new --help output documentation about the new command at the command prompt.

LLMs like ChatGPT

One of the biggest changes in coding and development in the past year or so is the emergence of generative AI tools and LLMs that can help with coding tasks like completing a code statement, implementing an entire function, writing unit tests, and suggesting debugging fixes for existing code.

ChatGPT currently has several models: 3.5 and 4o (both free) and the Plus individual subscription ($20 per month). There are also Team and Enterprise subscriptions. You can compare options at the following link: https://openai.com/chatgpt/pricing/.

Let’s say you need to understand more about .NET tools and skills. You might enter the following prompt: “What are the most important tools and skills for a professional .NET developer to learn?”

The response would be something like the following:

“Hey there! When it comes to being a professional .NET developer, there are several essential tools and skills you should consider mastering. Here’s a detailed breakdown:

Tools:

  • Visual Studio: This IDE is the go-to choice for .NET development. Make sure you’re comfortable with its features and extensions.
  • Visual Studio Code: While Visual Studio is powerful, Visual Studio Code is a lightweight, versatile code editor that’s becoming increasingly popular among .NET developers.
  • .NET Core/.NET 5 and beyond: Stay up to date with the latest versions of the .NET framework. .NET 5 and its successors offer cross-platform support and performance improvements.
  • Git and GitHub: Version control is crucial. Git is a widely used distributed version control system, and GitHub provides a platform for collaborative development and code sharing.
  • Azure DevOps: Familiarize yourself with Azure DevOps for managing projects and continuous integration and continuous deployment (CI/CD) pipelines.
  • NuGet: Understanding package management with NuGet is essential for adding libraries and packages to your .NET projects.
  • Docker: Containerization is becoming increasingly important for deploying .NET applications. Docker can help you create and manage containers effectively.

Skills:

  • C#: As a .NET developer, C# is your primary language. Master object-oriented programming concepts, asynchronous programming, and LINQ.
  • ASP.NET Core: For web development, ASP.NET Core is the framework of choice. Learn about MVC architecture, Razor Pages, and API development.
  • Entity Framework Core: Understand how to work with databases using Entity Framework Core for efficient data access.
  • Dependency injection: Grasp the principles of dependency injection and how it’s used in .NET for managing object dependencies.
  • Unit testing: Writing unit tests using tools like xUnit or NUnit is crucial for ensuring the reliability of your code.
  • Web API design: If you’re building APIs, learn about RESTful design principles, authentication, and versioning.
  • Frontend technologies: Familiarize yourself with HTML, CSS, JavaScript, and frontend frameworks like React or Angular if you’re involved in web development.
  • Azure services: If you’re working in the cloud, explore Azure services like Azure Functions, Azure SQL Database, and Azure App Service.
  • Security: Understand security best practices, including authentication, authorization, and data protection.
  • Performance optimization: Learn about profiling, caching, and other techniques to optimize the performance of your applications.
  • Agile methodologies: Agile practices like Scrum and Kanban are widely used in software development. Understanding them can improve team collaboration.
  • Soft skills: Communication, problem solving, and teamwork are essential soft skills for any professional developer.

Now, I’ve covered quite a bit here, but remember that the tech landscape is always evolving. Staying curious and continuously learning is a vital skill in itself. If you have any specific questions or need more details on any of these topics, feel free to ask!”

There are a few topics that ChatGPT mentions that my books do not cover. These are:

  • Azure DevOps and Azure Services: For this book, I decided to remove requirements for Azure and other cloud services. I want all readers of my book to be able to complete all the tasks on their local computer without paying for a cloud account. I want to avoid pushing readers toward any particular cloud provider so from now on my books will be cloud agnostic.
  • Front-end technologies: HTML, CSS, and JavaScript, and the many, many client-side application frameworks like React and Angular.
  • Agile methodologies: This and other methodologies really need a whole book to cover them in depth. If I can find a way to usefully introduce them in only a few pages, then the next edition might do that.

Getting better help from LLMs using prompt engineering

You might have heard the term prompt engineering. This is an important skill for any professional to have since modern tasks will commonly be completed more efficiently by collaborating with an AI.

AI tools that integrate closely with your code editor like GitHub Copilot will be covered in Chapter 2, Making the Most of Your Code Editor.

To clarify or get a deeper understanding of a topic, or any piece of information, you can use the following prompt templates:

  • Explain [insert specific topic] in simple terms.
  • Explain to me like I’m a beginner in [field].
  • Explain to me in a natural, human-like manner.
  • Explain to me as if I’m 10 years old.
  • Write a detailed [essay/text/paragraph] for me about [topic] by adding all the information necessary.

Use affirmative directives and avoid negative formulations like “don’t.”

For complex answers, or when it responds with a shallow answer, include the phrase “think step-by-step.”

Assign a role to the large language models. For example, “You are an expert solution architect with decades of experience implementing .NET.”

If you’re unsure how to phrase a prompt, get the LLM to help you! For example:

“I want you to be my Prompt Engineer. Your goal is to assist me in creating the best prompt for my needs. The prompt will be used by you, ChatGPT. You will follow these steps: Your first response will be to ask me what the prompt should be about. I will provide my answer, but we will need to work together to improve it through continuous iterations by going through the next steps. Based on my input you will generate three sections:

  1. Revised prompt. Please provide your rewritten prompt. It should be clear, concise, and easily understood.
  2. Suggestions. Please provide ideas on what details to include in the prompt to enhance it.
  3. Questions. Please ask any relevant questions to gather additional information from me and improve the prompt.

We will continue this iterative process with me providing more information to you and you updating the prompt in the Revised prompt section until it’s complete. Thank you!”

If you own a PC with an Nvidia GTX card, then you can download a free chat app to customize and converse with local LLMs. It can even process files like PDFs. If any of you try adding a PDF of any of my books so that you can ask questions about them, please let me know how you get on. You can find out more at the following link: https://blogs.nvidia.com/blog/chat-with-rtx-available-now/.

AI usage by developers

According to the Stack Overflow Survey 2023 (https://survey.stackoverflow.co/2023/#section-sentiment-and-usage-ai-tools-in-the-development-process), “70% of all respondents are using or are planning to use AI tools in their development process this year. Those learning to code are more likely than professional developers to be using or use AI tools (82% vs. 70%).”

Getting help on Discord and other chat forums

Asking questions in programming forums and Discord channels is an art as much as it is a science. To maximize your chances of receiving a helpful answer, there’s a blend of clarity, specificity, and community awareness that you should aim for.

Here are some tips for asking questions:

  • Ask in a public channel, not in private: Please do not direct message an author with a question or a friend request. Remember, every question asked and answered builds the collective knowledge and resourcefulness of the whole community. Asking in public also allows other readers to help you, not just the author. The community that Packt and I have built around my books is friendly and smart. Let us all help you.
  • Research before asking: It’s important to look for answers yourself before turning to the community. Use search engines, official documentation, and the search function within the forum or Discord server. This not only respects the community’s time but also helps you learn more effectively. Another place to look first is the errata section of the book at the following link: https://github.com/markjprice/tools-skills-net8/blob/main/docs/errata/README.md.
  • Be specific and concise: Clearly state what you’re trying to achieve, what you’ve tried so far, and where you’re stuck. A concise question is more likely to get a quick response.
  • Specify the book location: If you are stuck on a particular part of the book, specify the page number and section title so that others can look up the context of your question.
  • Show your work: Demonstrating that you’ve made an effort to solve the problem yourself not only provides context but also helps others understand your thought process and where you might have gone wrong.
  • Prepare your question: Avoid too broad or too vague questions. Screenshots of errors or code snippets (with proper formatting) can be very helpful.

Oddly, I’ve been seeing more and more examples of readers taking photos of their screen and posting those. These are harder to read and limited in what they can show. It’s better to copy and paste the text of your code or the error message so that others can copy and paste it themselves. Or at least take a high resolution screenshot instead of a photo!

  • Format your code properly: Most forums and Discord servers support code formatting using Markdown syntax. Use formatting to make your code more readable. For example, surround code keywords in single backticks like this: `public void`, and surround code blocks with three backticks with an optional language code, as shown in the following code:
    ```cs
    using static System.Console;
    WriteLine("This is C# formatted code.");
    ```
    

Good Practice

After the three backticks that start a code block in Markdown, specify a language code like cs, csharp, js, javascript, json, html, css, cpp, xml, mermaid, python, java, ruby, go, sql, bash, or shell.

More Information

To learn how to format text in Discord channel messages, see the following link: https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline.

  • Be polite and patient: Remember, you’re asking for help from people who are giving their time voluntarily. A polite tone and patience while waiting for a response go a long way. Channel participants are often in a different timezone so may not see your question until the next day.
  • Be ready to actively participate: After asking your question, stay engaged. You might receive follow-up questions for clarification. Responding promptly and clearly can significantly increase your chances of getting a helpful answer. When I ask a question, I set an alarm for three hours later to go back and see if anyone has responded. If there hasn’t been a response yet, then I set another alarm for 24 hours later.

Incorporating these approaches when asking questions not only increases your likelihood of getting a useful response but also contributes positively to the community by showing respect for others’ time and effort.

Good Practice

Never just say “Hello” as a message on any chat system. You can read why at the following link: https://nohello.net/. Similarly, don’t ask to ask: https://dontasktoask.com/.

lock icon The rest of the chapter is locked
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