Chapter 2. Coding Algorithms
We code every day, thinking about the problem we’re solving and ensuring that our algorithms work correctly. This is how it should be, and modern tools and software development kits increasingly free our time to do just that. Even so, there are features of C#, .NET, and coding in general that have significant effects on efficiency, performance, and maintainability.
Performance
A few subjects in this chapter discuss application performance, such as the efficient handling of strings, caching data, or delaying the instantiation of a type until you need it. In some simple scenarios, these things might not matter. However, in complex enterprise apps that need the performance and scale, keeping an eye on these techniques can help avoid expensive problems in production.
Maintainability
How you organize code can significantly affect its maintainability. Building on the discussions in Chapter 1, you’ll see a new pattern and strategy and understand how they can help simplify an algorithm and make an app more extensible. Another section discusses using recursion for naturally occurring hierarchical data. Collecting these techniques and thinking about the best way to approach an algorithm can make a significant difference in the maintainability and quality of code.
Mindset
A couple of sections of this chapter might be interesting in specific contexts, illustrating different ways to think about solving problems. You might not use regular expressions every ...
Get C# Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.