Skip to main content

Posts

Showing posts from January, 2016

Dealing with DataTables

The nice thing about having someone join in a junior position at work is that it gives you a lot to blog (or repeat yourself) about. We've discussed a lot of subjects this week. One; was them being burned by some terrible old code that involved DataTables. There were a series of enormous (and broken) methods that accessed DataRows directly using the integer column index. There was a large amount of calculations directly on these items but the reason behind any of it was meaningless. The underlying Stored Procedure had changed causing an invalid cast exception. In light of this, I thought it might be nice to go through a bit of a process of some different options of still using ado.net and why you might choose the options what the pitfalls were. Staying on topic, we didn't opt to use an SqlDataReader which would probably be the next option to go for considering how much faster that it. We talked about speed over maintainability, but I think even when we were programming on t

Making your domain less mutable

This happens regularly to me (and from my anecdotal investigation everyone involved in large / old projects). We need a new piece of functionality. I write it, it's beautiful and I win the internet. I have estimated 8 days (or 22.23 lol-points depending on how you live) and it's only taken 4 days. Ah, but then a very small; mostly ignored and very unimportant detail rears it's cruel head. You need to make it work with the code that exists already. This is normally in the form of saving to some pre-existing entities. Oh dear. You save everything through the various management / service classes that exist already and nothing works. So begins the next couple of days of horror. You find that you didn't set the work = true . Most of my woes in this area are caused by modifications at layer further down (or the stored procedure it finally ends up in) changing the object that I was trying to save or not saving part of the object because of some rule. So many errors