Thursday, October 07, 2004

What I learnt this week...

I spend quite a lot of my time learning how to do stuff. This is why many of the little ptojects I start working on amount to nothing. In that way, I guess I'm kinda like a mathematician, the guys who go "Well, we'll solve the problem to this point, but then, of course we already know how to do it from here, so there's no point doing it again."

Sometimes it's kinda cool that way. I do at least keep myself interested and avoid doing a whole load of drudgery (and by drudgery, I mean 'stuff I already know how to do')..

Anyway. I learn how to do stuff. And this is what I've learnt how to do this week:
Using SQL Server SCHEMA_INFORMATION

The SCHEMA_INFORMATION views give you a way of writing stored procedures that can pull out some of the metadata about your database. You can pull out data about tables, columns, contraints and all sorts of other stuff about how your database is structured.

I thought it was kind of useful. Particularly for the code generation widget I'm writing at the moment.

Quick note to self:
Regarding the code that's actually generated, I'm making it generate abstract classes, rather than getting it to generate normal classes for 2 reasons:

  1. I can extend them nicely once they're done
  2. I can make a DB design change and regenerate the code. It'll sling out a whole load of compiler errors, depending on what's actually been changed, but (and here's the inportant part) it won't overwrite what I've already done to it
  3. It'll force me to think more about inheritance when I'm actually using the code generated from it. So far I've coding without really using inheritance that much. Bad me! I need to make myself get my head well and truly round it


That is all. Just wanted to share.

No comments: