When the Aduino starts up, all pins are inputs by default, if you want, say, pin 4 to be an input, you don't have to set it as input, just hook up and go. But if you want to use the the built in pullup resistor you have to pinMode(4, INPUT_PULLUP), before INPUT_PULLUP was invented you had to digitalWrite(4,HIGH). Now, if you want an output pin to be HIGH when your program starts, you have to first set the pin HIGH, THEN pinMode(pin,OUTPUT), other wise the pin will be LOW when the program starts, turning on a LOW true relay or something until the program gets around to turning it off by writing the pin HIGH.