My honest advice after watching many people do this both ways: book short-term before you arrive, but sign nothing long-term until you are physically in the country. Arriving with no roof at all is stressful and can even complicate immigration, since many countries ask for an address on entry. So having two to four weeks of temporary accommodation confirmed is essential.
The danger is committing to a year-long lease from abroad. Photos lie, neighborhoods feel completely different in person, and rental scams specifically target people overseas who cannot view the property. Paying a large deposit to someone you have never met for a flat you have never seen is how people lose serious money.
The exception is when an employer or university arranges housing through their own verified channels; that is generally safe. Otherwise, land first, spend your temporary weeks viewing flats, checking commutes at rush hour, and reading the lease carefully, then commit. The extra cost of temporary housing is cheap insurance against a year in the wrong place.