Pluralsight's Design Patterns Library course has a module on the Rules Pattern from Steve Smith. The Rules Pattern is applicable in a class or method with complex business logic whose complexity is likely to continue to increase. A good example is complex discount or gamification logic. The Rules Pattern should be considered in systems with lots of conditional complexity, and where the selection…
Keep Reading →
I was recently working on an application in the MVC framework in .NET, working with Entity Framework and interacting with an SQL database. I was trying to create a many-to-many relationship between Member entities and Book entities (members could read several books, and books could be read by several members). Unfortunately, prior to .NET 5 (which is still technically in preview mode), Entity…
Keep Reading →
Pluralsight's Design Patterns Library course has a module on the Unit of Work Pattern from Scott Allen. The main goals of the Unit of Work Pattern are to make data access more efficient, check for concurrent changes, and manage transactions with a database. The Unit of Work is intended to keep track of the business logic's changes so that the business logic doesn't have to. The business logic is…
Keep Reading →
The String Calculator Kata is a great kata for practicing test-driven development. In this kata, you spend 30 minutes trying to complete as many of the 9 sections as possible, but the idea is that you never read ahead - you can only read the step you're on. You can view the instructions here. This attempt, I got through 5 sections. That's the same number as last time. Indeed, it's the same number…
Keep Reading →
Pluralsight's Design Patterns Library course has a module on the Service Locator Pattern from John Brown. Service Locators are often useful in the implementation of logging because it is independent of specific business functions and is used throughout the application, but is often changed based on environmental needs. A Service Locator can be used to abstract the logger from the application…
Keep Reading →
Pluralsight's Design Patterns Library course has a module on the Repository Pattern from Scott Allen. The Repository Pattern can be used in applications which perform data access. No matter the data source, Repository can be used to interface between your logic code and that data source (Kind of like an adapter). This prevents you from duplicating data access logic in your higher-level business…
Keep Reading →
Pluralsight's Design Patterns Library course has a module on the Lazy Load Pattern from Steve Smith. The Lazy Load Pattern aims to reduce unnecessary work in an application that loads objects from a database, while avoiding loading aspects of the object that the application does not use. Depending on the specific implementation, the client may or may not know lazy loading is being used (though it…
Keep Reading →
Pluralsight's Design Patterns Library course has a module on the Event Aggregator Pattern from Glenn Block. The Event Aggregator Pattern simplifies events by providing a single storage place for those events. It decouples publishers and subscribers and makes it very easy to introduce new events. This pattern is most applicable in a composite application (an application broken up into several…
Keep Reading →
This post contains my notes from Essential LINQ by Charlie Calvert and Dinesh Kulkarni. Most example code comes directly from the book, and any prose taken from the book is in quotes. What LINQ is - "The Essence of LINQ" Integrated - "first class citizen of .NET languages" as opposed to SQL, for example, which is more complicated to write in C# and does not have the benefits of type-checking…
Keep Reading →
The String Calculator Kata is a great kata for practicing test-driven development. In this kata, you spend 30 minutes trying to complete as many of the 9 sections as possible, but the idea is that you never read ahead - you can only read the step you're on. You can view the instructions here. This attempt, I got through 5 sections. That's the same number as last time. I got held up with syntax of…
Keep Reading →