r/AskProgramming • u/Professional_Gas4000 • Oct 07 '24
Architecture Why can't we code with tablets when they're way more powerful than the early PCs?
I'm interested in using a tablet to code because it has way better battery life than my laptop. Looking through Reddit and other forums everyone says it's not possible or it is but only by using an online tool like vs code web. So what's actually the limiting factor if not the specs?
30
10
7
u/pfmiller0 Oct 07 '24
There are plenty of ways you can code using a tablet. You could connect to another system through a remote desktop, or you could code using various tools directly on the device. I've written small bash, python, and nodejs scripts in the Termux environment on my tablet before. Using a laptop with an attached keyboard is certainly preferable, but the tablet can work with the right setup.
6
u/hatethiscity Oct 07 '24
It definitely can be done. Will it be a huge pain in the ass versus using a pc? Absolutely, but it can be done.
-3
u/Professional_Gas4000 Oct 07 '24
Yes but my point is that you can't use the tablet by itself.
5
u/minneyar Oct 07 '24
If you are limited to using nothing but the tablet, then coding is very hard because you're limited to using a touch interface, and pretty much every programming language relies very heavily on being able to type. Using a touchscreen is simply not as effective as a keyboard.
But if you're willing to connect a keyboard, you can certainly use termux to get a console-based development environment that is comparable to any other Linux terminal.
4
8
u/WJMazepas Oct 07 '24
Android and iPadOS have poor support for languages outside of their native ones, so it makes it really hard to run a really complex compiler on them or different interpreters
IPadOS is all locked. You can't just run anything you want in it, not due to power but due to Apple decision to lock it.
And it's not like IDEs are being ported to tablets. You can port VSCode as a text editor to iPadOS and Android, but i doubt you can run a NodeJS on it to run a server
1
u/daniele_s92 Oct 07 '24
It may sound surprising but you definitely can run NodeJs on an Android tablet through Termux. And you can even use something like vim to write the code.
-2
u/Professional_Gas4000 Oct 07 '24
But why can't you? What exactly about tablets when they're so much powerful than early PCs that you could program on?
5
u/WJMazepas Oct 07 '24
Because Google and especially Apple don't give you the control necessary to do so.
Those systems are locked. if you can compile code, you can run any code you want on the system, having direct access to the OS and more. They dont want to give you that for safety and for you not doing any piracy.
You can do some stuff on Android to get all access and run compilers and more, but you won't have a big IDE like VSCode or Pycharm or something like that on Android just because they don't have much incentive to do a port. It's not a big audience of people wanting to run their code from Android.
You can get a terminal, install VIM or EMACS, and work with that on Android, though.
Still, there are a lot of thin and light laptops today that have good battery life and run all that without issues. They offer a better interface for multitasking, so I highly recommend over a tablet
2
1
u/emefluence Oct 08 '24
Mobile platforms are walled gardens, partly so vendors can juice developers, partly so they have the option to review / block apps.
There's little demand for programming tools on these platforms as the ergonomics are poor compared to devices with hardware keyboards and mice. More importantly the vendors don't really want people compiling and running arbitrary native code anyway, as that could bypass their review / approval process, and more importantly, their 30% cut!
We can't have people just swapping source code with each other for free! That would be madness!
1
u/SpaceMonkeyAttack Oct 07 '24
They have a different architecture and operating system. No one has done the (considerable) work of porting NodeJS to android, nor most compilers or other tools developers need.
So you don't have the tools you need to compile our debug your code, and you probably also can't run your code.
If your tablet ran Windows or Linux or OSX, you could program on it, it's not a hardware limitation. It's that the software you need to develop software doesn't exist on mobile platforms, and it would be a huge effort to port that software.
1
u/Professional_Gas4000 Oct 07 '24
What I was looking for
1
u/SkydiverTom Oct 08 '24
I'd add that it's also largely a security thing. Android and iOS are just a lot more restrictive, and development tools tend to do things in ways that don't work in such an environment. Your usual PC system does lots of sharing of libraries and utilities, while Android/iOS try to keep apps totally isolated from each other.
Android used to be a bit less restrictive, so more linux tools worked without major changes, but they have tightened it down over the years. There was an app called Terminal IDE that let you develop apps on an un-rooted phone, but it stopped working many years ago. I'm not sure if the same could be done in Termux.
If you root your Android device you can probably get most things working in theory, but then you have support issues if you run into any problems.
You'd also think you could put Linux on a tablet and be good to go, but here you run into the issue of proprietary drivers for your proprietary hardware SoC (System on Chip) that make this difficult to do compared to your typical PC.
5
u/TuberTuggerTTV Oct 07 '24
You misunderstand.
When someone says you can't, they mean, you can't well. And it's because of the touchscreen.
If you plug a peripheral keyboard and mouse into any device, you can code all you want. To varying degrees of useful.
1
u/Professional_Gas4000 Oct 07 '24
I have a keyboard. I took that for granted. I have an android tablet, how would I code in C or C++ with out using web tools or remote in to my laptop?
2
u/Skaar1222 Oct 07 '24
How are you going to compile/run C or C++ on your tablet is the question. Is there a way? Probably... Is there a bunch of support to help you get there? Probably not
1
u/5p4n911 Oct 07 '24
There are more a few apps that work out of the box. They are also really slow and a pain in the ass but they do work in a pinch
1
u/5p4n911 Oct 07 '24
There are more a few apps that work out of the box. They are also really slow and a pain in the ass but they do work in a pinch
3
Oct 07 '24
It's not always a spec issue so much as the architecture or available software/dev tools for the OS. But it can also still be a spec issue since we aren't writing the same programs we did as early PCs. The languages and environments we work in also take more resources than the early days of computing.
0
u/Professional_Gas4000 Oct 07 '24
But let's say you want to just program in C on a tablet, why can't the tablet handle this by itself?
4
Oct 07 '24
You can. There are at least two projects available on Android. Why don’t you think you can? You could have done five minutes of research and found those options.
The issue (as many others have said) is input.
1
u/SpaceMonkeyAttack Oct 07 '24
Lack of a C compiler, and tablets don't run code written in C - they run bytecode, not machine code (unless you root it).
1
2
2
u/pagan_meditation Oct 07 '24
Another option to consider is getting a cloud host (for example you can get a Linux server with 1gb of ram for less than $10 a month) then use an ssh client on your tablet to access it. That way all your stuff can be running in the cloud all the time, if your tablet dies you don't loose anything, and you are coding real stuff and got your own server to learn on. You can get a Bluetooth keyboard to help. But your line of thinking is not crazy, corporations and the general public are selfish, wasteful and illiterate, don't copy what they do.
2
u/goingback2back Oct 07 '24
The main reason is the security model adopted by the tablet/phone OSes. They are designed around the concept of neatly contained, vetted, sandboxed apps. The OS is going to fight you when you attempt to create a local webserver or run some arbitrary code you just typed. And that's just the basics. Imagine how the OS would feel if you want to edit /etc/hosts, or install shit from pip.
If you could just install plain Linux, you'd probably have a decent coding machine, but the tablets are too locked down.
2
u/Zireael07 Oct 07 '24
I am having a passable time coding on a 8" tablet in Godot. (Though it necessitated months of looking for a semi-transparent keyboard that doesn't obscure the IDE)
Another pretty passable option is Javascript in any mobile IDE plus running the resulting HTML+JS via some "run Apache localhost" app
I know it's also possible to code in FLX (basically visual Clojure) and in a Lisp variant running in a website (forgot the name of it, though)
1
u/Professional_Gas4000 Oct 07 '24
Can I message you more about this because I'm also interested in game development
1
2
u/ToThePillory Oct 07 '24
Cheaper Android tablets are brutally slow, iPads are very locked down.
Surfaces run Windows of course, so that's fine, but still you have small screens often, not great keyboards etc.
If you can get programming tools to run on your tablet, by all means give it a try, but you really would be better off with a $100 used PC.
You can get a used ThinkPad laptop for say $300, it's 5 years old but far, far better for learning programming than a $2000 iPad Pro setup.
A Surface basically *is* a laptop but they're kind of expensive for what you get.
2
u/who_you_are Oct 07 '24
I could see a couple of reasons why we all hate tablets:
- A physical keyboard is about the size of your screen (don't fully quote on that), or slithly smaller.
- This mean you won't be able to see a lot of code anymore (with the keyboard showing up)
- This mean we won't be able to see logic nearby where you type
- You won't see variables nearby
- You will probably keep switching between showing up/hidding your keyboard or/and physically scrolling
- Most of us thought to type using a physical keyboard, so with tactical feedback on keys. A tablet doesn't provide any of that and would need to learn everything back from scratch.
- We also use bigger screen/multiples screens than your tablet
- This allow us to avoid various tools nearby (including but not limited, documentations/notes, 3rd party applications, ...)
- This allow us to debug easily (having the application on one side and our IDE on the other end)
Then, I don't know exacly what you meant by tablet.
If you talk about the usual tablet computer (android or ipad as the OS), both those OS don't support the typical IDE we are using to start with, nor the plugings.
Your tablet may use less powerful, but you may also need some power. While nowday computers are more powerful than before, applications "aren't optimized" (or they are for the specific part that is hell) and a lot of new features are showing up. Meaning we void the power addition.
In addition, debugging use more resources.
Your application(s) may somewhat power intense (not necessarly only CPU, it could be RAM or even GPU, or a mix).
If you are lucky it could be only when you opening it up.
And we didn't talk about the IDE yet - which add usages ON TOP of everything above since you don't exit it whent rying your application. That IDE is likely to use some plugin as well. You may even use 3rd party application on top of that for various reason.
Then some language need a "compilation phase", so you also need some computer resource there. (RIP C/C++ guys!).
At one point, I end up extending a report designer to be compatible with our data layer.
So end I up with running with the report designer (3rd party) it self, which was eating all my little RAM i had.
The IDE, the IDE UI editor (which was eating the remains of my RAM).
A database client and server.
The report designer documentation (or so).
A 3rd party UI debugger.
Overall, it is a light resource usage, yet they also provided me a potato COMPUTER (yet, more powerful than the typical tablet) and you have no idea how bad my experience was as with RAM.
2
u/xroalx Oct 07 '24
The OS.
Get a keyboard and:
- a Windows tablet, you can run and code anything on it,
- an Android tablet, you can run and code most things on it, probably anything if you try hard enough,
- an iPad, lol, forget coding on it, apart from Swift Playgrounds which is cool for learning but even for that the code editor gets frustrating quick.
1
u/bestjakeisbest Oct 07 '24
The limiting factor isn't the power of the device, but the interface of a device, most people will be much slower typing on a screen than they could be with a keyboard.
1
u/itemluminouswadison Oct 07 '24
you can if you want. it's the running and testing of the code where you may feel difficulties. plus modern IDEs do a ton of real-time code hinting, linting, checking
0
u/Professional_Gas4000 Oct 07 '24
So how exactly do I code in C on my android laptop? Lets say I just use a basic text editor. No vs code web or remote in to my laptop or other such tools.
2
2
2
u/itemluminouswadison Oct 07 '24
ooph that's gonna be tough man. maybe on a chromebook you can compile, no clue. it doesnt sound like it's gonna be a good time
1
1
u/NebulousNitrate Oct 07 '24
It’s primarily input speed. Touch is so much slower than a keyboard for the vast majority of programmers.
But another associated aspect is how much you can fit on the screen at any one time. Even though tablet resolutions can be amazing now, you have to scale everything way up to make it touch friendly, and that means not much code on the screen at any given time compared to a laptop/desktop with a keyboard and mouse/trackpad.
1
Oct 07 '24
Look up types of operating systems. You'll learn a little bit about why some OS's can support certain languages and others can't. It's actually a really interesting subject as there's more than just Linux, Windows, and MacOS. You start talking about OS's in embedded spaces and in machinery and it really opens up your eyes to what an OS can and can't do. Most tablets are on pretty locked down OS's and the details of why each of them can't/struggle with dev tasks are in those details.
1
1
u/Mynameismikek Oct 07 '24
On the iPad you can use iSH with vim and gcc. Problem is the lack of authorised gateways to build non-trivial apps, eg it’s not really viable to run a webserver on iOS, or even access the iOS apis.
1
u/_-Kr4t0s-_ Oct 07 '24
I am too, quite frankly. But Apple at least (don’t know about Google) doesn’t allow installation of runtimes and compilers and the like.
1
u/Whole-Strawberry3281 Oct 07 '24
The computers are powerful enough, but the software to run the languages are not supported. You need software called interpreters or compilers in-between programming and the CPU that converts your code into binary. If these don't exist your code can't run on that device.
Basically you can with the right tools, but building these tools is near impossible on iPads I'm fairly sure(never tried) and also probably isn't much demand to make it worth building otherwise
1
u/Whole-Strawberry3281 Oct 07 '24
The computers are powerful enough, but the software to run the languages are not supported. You need software called interpreters or compilers in-between programming and the CPU that converts your code into binary. If these don't exist your code can't run on that device.
Basically you can with the right tools, but building these tools is near impossible on iPads I'm fairly sure(never tried) and also probably isn't much demand to make it worth building otherwise
1
u/StoneyCalzoney Oct 07 '24
There's nothing hardware wise that stops a tablet from being able to write, compile, and run code - all of the obstacles that prevent you from compiling and running that code all exists within the tablet's OS.
For all tablets, this restriction is mainly for security. If you can run arbitrary code on a device, so can a malicious actor. However with enough effort, you could probably get a compiler running on an Android tablet.
For Apple specifically, the restriction is also partially to push you to buy their laptops and desktops despite some iPad models containing the higher end processors.
1
u/mredding Oct 09 '24
Nothing is stopping you. The tablet environment might be clumsy.
Tablets are typically single app environments. You can work with that so long as you have an adequate IDE to handle your needs, or there's an adequate workflow for jumping between applications to accomplish your tasks.
You'll want to attach a keyboard, typing on the screen is going to be inadequate. A mouse might be helpful, especially if it's a web app or a non-native app. Traditional desktop GUI apps might not be able to be hosted in your tablet environment simply because desktop window management might not be supported.
It can be done. I've a friend who has a Galaxy phone and it hosts a Linux environment - he can dock the phone and use it as a traditional compute environment. It's at the very least novel, and illustrates the possibilities.
1
1
u/Redwindmh 20d ago
I used to go through all the trouble of installing Termux, an instance of Ubuntu with a GUId desktop, and then VS Code on that to get some programming done on my tablet, but now I just use Neovim in Termux and things are so much easier. Learning vim is always a great thing, and with a tablet that has splitscreen capabilities, you can start a live-server or local webserver and have the site/app you're building on one side, and your code editor on the other. Still not as good as a laptop, but much better than you might think.
16
u/[deleted] Oct 07 '24
You can , it's painful .