Some composers are very precise about writing the dynamics they want. Others leave a lot to the performer to decide. Historically, composers several centuries ago, such as Bach, only wrote occasional dynamic marks. Even Mozart only wrote a few, mostly p and f. By the 19th century composers were writing dynamics in much more detail in their music.