Tablets are the perfect form factor for coding because you can easily mount them in an ergonomic position like this: https://mgsloan.com/posts/comfortable-airplane-computing/
Most laptops have terrible keyboards so I'd be using an external one either way.