Okay, tonight it happened, my other personality jumped on the chance to get me when I was down about the tree view incident, and it took over in the middle of class. Symptoms ranged from fast speaking, cracking jokes* and basically covering a 12 hours material overview in about 20 minutes. Usually it takes three drinks in very small glasses to get him out. I wouldn't mind that much except that such incidents burned so much energy while leaving me so jumpy. I can't speak right now, because I am just pushing out words faster than I can think about. Oh, and all connection to reality is highly suspect.
I have been telling the class a lot of stuff about an imaginary DBA who huff & puff at my lack of reverence for the holy RDBMS for quite some time. During that time in class, I have fleshed my mythical DBA out fairly well. It went like this, and this may not go very well in writing:
So, we have this background worker class, and it makes working with threads easier. But you don't know what a thread is. Well, a thread is a piece of work that can be executed, and we need to be careful about it because if we try to do UI from a background thread we will get weird results (pick up a student, tell him to paint something on the board, paint all over it while he is painting, push him back, point to the mess on the board, claim that it is an abstract masterpiece and demand royalties) so the .Net framework will throw an exception if we do that.
So now we need to sync between threads, which is not trivial. And by non trivial we are talking about 2 AM at the office, cursing someone in tongues. The background worker class is supposed to help us with that, you give it a piece of work and this piece of work can notify the worker about when it complete a stage, and when everything is over it will notify the UI thread, making our life simpler.
So, why would I need this? I have a database, but I don't have any permissions to that, since the DBA got pissed after the last time I touched the database. Prickly person, it was only 19 joins and a cursor or two, per page view. Anyway, after that argument I threw the DBA out the window (it was a small window, but quite high), so after which I have to use a three DB links proxy to get to the database, but it wasn't found yet, so I am fine.
Anyway, this means that a query now takes around an hour to complete, okay, three minutes, but the annoying users tends to complain when they get a white screen and "non responsive" title bars, and we really can't murder them (I checked) in their sleep, so we really have to do something about it. And that is why we can use the background worker, so we wouldn't have to kill the users. Which remind me of the disuablity study that I have been meaning to investigate. Which is a better way to amuse ourselves when we are faced with boring task. Level one is when you randomly move the cursor by 30 pixels whenever the user is pressing a menu item.
So, back to the background worker, we can give it a work like calling to the database through the amazing database proxy** which will take a while, and at the same time, keep the UI responsive, our user sane and ourselves out of jail.
Winners all around.
Dedicated to my multi threaded, mythical, DBA.
* Politics and threading! For crying out load!
** Sigh, that is a real project.