Steve Fenton

Programming

You can subscribe to the Programming category micro-feed.

Duplication vs Coupling

There is a generally understood principle of programming that says if you remove duplication, you introduce coupling. For example, you have two classes that have similar code, so you create a function that they both call. Now the two classes are coupled to the function. You make one thing better, but something else gets worse. […]

Strings contain empty strings

This is just one of those philosophical moments in programming where one small details can have a big impact. In C# / .NET you will find that when you ask if a string contains an empty string (string.Empty), the answer is yes. This may seem logically surprising so it is worth bearing in mind should […]

This is a little funky script to intercept AJAX requests and raise a simple custom event for everything else in your app to listen to. To use this, you just need to listen for a custom event named `AjaxDetected`. The method, url, and any data is passed in the event detail. document.body.addEventListener(‘AjaxDetected’, function (e) { […]