Posts about the C# language itself, including use, abuse and features.

Caching without Race Conditions

Saturday, June 13 2020 wordtutor-redux csharp

It wasn’t very long after my prior update on caching that a friend informed me that the code has a race condition. Yes, the same friend who persuaded me to update it last time. Worse, during a Skype call, we identified code that would outright fail for an independent reason.

Read more »

Improved Caching

Saturday, May 09 2020 wordtutor-redux csharp

After our recent introduction of caching, I had an interesting conversation with a friend about the way I’d written the code. He was persuasive that the approach I’d taken had some significant issues and that it was worth taking the time to address them.

Read more »

Caching Speech

Saturday, April 25 2020 wordtutor-redux csharp

If you’ve been playing around with maintenance screen and the speech integration that we completed last week you may have noticed that there can be a noticeable lag between the time you press a play button and when you hear the speech.

Read more »

Speech Middleware

Saturday, April 11 2020 wordtutor-redux csharp

Now that we’ve modified our Redux store to support middleware, we have the foundation needed to integrate speech synthesis into the main flow of our application.

Read more »

Redux Middleware Implementation

Saturday, March 28 2020 wordtutor-redux csharp

Based on the interfaces we defined last time, let’s integrate middleware functionality into our existing Redux store. This will lay the foundation we need for asynchronous speech generation.

Read more »

Redux Middleware

Saturday, March 14 2020 wordtutor-redux csharp

At this point in the development of the WordTutor, we need to properly incorporate speech generation into the application. We could hack and glue it into place on top of the existing architecture, or we can integrate it into the existing structure in a clean way.

Read more »

Always review code you copy

Saturday, February 29 2020 csharp

Recently a friend of mine noticed some code in a book that was, shall we say, considerably sub-optimal. It’s worth looking at the code to see how both the performance and readability of the code can be easily improved.

Read more »

Speech API

Saturday, February 15 2020 wordtutor-redux csharp

For the WordTutor application to work, we need to be able to read words (and letters) out loud to our student. To power the speech synthesis, we’re going to integrate Azure Cognitive Services into the application.

Read more »

Logging Implementation

Saturday, January 25 2020 wordtutor-redux csharp

To implement the logging interfaces described earlier, there are some issues we need to consider. There are two different usage patterns we need to support, plus we need to support concurrent use, and avoid code duplication.

Read more »

Logging Demonstrated

Saturday, January 11 2020 wordtutor-redux csharp

After earlier defining our logging interface, some readers posed a few questions about how it would work from a consumers perspective. So before we look at implementation details, let’s look at how we’ll instrument our code and what the output might look like.

Read more »

Logging

Saturday, December 28 2019 wordtutor-redux csharp

As we progress building the WordTutor application, some of the functionality will be a great deal more complex - and that requires a better way to see what’s happening inside the application than we’ve had to date. It’s time to implement some logging.

Read more »

Wither convention testing

Saturday, December 14 2019 wordtutor-redux csharp testing

Following on from our previous post on convention testing we can extend the conventions by considering the standards we want to follow when we write methods on our immutable types.

Read more »

Convention testing for immutable types

Saturday, November 30 2019 wordtutor-redux csharp testing

The Redux architecture we’re using for our application state relies on all our state objects being properly immutable. So far, we’ve relied on nothing more than self-discipline to ensure no mistakes are made. By adding some convention testing to our project, we can enlist some help in avoiding common errors.

Read more »

Modifying Words, Part the Second

Saturday, November 16 2019 wordtutor-redux csharp

If you’ve tried out our application as it stood after last week’s post, you may have noticed that the user experience for modifying a word is a bit suboptimal. After selecting a word, you have to separately press the Modify button. Can we do better?

Read more »

Modifying Words, Part the First

Saturday, November 09 2019 wordtutor-redux csharp

The existing model class ModifyVocabularyWordScreen only handles the creation of a new word. We need to modify it to support the modification of an existing word as well.

Read more »

Hashcodes

Saturday, October 26 2019 wordtutor-redux csharp

Here’s an odd warning that came up when I was working on last weeks Code Gardening post:

Read more »

Code Gardening

Saturday, October 19 2019 wordtutor-redux csharp

Continuing on the theme from our past two posts, we’ll address the remaining issues related to nullable types, as well as taming the rest of our current storm of compiler warnings.

Read more »

Nullable types redux

Saturday, October 12 2019 wordtutor-redux csharp

Continuing our the upgrade process from last time, in this post we’ll explore the changes required to our WordTutor.Desktop project.

Read more »

C# 8 and .NET Core 3.0

Saturday, September 28 2019 wordtutor-redux csharp

It’s been a big week of releases in the world of .NET with the release of both .NET Core 3.0 and C# 8. Let’s upgrade the Wordtutor projects to all the latest versions and see what we learn.

Read more »

Commands and CommandBinding

Saturday, September 21 2019 wordtutor-redux csharp

Up until this point, we’ve relied exclusively on data-binding for the link between our view-models and our views. While data-binding handles a lot of scenarios well, it doesn’t support buttons, menu items and so on.

Read more »

Debugging word selection

Saturday, September 14 2019 wordtutor-redux csharp

With subscriptions wired up to keep our view models updated, we can run our application and start clicking around. When we select a word, we can trace through the flow of messages to see how everything updates. But, it’s easy to crash. Let’s debug that crash and work out how to make the application more robust.

Read more »

ViewModel Subscriptions

Saturday, August 31 2019 wordtutor-redux csharp

