Event Handler Style Showdown

There has been some talk on Twitter recently about the best way to write an event handler. This is all in good fun of course as there is no right way to do any kind of code. Flashers come from all walks of life. Some are from the design world and some from serious development backgrounds. Below are some of the suggested ways. What do you think?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private function kermanStyle(evt:Event):void {
    // this is nice but I don’t like evt for some
    // reason. Also it is much more readable and
    // clean to put the opening { on a new line.
}
       
private function sacksStyle(event:Event):void
{
    // Steven rightly puts the opening { on a new
    // line but uses the word event for his event
    // object. You should never use a lowercase
    // version of an existing class for an instance.
}
       
private function brimelowStyle(e:Event):void
{
    // Yeah baby that’s what I’m talking about!
    // Using e is short, succinct, and most of all
    // it is the sign of high intelligence.
}

Lee

Show Comments

Hide Comments

Comments are closed.