Nonadiabatic processes widely exist in photochemistry and photophysics. The theoretical treatment of nonadiabatic processes is an important challenge in theoretical chemistry. In nonadiabatic dynamics, the well-known "Born-Oppenheimer approximation" breaks down due to the involvement of strong nuclear-electronic coupled motions. Hence, the development of a theoretical framework is required for the proper treatment of nonadiabatic dynamics. The fewest-switches trajectory surface-hopping method developed by Tully is one of the most widely used methods in the treatment of nonadiabatic processes because of its rather simple numerical implementation. In this approach, the nuclear degrees of freedom are propagated on the potential energy surface of an electronic state using the classical equations of motion, while the electronic degrees of freedom are propagated along the same trajectory according to the time-dependent Schr?dinger equation. Nonadiabatic effects are included by allowing sudden hops between different potential energy surfaces. After averaging over many trajectories, a reasonable description of nonadiabatic dynamics is achieved at low computational cost. Particularly, when we combine the trajectory surface-hopping dynamics with on-the-fly molecular dynamics, it is possible to describe the nonadiabatic dynamics of realistic polyatomic molecular systems at a fully atomic level with all degrees of freedom included. After the introduction of hybrid multiscale methods, the simulation of photochemistry in solutions and in biological systems becomes possible. The simulation results provide important information concerning the nonadiabatic dynamics of realistic polyatomic systems, such as excited-state lifetime, major active molecular motions, reaction channels, and branching ratio. This review article summarizes some progresses in this field. After briefly introducing the basic theory of widely used fewest switches surface-hopping dynamics methods, we mainly focus on several numerical details in the implementation of on-the-fly fewest switches surface-hopping dynamics. The seamless combination of surface-hopping dynamics and electronic-structure calculations is emphasized in this review, rather than an exhaustive discussion of rigorous nonadiabatic dynamics theories. Numerical methods to estimate nonadiabatic coupling terms are discussed, which allow us to perform the trajectory surface-hopping calculations when the nonadiabatic coupling vectors are not available in the electronic structure calculations. Several important issues, such as decoherence corrections, diabatic or adiabatic representations, and initial sampling methods are discussed in detail. We also summarize the theoretical treatment of the nonadiabatic dynamics of some interesting molecular systems, which include the photostability of DNA, photo-isomerization of organic systems, photochemistry of transition metal complexes, and photovoltaics. Finally, we discuss the theoretical challenges of this direct dynamics approach and provide an outlook of this field from our personal perspective.