Gray's Matter
Justice Gray - North America's favorite metrosexual software consultant
E-mail Justice
Subscribe to this feed
Subscribe to comments
Perennially Popular Posts
How to write a presentation abstract
My grandmother, globalization, and what's wrong with DateTime.Parse
A letter to my Worldvision sponsor child
Development Methodologies for the 21st Century
My grandmother & the difference between strong typing and weak typing
How I am becoming a better developer, part 1 of infinity
Facebook RSS Feeds: How to Write Your Own With C#
The Ten Keys To Happiness
My grandmother and the Global Assembly Cache (And Star Wars)
My grandmother and the difference between processes and threads
How to make a meeting request
Why you should never be an independent consultant
The DasBlog 1.9 AJAX Autosave True Story, Part 2
Other "metro" developers
Ben Scheirman
Bil Simser
D'Arcy Lussier
David Woods
Donald Belcham
Donald Jessop
George Clingerman
James Kovacs
Jason Hunt
Jason Row
Jean-Paul Boodhoo
Jeffrey Palermo
Joey deVilla
John Bristowe
Jonas Avellana
Kyle Baley
Mack Male
Martin Hinselwood
Michael McClenaghan
Mike Duncan
Mike Friesen
Mo Khan
Otyce
RoboSapient
Russell Ball
Scott Hanselman
Scott Reynolds
Steven Rockarts
Tech Embassy
Terry Thibodeau
Tom Opgenorth
Vladimir Levin
The Justice Gray Fan Club
Amazing Mrs. Loquacious
Dr. Teeth
Facedown
Janey Lynne
Maxime Lamy
Ridley Thunder
Stan Woo
Vanilla Con
Wobbly*Bits
I Wish These People Updated More Than Once a Year
Anand Narayan
Jeff Perrin
<< The rude awakening of Optimus Prime
Gmail's questionably targeted advertising >>
My grandmother and the Global Assembly Cache (and Star Wars)
[This posting series had been on hiatus for a long time, as I assumed knowing the
difference between processes and threads
as well as
distinguishing between HTTP GET and POST
would have been enough for my grandmother to squeak by a Corillian interview. However, it's been a little while and she hasn't gotten any callbacks from
Scott Hanselman
so I am going to continue with my series based on his
previous sets
of
interview questions
.]
So what is the GAC (Global Assembly Cache)?
Let's start with
Donald Belcham
-
EDMUG
president, unrepentant alcoholic, collector of restraining orders...and unabashed Star Wars fan.
Donald has a Star Wars party at his house once a month. You might be wondering why you've never been invited to one of these, and the answer is that
no one
is invited to these parties except Donald, who proceeds to dress up in costume and practice light-saber swinging ala George Michael Bluth from Arrested Development.
Donald Belcham's Star Wars Party: The early years
The key ingredient to a "successful" Donald Belcham Star Wars Party is the presence of the original Star Wars movie. Every time he holds his party, Donald goes out and rents a copy of Star Wars. For many Saturday nights, Donald has watched and cheered alone and drunk in his apartment as Han shoots Greedo in cold blood. This is what leads him to his frenzied
Star Wars Kid
style light-saber swinging! Two hours later, exhausted, he collapses in a drunken heap on the floor, with another Saturday night well spent.
However, Matthew, another erstwhile Star Wars fan, wants to start having a Star Wars party of his own - one with other people attending! However, seeing as Matthew is only 14 years old, he has only grown up knowing the heavily revised version of Star Wars released in 1997**. Matthew doesn't want to watch the original version, so he calls the video store
every day
asking when they will have the new version. Eventually the video store relents and the revised version is stocked in their store.
The video store's tracking system has a problem, however - adding the new Star Wars version into their system has caused a conflict with the old version - such that the old version has been lost for rental. Anyone thinking they are renting the old version (or in Donald's case, depending on it), is in for a nasty surprise.
Donald goes home for his monthly Star Wars party and eagerly anticipates the scene that will lead him into a lightsaber swinging frenzy. However, once seeing Greedo shooting first and Han lamely shooting back, Donald curls into the fetal position and loudly sobs for 2 hours in front of the TV until falling asleep - much like most of his other Saturday nights.
The next day, Donald races to the video store and then begins swearing angrily at the store staff, small children, and a puppy about how they have wrecked his life. The video store apologizes: there is not way to resolve the conflict such that both the old version and the new version are rentable at the same time. Either Donald's party fails or Matthew's does. Donald tells the video store that he will never buy anything from the store again as long as he lives and storms out.
One of the tellers realizes that Donald has spent thousands of dollars over the past 10 years renting the same copy of Star Wars and returning it six days late. Faced with the loss of their main revenue stream, the store works on fixing its tracking system such that *both* movies are rentable from the outlet.
Quite a while later, Donald passes by the video store to see a sign proclaiming that they now rent *both versions* of Star Wars. They now exist side-by-side in the tracking system! Realizing that he can finally stop having his "When Stella Got Her Groove Back" solo parties, Donald rushes into the store to rent his favorite film and reclaim his life. Now Donald's party resumes without chaos, and Matthew can have his as well!! Everyone is happy.
Princess Leia trying to roll back her system to an earlier version pre-GAC
What I've actually described here is life before and after the Global Assembly Cache (the GAC for short). Let's go back to life before the GAC first. Say that we have a program on our machine called "Donald Star Wars Party". This executable has the following supporting DLLs installed to the C:\StarWars directory, with the last three all being dependent on the first:
StarWars.dll (version 1.0)
[has a method called HanShootsFirst()]
HanAndGreedo.dll
LightSaberBattles.dll
DarthVaderIsAFatWhiteGuy.dll
Jabba.dll
Several weeks later, we install a different version of the program called "Matthew Star Wars Party" which puts the following DLLs into the same C:\StarWars directory (note which ones I have bolded):
StarWars.dll (version 2.0)
[has a method called HanIsAWussy()]
HanAndGreedo.dll
DarthVaderIsHaydenChristensen.dll
Jabba.dll
Once this program is installed, the "Donald Belcham Star Wars Party" program boots up but then crashes shortly after running. Why is this? The HanAndGreedo DLL has a method call to HanShootsFirst() that
no longer exists
in the new Star Wars DLL, as it has been removed and replaced with HanIsAWussy()*. Furthermore, we have a problem - even if we had a way to roll back the StarWars.dll file and getting the "Donald Star Wars Party" program working, this just means we end up breaking the "Matthew Star Wars Party" program instead.
Now, let's say that instead of installing their DLLs to the same StarWars directory on the hard drive, these programs instead placed their DLLs in the Global Assembly Cache. When the second StarWars DLL is installed to the GAC, the GAC looks at the major, minor, build, and revision numbers on the DLL. Since they are different from the StarWars.dll that is already in the GAC, this file is *also* seemingly placed in the GAC without overwriting the existing version! Actually, what really happens is that the DLL is placed in a hidden subfolder that is a hash of these numbers. For all intents and purposes it looks like you've just stuck multiple versions of the assembly in the same directory without overwriting. This enables both programs to run properly, each targeting their own specific version of the StarWars.dll.
Only a couple more of these and you'll get to meet Scott, Granny! I promise!
* You might be thinking that if these DLLs were properly designed, that the methods should likely be in the HanAndGreedo.dll and that the older method would be left in for backwards compatibility without making a change that breaks all older code. And if you are thinking that, you're miles ahead of a particular ASP.NET web control development company...;)
** While I'm not 14 years old, I've actually never seen the original Star Wars movies, only the 1997 versions. So I can empathize!
Wednesday, July 26, 2006
Comments [5]
HanselmanQuestions
|
Technical
|
Tracked by:
"Excellent description of how the GAC works" (Technical)
[Trackback]
"Excellent description of how the GAC works" (Baldy's view on the world)
[Trackback]
"Is Justice the next Rory of the .NET blogsphere?" (Jason Row)
[Trackback]
"Ruby 101: Classes and *more*!" (Gray's Matter)
[Trackback]
"Ruby 101: with special guest star WILLIAM SHATNER" (Gray's Matter)
[Trackback]
"My grandmother, globalization, and what's wrong with DateTime.Parse" (Gray's Ma...
[Trackback]
"Donald Belcham is now a MICROSOFT MVP~~~!!!!!!" (Gray's Matter)
[Trackback]
"My grandmother and the difference between strong-typing and weak-typing" (Gray'...
[Trackback]
http://www.scottcreynolds.com/PermaLink,guid,4084db7f-ecfd-40a3-b4a8-81fd06fac0b...
[Pingback]
http://9ujsa-le-informazioni.cn/02209242/index.html
[Pingback]
7/27/2006 11:29:57 PM (Mountain Daylight Time, UTC-06:00)
How is it possible for you to have only seen the revised versions?
Do you pronouce 'GAC' with a k? Or like the gutteral Klingon way.
May Da force b wit ya!
Anand Narayan
7/31/2006 11:16:29 PM (Mountain Daylight Time, UTC-06:00)
This is absolutely brilliant. I too, have never seen the first version of the Star Wars movie :(
May the force be with Great GAC master!
Steven McDonald
|
stevenmcdAT NOSPAMgmail dot com
8/1/2006 12:54:57 PM (Mountain Daylight Time, UTC-06:00)
There are *two* of us!!! That brightens my day immesaurably. I am NOT ALONE~! Thanks for the comments!
Justice
7/2/2007 4:24:21 AM (Mountain Daylight Time, UTC-06:00)
http://bestjedi.com
byoi
|
byo78AT NOSPAMyahoo dot com
11/30/2007 1:27:03 AM (Mountain Standard Time, UTC-07:00)
Nice photo...she's so sexy. I would love to see the first version of Star Wars movie too.
massage parlour
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
Justice Gray
: a seething cauldron of rampaging masculinity. A fighter! A brother! Your
secret lover
! He's also a software development consultant and the Vice President of the
Edmonton .NET user group
. He also greatly enjoys speaking about himself in the 3rd person.
Gray's Matter Archives
Recent Posts
Controversy clarifications!
The most controversial interview of ALL TIME
Finally! The *winner* of the "What Justice Gray Means to Me" contest
The mystery of D'Arcy Lussier's ASP.NET MVP is solved...
Well, now that's pretty horrifying
MVPs on MVC: "No, we don't have any idea either"
Why I am happy to not be at the MVP Summit
Donald Belcham's cry for help: MS MVPs, your attention is needed
ALT.NET Pursefighting revealed
Test, please ignore!
Change yourself, change the world: a great week 4
Post Categories
BookReviews
Conferences
DasBlog
EDMUG
Goals
HanselmanQuestions
HotDeveloperCorner
ILiveToInform
Leadership
Mac
OtherGrayAreas
Personal
Productivity
Ruby
Suresh
Technical
Transformers
Vancouver
Wii
<
July 2008
>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
Sign In