Now that our Redux store supports subscriptions, we can register to update our existing view models, allowing them to automatically stay current as our application state changes. The changes to each will be similar, but with a few variations on the common theme.

Read more »

Redux Subscriptions

Sunday, August 25 2019 wordtutor-redux csharp

One of the problems we currently have is caused by lack of updates - our application model can change without our view-models being notified that the change has happened, leaving our user interface showing stale information. To solve this, we’ll extend our Redux store with subscriptions, to allow each view-models to be proactively notified when things change.

Read more »

Dependency Injection: Views

Saturday, August 17 2019 wordtutor-redux csharp

We saw last time that setting up dependency injection for our viewmodels involved a small number of moving parts. The same applies when applying dependency injection to our views, but with a few additional complexities.

Read more »

Dependency Injection: ViewModels

Saturday, August 10 2019 wordtutor-redux csharp

Based on the foundation from last time, we can now turn our attention to our view-models. How can we use our dependency injection framework to construct each view model on demand?

Read more »

Dependency Injection: Core

Saturday, July 27 2019 wordtutor-redux csharp

To this point, we’ve been able to run each of our screens by hand-coding the necessary object initialization. We could continue this as we move forward, but the complexity would grow with each additional screen we complete. Instead, let’s take the time to configure a dependency injection framework that will take care of the complexity for us.

Read more »

Integration Testing

Saturday, July 20 2019 wordtutor-redux csharp testing

In addition to the unit tests we’re already writing for each of our core classes, we should also write some integration tests to ensure our types interact properly.

Read more »

Restructuring Reducers

Saturday, July 13 2019 wordtutor-redux csharp

When I got to this point of the series, I expected to be writing about some interaction testing - checking that our messages triggered the right transitions between screens.

Read more »

Older posts

Vocabulary Browser  29 Jun 2019
Revisiting ViewModelBase  15 Jun 2019
First Light  08 Jun 2019
Add Word View  25 May 2019
Add Word View Model  11 May 2019
Add Word Screen  04 May 2019
WPF Projects & ViewModelBase  20 Apr 2019
Static Analysis  13 Apr 2019
Redux Store  06 Apr 2019
Commandline Builds  30 Mar 2019
Application Model  23 Mar 2019
Vocabulary Set  16 Mar 2019
Vocabulary Word  09 Mar 2019
WordTutor Revisted  02 Mar 2019
Converting a List to a Queue  23 Feb 2019
Explicit Interfaces and Delegate Properties  16 Feb 2019
Extension Methods  19 Jan 2019
Generating Hash Codes  12 Jan 2019
The Problem with Equality  05 Jan 2019
Queue Equality  29 Dec 2018
Smarter Queue Enumeration  22 Dec 2018
Queue Enumeration  15 Dec 2018
Queue Testing  08 Dec 2018
Creating Branching Nodes  01 Dec 2018
Two Dual Item Queues  24 Nov 2018
Simple Queues  17 Nov 2018
Enqueuing Values  10 Nov 2018
Dequeuing Values  03 Nov 2018
Designing the External API  27 Oct 2018
Introducing the Priority Queue  20 Oct 2018
A better approach to reflection  13 Oct 2018
Avoiding Magic Strings  06 Oct 2018
Capturing Validation Metadata  29 Sep 2018
Modelling Validation Metadata  22 Sep 2018
Validation Metadata  15 Sep 2018
Extending validation with warnings  08 Sep 2018
Validation recap  25 Aug 2018
Equality of validation  18 Aug 2018
Short-circuiting validation  11 Aug 2018
Aggregation of validation  04 Aug 2018
Recovery of validation types  28 Jul 2018
Basic validation  21 Jul 2018
Why we need better validation  07 Jul 2018
A question of struct performance  30 Jun 2018
Equality has Symmetry  17 Mar 2018
Type Miscellany  05 Mar 2017
Testing Immutable Types  25 Feb 2017
Factory Methods  18 Feb 2017
Queue Concatenation  11 Feb 2017
Complex Queues  04 Feb 2017
The Problem with the Simple Queue  28 Jan 2017
Enumeration of Queues  21 Jan 2017
Reversing Stacks  14 Jan 2017
Simple Queues  07 Jan 2017
Queues  30 Dec 2016
Stacks Miscellany  22 Dec 2016
Stack Equality  09 Dec 2016
Enumerating Stacks  03 Dec 2016
Stacks  19 Nov 2016
When (not) to use Var  16 Jul 2016
Semantic Types Redux  05 Jun 2016
Semantic Types in C#6  27 May 2016
Property Enhancements for C#  20 Dec 2015
Language Extensions for C#  19 May 2014
When should methods be Static?  09 Oct 2012
Of Method Naming and more  29 Sep 2012
Someone needs an intervention  16 Dec 2011
CallerInfo in C# 5  08 Dec 2011
Regions in C#  16 May 2011
Lambda expressions and Block syntax  15 Apr 2011
Parameter Attributes and more  05 Feb 2011
Elegant.Data  19 Oct 2010
Doing less with LINQ  30 Jun 2010
WCF and IList  28 May 2010
Specialist Classes  22 May 2010
Attack of the Lazy Coder  20 May 2010
A Discovery in Linq: Lookup  11 Feb 2010
Co- and Contra-Variance in .NET 3.5  15 Sep 2009
When to use Var  26 Mar 2009
Struct Weirdness  11 Feb 2009
Contravariance and Covariance at last  29 Oct 2008
Spec#  30 Apr 2008
Lambda Events  22 Mar 2008
No longer the C# we knew  21 Mar 2008
Rare C#  12 May 2007
Generics in .Net  28 Jan 2004