In Shmuel Alef (20, 20-22) Yonatan arranges a whole scheme to secretly inform David whether or not it's safe for him to return. However, after the sign is given that it's not safe (20, 40), Yonatan sends away his boy and David comes out of hiding and the two embrace. Why did Yonatan have to arrange the whole secret sign? He could have gone to the field, shot some arrows, sent his boy away, and told David what the situation was. There was no need for the secret code.
Rabbi Amnon Bazak explains in his lecture that this seemingly useless act of telling David in a secret way to run away and then meeting David in person shows the special and unique relationship between David and Yonatan. After Yonatan uses the arrows to send his message he is overcome with love for David and therefore risks his life to see David and embrace him one last time. Yonatan's plan was not to see David, only to send him this secret message however Yonatan could not contain himself and had to see his best friend one last time.
Radak (to vv. 20 and 36) and Ralbag (to v. 37) seem to take a bit of a different tack than the answer given by morah hochman. They say that indeed Yonasan at first figured that he won't be able to speak with David in person because there might be people around, and therefore he'd have to use the signals. Once he saw (after he was done with those) that indeed no one else had come besides him and his servant, then he changed plans and sent his servant home, at which point David realized that the coast was clear and came out to see Yonasan.