Practical .NET

Who's in Charge Now? UI Control and the Interface Segregation Principle

If you adopt the Interface Segregation principle, then you can eliminate (or, at least, control) one of the most annoying problems in creating very useful objects. But following that principle through to its conclusion also inverts the traditional hierarchy of the development team.

It's OK To Be Lazy And Defer Creating Objects Until You Need Them

You can write some complicated code to ensure that you don't create any object until you absolutely need it. Or you can use the Lazy least some of the time.

Retain State by Serializing to Disk

If you're looking for an easy way to save the user's current state, the simplest solution is use the Serialize and Deserialize method.

Stepping Through Binding Styles Using SpecFlow 2

SpecFlow offers a number of binding styles for bridging business-readable tests with test-automation code.

Saving Data on the Client in ASP.NET MVC

Here's another way to make applications more scalable and more responsive to the user: store some application data on the user's computer.

Creating a Flexible, Extendable Update Process

In any real-world business, updating data isn't simple and changing the rows in the table is just the start of a complex set of processes. Fortunately, you can break those updates down into a bunch of simple processes that can be easily extended.

Use Lambda Expressions in LINQ Includes

You couldn't do it in earlier versions of Entity Framework but, in more recent versions, you can use lambda expressions to save yourself from some runtime errors.

Implementing Updates Without Query

The CQRS pattern separates updates from queries, allowing you to create the best process for each of those activities. Effectively, CQRS codifies the standard practice for ASP.NET MVC developers: Here are some strategies for implementing that pattern and improving your application's performance.

Processing All Properties on an Object

If you ever need to work with all of the properties in some object, you can use GetType and GetProperties to retrieve the object's PropertyInfo objects. After that you can do what you want. Here's an extension method that sets all those properties to their defaults, for example.

Simplifying Data Retrieval with CQRS in ASP.NET MVC

Data retrieval and updates are very different activities so the CQRS pattern says that the smart thing to do is treat them differently. Here's a variety of solutions for the retrieval side in an ASP.NET MVC application.

Simplify Code with the Visitor Pattern

You can't make a complicated problem simple. But, by leveraging the right tools in your language (and the Visitor pattern) you can ensure that your code doesn't get as complicated as your problem.

Logic Is Your Enemy

Leveraging the right combination of object-oriented tools can keep your code simple, even as the problems you solve get more complicated.

Exploiting the ConcurrentDictionary in Asynchronous Applications

The ConcurrentDictionary provides the most efficient (and safest) way to shared named values between asynchronous processes with several powerful methods. But the best advice might be to avoid ever needing them.

Stack Up the Stream Objects to Combine Functionality

Using the Stream objects correctly can speed up your I/O, protect your files and simplify your code.

SpecFlow 2, Part Two: Gherkin Steps

In part 2, Jason will map the business-readable tests we created last time to test automation code.

Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.