M  

 

The Private Site of Fariborz Moradi


 
 

tieUpDamsel (name)
     add one to the number of damsels this villain has tied up.
     print "Oh my Gosh! (the specified damsel) has been tied up!

I have nothing to say to you people. If you feel bad about understanding everything so far, then you can read the red section for this one.

public void tieUpDamsel (Humans damsel)
{
     this.damsel = damsel;
     numberOfDamsels++;
     System.out.println("The Villain has tied up " + damsel.whatIsYourName());
}

"Geez! I should have stayed with the green type," you're probably saying to yourself. Don't worry. It looks much worse than it is, and you probably understand most of it already. First, we have the name of the method: "tieUpDamsel". No surprise there. Then, between those parentheses, we have "Humans damsel". What comes between those parentheses is called an argument. It helps make the method more specific. When Laura starts writing her plot, she will at some point want her villain to tie up a damsel (what sort of Western would it be without it?). But if she just writes in her plot, "villain.tieUpDamsel()", that wouldn't be very exciting for the reader. Who has been tied up? What is her name? Priding herself on always having strong female characters, Laura wants to add the name of the damsel who is being tied up. Hence, when her plot says "tieUpDamsel", it will also say the name of the damsel being tied up as an argument. "Humans", which comes before "damsel", tells her editor that the thing being tied up is a human. Her editor doesn't like surprises, so that knowing that it is a human being tied up, rather than say, a sheep, reduces the amount of guesswork on his end.

The next line is another attempt by Laura to please her rather persnickety editor, who is even more picky than she is! Even though she has supplied the name of the damsel as an argument, her editor won't let her use it in the method until she has stated that the "damsel" that she declared as a "Villains" variable is equal to the value given in the method's argument.

Having finally jumped through all of her editor's hoops (don't expect to understand all of that right away, it took Laura a couple of weeks!), Laura gets down to finishing the rest of her method. Once the villain has tied up a damsel, the variable "tiedUpDamsels" will surely go up by one, so Laura puts the same "++" after tiedUpDamsels that she had put after "drunkenness" in the drinkWhiskey" example.

 


 



 

 
 
 
©2006 Fariborz Moradi       Contact