D8 code

Paged db_select()

	$header = array(
        array('data' => t('ID'), 'field' => 'nid'),
        array('data' => t('type'), 'field' => 'type'),
        array('data' => t('title'), 'field' => 'title', 'sort' => 'desc')
      );

      $query = \Drupal::database()->select('node_field_data','loc');
      $query->fields('loc', array('nid', 'type', 'title'));
     // $query->addField('loc','name','name_alias');
      $table_sort = $query->extend('Drupal\Core\Database\Query\TableSortExtender')->orderByHeader($header);

link

 $options = ['absolute' => TRUE];
 $url = Url::fromRoute('entity.node.canonical', ['node' => 1], $options);
//$url = $url->toString();
$link = Link::fromTextAndUrl("Node 1", $url);
 $link = $link->toRenderable();
 $link['#attributes'] = array('class' => array('internal'));
$outlink = render($link);

Custom form in Drupal 8

resume/resume.info.yml
name: Resume
description: A Resume form to enter user details.
core: 8.x
package: Custom
type: module
resume/resume.routing.yml
resume.form:
path: '/resume/myform'
    defaults:
        _title: 'Application form'
        _form: '\Drupal\resume\Form\ResumeForm'
    requirements:
        _permission: 'access content'
resume/src/Form/ResumeForm.php