Even the good answers here miss an important point, the flaps aren't simply "lowered" for either take off or landing, the flaps are "set" for take off or landing at specific settings. Take off settings almost always involve much less extension than for landing. Take off settings want to maximize lift in a situation where speed is increasing, where as landing settings want to create as much drag as possible before landing, without exceeding the flap extend speed for any particular flap setting. Flaps 1, or 5, or 15, or 40...whatever. Each setting has a maximum do not exceed speed otherwise you could damage the flaps or cause them to separate from the wing. Disaster. If it was structurally possible...if the flaps could take it without being torn off of the airplane, I'm sure an airline would want engines brought to idle and flaps at full extend at top of decent and left there throughout the entire landing procedure, for fuel savings. But it is not currently possible to do that, so flaps are lowered in increments depending on the maximum never exceed speed for each flap setting. The reason flaps are set at take off is because wings are designed to be maximized in cruise flight. High speed, straight and level flight, that's where wings like to be. Wings don't like to go slow, that's why they need flaps to help them slow down for landing. It is a design compromise. Flaps are set at take off to keep take off distance short and takeoff speeds low for safety and so airports don't have to build excessively long runways.
The next question is, why are flight deck windshields heated? No, the answer is not to keep them clear of fog. The answer is they are heated to make them more impact resistant to bird strikes.