MaxStocker.com   MaxStocker.com    
   
Home About Blog Stuff Contact
 
   
 

July 2010

3 random things
Posted : Tue July 6th

Whose blog is it anyway?
Posted : Wed May 5th

Random thoughts from the week
Posted : Sat April 10th

SEO and the magic beans
Posted : Mon April 5th

I really think
Posted : Sat March 27th

Blackberry development
Posted : Sat March 6th

Right way, wrong way
Posted : Thu February 11th

An update for December
Posted : Thu December 31st

MySQL, JDBC, Unicode and You
Posted : Sun November 29th

Whatever doesn't kill me will make me stronger
Posted : Thu November 5th

Somewhat random thoughts
Posted : Sat October 17th

Strange SSL woes
Posted : Wed October 14th

Because everybody has a Mom
Posted : Sat October 3rd

Sometimes I wonder
Posted : Tue September 29th

Recent Comments

Max in Whose blog is it anyway?
on Mon May 10th

Rob in Whose blog is it anyway?
on Fri May 7th

Anonymous in SEO and the magic beans
on Thu April 8th

Max in SEO and the magic beans
on Thu April 8th

n.o. in SEO and the magic beans
on Thu April 8th

silky in Right way, wrong way
on Fri February 19th

Categories

Technical
69 Entries

Security
18 Entries

Java
23 Entries

Privacy
6 Entries

Database
11 Entries

Internet
58 Entries

Business
31 Entries

Site Updates
19 Entries

Personal
86 Entries

RSS Feed RSS Feed

Tag Cloud

3 random things
Posted : Tuesday July 6th, 2010

As the title implies there is no "theme" to this post it's just a collection of a few thoughts I've had or encountered recently.

First to get a bit of housekeeping out of the way I have a new Twitter account. http://twitter.com/MaxStocker. I am still currently responsible for the previous (TalentOyster) one but I will be transitioning away from one to the other over the next short while. (Note: I do know I need to update this in a number of places and I will do so over the next number of days. If after say the 9th of July you see an old account linked somewhere please send me an email and let me know).

On to the tech stuff. Url-rewriting in Apache. I generally think it's a good thing but boy, sometimes I think it can be abused. I've seen some really ugly stuff in the wild, and lord knows even for myself while regex is not my special calling in life I can write complex enough ones to make it tricky to follow.

But the one thought I had with this recently is that it *is* interesting to use it for validation purposes. And by validation I mean type-checking values passed for processing. The question is, is this a good idea. My feeling is that it seems like a nice plus, but also has the danger that it could lure the unsuspecting into thinking it's "enough" which it isn't.

Finally foreign keys, are they really needed? This is one of those ideas that I thought would make a good post on its own. And it probably would, but I lack the time at the moment to expand on it so a short entry will have to suffice.

I am not sure how "necessary" foreign keys really are any more. Now do note I am talking primary keys here so let's not go crazy. And I'm not talking about fields that *act* as foreign keys either but actual database "constraint" foreign keys that will only let you use value in X where it's the primary key of Y.

In theory it's a nice idea because you move data relationship into the database and out of the application. But do you really? No. Because in your application you end up having the same steps to deal with missing relationships, or changes to them, that you would have in the database regardless. The other side to this is that there is a "cost" in having foreign keys, I'm not going to talk about performance here because hopefully the database has that one sorted out but a cost in making the persistence system more restrictive then it perhaps needs to be.

I don't doubt that much of feelings on this has got to do with my experience, both with using databases that didn't have or support foreign keys or in having terrible problems migrating databases that did have them. And I also wouldn't recommend these ideas to someone who is new to databases or database development but... if you know what you are doing then I wonder.

This all may be a really stupid idea, I'm still thinking about it but ask yourself these questions. When is the last time that the constraints of your foreign keys weren't duplicated in your codebase? And do you really use cascading updates or deletes on foreign key changes? If the answer to those are no and not really then I don't really think you need foreign keys either.

Tags

foreign  keys  Twitter  url-rewriting 

Categories

Database  Internet  Personal 

 
   
  Follow me on Twitter   My Facebook Profile   My LinkedIn Profile   RSS feed of my blog Home   |   About   |   Blog   |   Stuff   |   Contact   |   Privacy Policy  
   
  © 2008 Max Stocker