Wednesday, February 11, 2009

Streams demystified

I must admit that even though I've been using .Net and C# for about 8 years now "Streams" have never really "jelled". There's all these Streams, StreamWriters, StreamReaders, TextStreams, MemoryStreams, FileStreams. 

I must be honest - it's been pure laziness that has prevented this. This is a bit of a pattern with me. Just getting stuff to work. Hacking it together. Anyway, as I was copying another slab of code today, I had had enough.  I needed to "get" this. So I pressed F1 - called up the MSDN help and read... I stumbled across a page titled "Stream Concepts" - or something like that.

The introduction on "Stream Concepts" explained how all Streams have a Base Store. FileStream - a stream of "stuff" from a file. MemoryStream and stream of stuff from or to "memory". Then it explained how StreamWriters and StreamReaders append themselves to those Stream objects, via the constructor - because when you instatiate a StreamReader, you specify the stream in the Constructor...suddenly, some penny somewhere dropped. Things started to make sense and knew they did, because I was able to whip up some code that was nice and clean, succinct and worked, without converting stuff through about 8 different objects, reader here, writers there and so on, without copying it from somewhere else...and it worked.

Now to the seasoned .Net developer - which I should be, this is trivial and probably makes me look stupid...if so, so be it, i probably am...but I'm a little less stupid that yesterday.

From now on, I am going to force myself to search for this "deeper" knowledge everytime i strike something I don't "get", that I should get...it maybe 20 years to late, but I'll be a decent developer yet...!!

==========

Then, on the way home listening to to Podcast #40 from StackOverflow, the guys (Joel, Jeff and some other dude) were talking about continuous learning, reading and so on - they talked about "deep" learning. That was it. I need far more deep learning. Maybe not as deep as they were talking about, but deeper that cobbling together code that works without really "getting" it... I have to do this...

Tomorrow I'm starting a 4 week, basic (really really really basic) photography course - for people with point and shoot cameras. It maybe simple, and an absolute starting point, but the same principle applies.  I want to learn this stuff properly and if it leads me to spending heaps of money on new cameras, because, as usual, all I learn is how much I need to spend to do things properly, well so be it.