It’s excellent experience being able to do things like this. My SMS spotter does lots of low level socket activity to /GET and /POST on SOTAwatch ( and the WOTA and HEMS sites). Assorted logging in and playing with cookies and slicing data here and there. I did it that way as I was learning Python at the same time. A year or so later I learned of all the ready to run HTTP and URL handling libraries Python already has built in and saw how trivial it was to do things that took me a lot of head scratching and trial and error to make work. I could have cried. But it was all useful stuff to learn. When I update the spotters for the new SOTAwatch, then all the hand-rolled code will be ripped out and library routines used. That’s simply because there’s lots and lots of use of that code and it’ll be a damn sight more reliable than my code when the corner cases come in!
Last night I was working on how to push CSV data and found there are many open source CSV handling class libraries for C# but the database has all sorts of hand-rolled code to do that. I thought I should actually start using a tried and tested class library and remove all the code that works (sort of) we have. Well that’s for the future.
In 2010 I did lots of date handling code for the database. I wrote it all myself. On 29th July 2011 someone asked the database what was happening 6months back. My date code said “ah, 29th February 2011 please” and the database engine said “you what, have an invalid datetime exception”. I changed the code to use the C# function to take 6months of 29-july-2011 and it said “you want 28-feb-2011”, it knows about leap years which I had blissfully ignored. I always use the C# and Python date libraries now.
So you get a for writing your own and making it work. Now you have the satisfaction of knowing you can do it if you have to, throw it all away and use an open-source library. It’s what I do now.