Trying to understand Unity's logic

OK
I found in this forum examples about using classes and manipulating them.
Here is an example I really do not understand from the programmer point of view. Probably this is due to my lack of gaming programming experience.
So could somebody help me by explaining what can be the use of the following manipulation of code?
I know about subclassing and extending but this example does not help me at all to know how to code clean instructions?

Consider Writing Mixins and Helpers Instead of Subclassing
It’s very easy to write classes that know about one another and cooperate, and this is probably a better and more
maintainable way of specializing objects in Unity than subclassing.
E.g.
/* Foo.js /
var bar : Bar;
function Start(){
bar = gameObject.GetComponent(Bar);
}
function doEet(){
// do my own thing
if( bar ){
Head First into Unity with JavaScript - Unify Community Wiki http://www.unifycommunity.com/wiki/index.php?title=Head_First_int
3 sur 10 23/07/2010 15:49
bar.doEet();
}
}
/
Bar.js */
function doEet(){
// do something special
}

First there is that ambiguity between ‘bar and Bar’
second I don’t see how doEet becomes a Bar class or function and why would I do that?
Thanks in advance for shedding bright lights on this..
Yves

var bar : Bar;

He simply declares a function called bar, which contains a component of type Bar.

var myTransform : Transform;

A variable called myTransform, containing a component of type Transform.

All those are inherited variables. For example, transform always refers to the Transform component of a gameObject. Instead of writing :

var transform : Transform = GetComponent(Transform)

the variable transform already exists, so no need to declare it.

It is not the case for custom components. var bar : Bar simply copy the shortcut writing style.

For the second question, I don’t manage to read the code.

Thank you
Got it now and it becomes clear that such an implementation is very specific and efficient in this context.
Regarding the part of code you could not read it is my fault as I did not see that when copying the code I grabbed someting else next to it
Sorry for that and thanks again
yves