If you want to set front page programmatically in WordPress then add that following code in your functions.php file. First you have to make sure that front page is exists or not. if its no exists then create it. After that add that following code in your functions.php file
$home = get_page_by_title( 'Home' ); update_option( 'page_on_front', $home->ID ); update_option( 'show_on_front', 'page' );
Have any doubt, then comment here!