|
| 1 | +--- |
| 2 | +title: 'Book: An Atypical ASP.NET Core 8 Design Patterns Guide' |
| 3 | +subtitle: "What's new in the third edition?" |
| 4 | +date: 2023-12-01 00:00:00 -0500 |
| 5 | +post-img: '/img/2023-12-Book3-release-960.png' |
| 6 | +# og-img: '//cdn.forevolve.com/blog/images/articles-header/2022-05-Book2-release-LinkedIn.png' |
| 7 | +# twitter-img: '//cdn.forevolve.com/blog/images/articles-header/2022-05-Book2-release-LinkedIn.png' |
| 8 | +lang: en |
| 9 | +categories: en/articles |
| 10 | +tags: |
| 11 | + - UML |
| 12 | + - Book |
| 13 | +proficiency-level: Intermediate |
| 14 | +--- |
| 15 | + |
| 16 | +...<!--more--> |
| 17 | + |
| 18 | +# What's new and what's changed? |
| 19 | + |
| 20 | +## Sections/general |
| 21 | + |
| 22 | +- Renamed and reworked the sections |
| 23 | +- Removed Section 5 and all (or most?) UI code and moved the focus of the book purely on REST APIs instead. |
| 24 | +- Consolidated on using the term `REST APIs` instead of `web APIs`, since `web APIs` can be confused with Browsers web APIs (like local storage). |
| 25 | +- Refactored pararaphs into lists into **tables** to improve clarity. |
| 26 | +- Refactored many section heading to improve navigation to a specific subject. |
| 27 | +- Reviewed the questions and answers of many chapters; lot's of improvements. |
| 28 | +- Reviewed the introduction, section conclusions, and chapter summary of multiple chapters. |
| 29 | +- Lots of code formatting improvements. |
| 30 | +- Removed grid background in diagrams |
| 31 | + |
| 32 | +## Chapter 2 |
| 33 | + |
| 34 | +- Major reorg of subjects. |
| 35 | +- Improve the readability of the code samples. |
| 36 | +- Add a section about black-, white-, and grey-box testing. |
| 37 | +- Add a section about _Test case creation_, _Boundary Value Analysis_, _Decision Table Testing_, _State Transition Testing_, and _Use Case Testing_. |
| 38 | + |
| 39 | +## Chapter 3 |
| 40 | + |
| 41 | +- Reorder subjects, starting with separation of concerns, DRY, and KISS instead of SOLID. Moved SOLID after. |
| 42 | +- Rewrite SOLID code samples. They are now simpler and more enterprise focused than game focused. |
| 43 | +- Rewrite the covariant and contravariant explanation and sample using generics. |
| 44 | +- PLANNED: Add "you aren’t gonna need it (YAGNI) principle" |
| 45 | + |
| 46 | +## Chapter 4-6 |
| 47 | + |
| 48 | +- Chapter 4: extracted REST, HTTP, DTO, and API contracts (part of section 1) + rewrite/improvements |
| 49 | +- Chapter 5: new introduction to the minimal hosting model and minimal APIs (part of section 2), including deep dive into minimal APIs. |
| 50 | +- Chapter 6: Merged the two MVC chapters into one (2nd ed. Chapter 4 and 5) with a focus on REST APIs. |
| 51 | +- The same new, real-world oriented code example is used with both Minimal APIs (Chapter 5) and MVC (Chapter 6), allowing readers to compare the two implementations. |
| 52 | + |
| 53 | +## Chapter 7 |
| 54 | + |
| 55 | +- Minor changes improving the explanations, descriptions, and the flow. |
| 56 | + |
| 57 | +**Strategy:** |
| 58 | + |
| 59 | +- Replaced the Strategy console app by a minimal API app. |
| 60 | + |
| 61 | +**AbstractFactory:** |
| 62 | + |
| 63 | +- Rename HighGrade and LowGrade by HighEnd and LowEnd for more proper English. Also renamed MiddleGrade & MiddleEnd to MidRange. |
| 64 | +- Simplify tests to make them easier to read. Converted the `Theory` to `Fact`. |
| 65 | +- Simplified the projects and solutions structure (kept only one solution). |
| 66 | +- Grouped the classes by familly instread of by "layers". The folders went from (root, models) to (root{abstractions}, HighEnd, LowEnd, MidRange). |
| 67 | + |
| 68 | +**Singleton:** |
| 69 | + |
| 70 | +- Use the null-coalescing assignment operator `??=` instead of a `if` block. |
| 71 | + |
| 72 | +## Chapter 8 |
| 73 | + |
| 74 | +- Reordered and reworked the Dependency Injection theory section. |
| 75 | +- Rewrote and improved the code sample and most of the Strategy section, including Constructor/Property/Method injection, and Guard clauses. |
| 76 | +- Extracted Guard clauses into its own top-level section |
| 77 | +- Updated the project Application state. |
| 78 | +- Talk quickly about the new .NET 8 `TimeProvider` (wishlist project). |
| 79 | +- Rewrote the factory section and updated the code to reflect the new Strategy code. (the old code could be a good blog post). |
| 80 | +- Rewrote the summary to reflect the new content and added a list of Key takeaways. |
| 81 | + |
| 82 | +## Chapter 9 |
| 83 | + |
| 84 | +- Split the chapter in two. |
| 85 | +- Rewrote most of the options chapter, including code samples. Made them clearer, shorter, more consise, and more "building-block-oriented". |
| 86 | +- Add a code sample about the IOptionsMonitor.OnChange method. |
| 87 | +- Add a code sample about centralizing the configuration and validation into the options class. |
| 88 | +- Add a section about .NET 8 configuration-binding source generator |
| 89 | +- Add a section about .NET 8 options validation source generator |
| 90 | +- Add a section about ValidateOptionsResultBuilder |
| 91 | + |
| 92 | +## Chapter 10 |
| 93 | + |
| 94 | +- No significant changes |
| 95 | + |
| 96 | +## Chapter 11 |
| 97 | + |
| 98 | +- Rewrote the Book Store UI into an API (Composite Pattern) |
| 99 | +- Removed the ultra-large bookstore diagram and simplified it |
| 100 | +- Updated the bookstore data structure to reflect the API focus |
| 101 | +- Renamed the corporation and bookstores, added managers, and improved locations |
| 102 | + |
| 103 | +## Chapter 12 |
| 104 | + |
| 105 | +**Template method** |
| 106 | + |
| 107 | +- Added two test cases in a new test project |
| 108 | +- Corrected a bug in the code |
| 109 | +- Refactor the LinearSearchMachine algo |
| 110 | + |
| 111 | +**Chain of Responsibilities** |
| 112 | + |
| 113 | +- Improved the text by adding a few more steps to the example. |
| 114 | +- Extracted "Mixing the Template Method and Chain of Responsibility patterns" to its own section. |
| 115 | + |
| 116 | +**Mixing the Template Method and Chain of Responsibility patterns** |
| 117 | + |
| 118 | +- New section |
| 119 | +- Improved flow and reworked some explanations. |
| 120 | + |
| 121 | +## Chapter 13 |
| 122 | + |
| 123 | +- Minor tweaks |
| 124 | +- Added a few questions |
| 125 | +- Added a life-like code sample to wrap the chapter |
| 126 | + |
| 127 | +## Chapter 14 |
| 128 | + |
| 129 | +- Minor text tweaks |
| 130 | + |
| 131 | +## Chapter 15 |
| 132 | + |
| 133 | +- Improved the headings |
| 134 | +- Add an example using Mapperly |
| 135 | + |
| 136 | +## Chapter 16 |
| 137 | + |
| 138 | +- Few code tweaks, including the use of record classes instead of regular classes in the Mediator examples. |
| 139 | +- Renamed the pattern CQS from CQRS; even if it was true before, it's more precise now since CQS is a subset of CQRS. |
| 140 | +- Promoted the Code Smell – Marker Interfaces section to Heading 1. |
| 141 | +- Updated MediatR to version 12 (from v9). |
| 142 | + |
| 143 | +## Chapter 17 |
| 144 | + |
| 145 | +- Update dependencies of the project to the latest versions (including a few breaking changes). |
| 146 | +- Refactor the headings, promoting `Anti-pattern – Big Ball of Mud` and `Continuing your journey` as level 1 sections. |
| 147 | +- Updated all diagrams (improved contrasts to some of them, making them more accessible). |
| 148 | +- Removed the custom FluentValidation & MediatR code to make validation work as it now works out of the box. Deleted the `FluentValidationExceptionFilter` (`IExceptionFilter`) class and the `ThrowFluentValidationExceptionBehavior<TRequest, TResponse>` (`IPipelineBehavior<TRequest, TResponse>`) class. Removed the need to register the validators as `ServiceLifetime.Singleton`. |
| 149 | + |
| 150 | +## Chapter 18 |
| 151 | + |
| 152 | +- A brand new chapter about Request-EndPoint-Response (REPR) & Minimal API. |
| 153 | +- Defines the pattern. |
| 154 | +- Organize the code in different ways using only Minimal APIs. |
| 155 | +- Explore a larger project that includes exception handling, object mapping, and grey-box testing. |
| 156 | + |
| 157 | +## Chapter 19 |
| 158 | + |
| 159 | +- Minor updates throughout the chapter. |
| 160 | +- Add a BFF example that fronts the Chapter 18 REPR example and showcases API layering (low-level operation in Chapter 18 and higher-level logic/operation in Chapter 19). 30 pages |
| 161 | +- Remake the Adapter section images. |
| 162 | +- Add an _Advantages and potential risks_ section under CQRS. |
| 163 | + |
| 164 | +## Chapter 20 |
| 165 | + |
| 166 | +- New chapter about Modular Monolith. |
| 167 | +- Takes the nano-e-commerce app from Chapter 18 and 19 and makes it a modular monolith. |
| 168 | +- Adapt the code of the BFF to front the Monolith. |
| 169 | +- Add in-process EDA to synchronize the two domains (cart and catalog) using MassTransit. |
| 170 | + |
| 171 | +# New Outline |
| 172 | + |
| 173 | +``` |
| 174 | +Section 1: Principles and Methodologies |
| 175 | +1. Introduction |
| 176 | +2. Automated Testing |
| 177 | +3. Architectural Principles |
| 178 | +4. REST APIs |
| 179 | +
|
| 180 | +Section 2: Designing with ASP.NET Core |
| 181 | +5. Minimal API |
| 182 | +6. Model-View-Controller |
| 183 | +7. Strategy, Abstract Factory, and Singleton Design Patterns |
| 184 | +8. Dependency Injection |
| 185 | +9. Application Configuration and the Options Pattern |
| 186 | +10. Logging patterns |
| 187 | +
|
| 188 | +Section 3: Components patterns |
| 189 | +11. Structural Patterns |
| 190 | +12. Behavioral Patterns |
| 191 | +13. Operation Result Pattern |
| 192 | +
|
| 193 | +Section 4: Applications patterns |
| 194 | +14. Layering and Clean Architecture |
| 195 | +15. Object Mappers, Aggregate Services, and Façade |
| 196 | +16. Mediator and CQRS Patterns |
| 197 | +17. Vertical Slice Architecture |
| 198 | +18. Request-EndPoint-Response (REPR) |
| 199 | +19. Introduction to Microservices Architecture |
| 200 | +20. Modular Monolith |
| 201 | +=== |
| 202 | +**Notes about the content** |
| 203 | +#4: REST, HTTP, API Contracts, and the DTO pattern (were part of the MVC chapters before) |
| 204 | +#5: Includes an introduction to the Minimal Hosting model (consolidate the content about this and make it clearer for the readers) |
| 205 | +#6: MVC pattern & MVC + DTO (a stripped down version of the MVC chapters, focusing on MVC for REST APIs) |
| 206 | +=== |
| 207 | +**TODO:** |
| 208 | +#2: add an info box about minimal hosting and the new Chapter 4 to explain readers that don't know about that, that we will talk about it there. |
| 209 | +``` |
| 210 | + |
| 211 | +# Wave 2 |
| 212 | + |
| 213 | +- Replaced code sample in Chapter 10 (logging) |
| 214 | +- Replaced code sample in Chapter 11 (facade) |
0 commit comments