Sahil's Learnin' Akademi!!

Posted on 7/4/2006 @ 6:14 PM in #Vanilla .NET by | Feedback | 953 views

What is an Interface?

If a programmer ever considers writing an 'interface' for others to implement, one should to think about the most intuitive 'Interface' ever made... the female nipple. It doesn't matter what age you are... as a male, you always know what to do with a nipple. Similarly, when you see an interface, no matter what class are you - you know what to do with it.

So an IEnumerable, can be enumerated against, an IList can be databound, an ICollection is a plural collection of individual elements, etc.

Authentication vs. Authorization?

Picture it this way, when you go to a dirty bar - you show your drivers license, right? In that scenario, you would get "Authenticated" because you are over 21, but I on the other hand would get kicked out because I still look under 16 :-).

Now that you are authenticated, and some goon stamps the back of your hand with an ultraviolet friendly stamp, you are "in". The stamp is the "cookie", "ticket", "token", and given that the goons inside can validate your ticket using UV light, it gives them sufficient confidence that the ticket is "valid". Now with any subsequent request, your ticket will be checked.

Now comes "Authorization". If you try touching the dancers, you get snapped at by another goon - why why? Because, your "role" doesn't "authorize" you, even though you are "authenticated".

Here's another funky difference between "Authentication" and "Authorization". Given the example above, the stamp on the back of your hand (Authentication) allows you to attempt to go to any part of the bar. But every part of the bar, may have a different "Authorization". So you can go order a drink, but you can't go backstage (unless of course you impersonate LOL).

Which means Authentication is application wide, but Authorization can be for any resource inside the web app. This means, you can have as many "Authorization" sections in different web.configs all over your app, but only one "Authentication" section.

What is a Concurrency Violation?

Okay say you and I like the same girl.

You take her out for a date, you like her a lot, but she doesn't like you so much.
Then she goes out for a date with me, I propose and she accepts, we marry.

Meanwhile you have a massive crush on her, you buy an expensive ring, and propose - but the row (her finger) has already been updated with my ring.

That is a concurrency violation.

Sound off but keep it civil:

Older comments..

On 7/19/2006 10:01:02 AM clark said ..
Very funny :-). And a very good anology too.

On 7/19/2006 3:18:26 PM Sahil Malik said ..

Which one ;-)

On 12/14/2006 7:47:51 PM Joko Prasetio said ..
Can you post one simple example please? Because I have a problem with concurrency violation, and I am new in .NET. Thanks.