Writing testable software

Motivation Why should we bother? There are several motivations for writing (unit) tested software. It gives you confidence that what you're deploying to production will do what it's supposed to do under all conditions. Especially true if you're delivering (potentially) lethal doses of radiation or something like thatIt gives you confidence to refactor (change the structure/design/implementation) of the software and not break thingsIt provides living documentation of how the software is intended to be used (we all know how much…

0 Comments

Syncing bulk data into SQL Server using DataTable, SQLBulkCopy & SQL MERGE

These days (for the most part) I'm an advocate of using a (micro) ORM for most CRUD operations - delving into SQL usually isn't justified. That said, with clients I've had over the years I've seen a recurrent need for a "bulk data sync" process - essentially take a feed of data from an external system and "merge" it into a table in our database. Any records that are matched should be updated, any records that don't exist should be…

0 Comments

Using .NET to interact with the Chrome V8 debugger (running in ClearScript)

An enterprise app I develop & maintain makes use of ClearScript as an extensibility point: end-users (semi-technical) write financial algorithms in JavaScript and those algorithms are evaluated by the system during batch processing (certain key C# types are exposed that the algorithms can make use of). ClearScript is set up to run the JavaScript against the Chrome "V8" JavaScript engine (the same as NodeJS and, well, Chrome). Some of these algorithms are quite complex and time consuming to write -…

0 Comments

WebAPI + AngularJS form validation – keeping it DRY

Introduction Even though AngularJS is approaching end-of-life, it's still deployed in loads of production systems. This post describes some techniques I used to have the validation logic entirely defined (and performed) server-side (ASP.NET WebAPI) - whist giving a client-side validation experience. By that I mean, type into a field and see validation errors as you type (rather than only when you submit the form). Why the heck would you want to even do that? Well - for one, there are…

0 Comments

EntityFramework – fun with DbCommandInterceptor

As a relative newcomer to EntityFramework (coming from a background of plain SQL) I often find myself frustrated by the "black box" experience it provides. Of course you're going to tell me to And I do. Sometimes I'll clone my own copy of the source & compile & link against that so that I can debug it in the context (no pun intended) of my application. Recently I discovered a useful extensibility point - DbInterception which (among many other uses) can…

0 Comments

Validating database results when refactoring legacy code

This post talks about some data-hashing techiques I employed w/ SQL Server to help validate database results in the absense of automated (unit) tests. Recently I was working on a legacy application in the financial services sector - the code in question performs a hypothetical ("what if") valuation of gas contracts over a period of time. Not really a mark-to-market but rather a set of calculated values (quantity allocated, liquidated charges etc), There was nothing particularly complicated about the calculation…

0 Comments

Autofac + NServiceBus + IStartable – making them play nicely

As part of a recent project I was installing NServiceBus as a replacement for Nimbus in an existing legacy system. The system makes use of Autofac for DI and adds various IStartable services to the container (background services etc). The goal - to continue using Autofac as the DI container for both the application and the NServiceBus message handlers, as well as allow the IEndpointInstance (bus) to be injected into / consumed by IStartable services in the container. Removing the…

0 Comments

Loading G-NAF (Geocoded National Address File) into SQL Server & making a simple query

I had a few hours spare and so thought I'd have a play with the "G-NAF" data set provided free of charge by the Australian government What is G-NAF? G-NAF (Geocoded National Address File) is a trusted index of Australian address information. It contains the state, suburb, street, number and coordinate reference (or “geocode”) for street addresses in Australia. It's worth noting that it doesn't contain personal or business related data - just data on physical addresses in Australia. It…

0 Comments

Ape E Eye: A user-configurable dashboard of REST API “searches”

Ape E Eye http://ape-e-eye.herokuapp.com/ This is a toy project I built to learn Angular JS. It's a configurable dashboard of "searches" (REST API queries) which are periodically updated. It's hosted on GitHub at http://github.com/flakey-bit/ape-e-eye This is what it looks like: The idea is the user sets up one or more searches (REST API calls) and the dashboard will periodically poll that search and display the results. The user must supply the API URL as well as a JavaScript function definition…

0 Comments

End of content

No more pages to load