I would like to create shortcodes, some tutorials write about to use add_action
add_action( 'init', 'register_shortcodes');
but I read tutorials where the author didn't use it, only put
add_shortcode('recent-posts', 'recent_posts_function');
to functions.php. Which is the best method, and why to use add_action?