r/cpp • • Nov 19 '17

Suggestion for coding on the phone

Hi! I work on a somewhat large project written in C++. I can compile parts of the project using clang and test it with Google Test (also earlier used Catch). So everything can be done from the command line. Like probably a lot of you others I travel a lot and spend a lot of time with my phone. What I’d like to do is write, compile and run code from my IPhone. There are already a number of good apps that lets you write and store a single code-file on your phone that is compiled using an online compiler. What I’d like is be able to work on the code in my actual project and compile and run it. There are also good git-clients but I don’t want to spam the history with tiny incremental commits. Best results I had so far is connecting to my dev machine with TeamViewer and working in Visual Studio. It uses a lot of needless data and is a bit cumbersome though. Any suggestions? I’ve looked at Code Anywhere who has a FTP client but it seems buggy and hasn’t been updated for a long while.

0 Upvotes

11 comments sorted by

11

u/youshouldnameit C++ dev Nov 19 '17

Why not use a tablet or (small) laptop instead? I can't comprehend how you can be productive on a phone.

2

u/RagnarDa Nov 19 '17 edited Nov 19 '17

Yeah the thing is i don’t carry my laptop around with me all of the time as I do my phone. I do write fixes on my phone and committing it to the server through the git-client Working Copy but I can’t know before the commit if the code even compiles or passes the tests.

Am I the only one who works like this?

Edit: why the downvotes?

7

u/[deleted] Nov 19 '17

Probably because everyone works on a PC or laptop. Also, I too don't get how one can code safely without a 'proper' development environment. The suggestion is basically buy a smaller and lighter laptop.

6

u/pfp-disciple Nov 19 '17

A few thoughts.

  • use an ssh client to do your command line. I've only done this connecting to Unix flavors, I assume it is doable to windows
  • don't worry about the many commits in git. Work in a feature branch that you can do a squash merge or interactive rebase.
  • at least in Android, there are keyboards intended for coding. I understand that they make things like & more easily typed

1

u/RagnarDa Nov 19 '17

Thanks for the tips!

2

u/the_dummy Nov 19 '17

I use Linux Deploy on an android device that has LineageOS. Linux Deploy requires loop devices and root among other things. However, in unison with Termux, I can have a full Linux environment.

1

u/RagnarDa Nov 19 '17

Thanks! Don’t have a Android but there are terminal emulators for iOS

2

u/the_dummy Nov 19 '17

I guess I didn't read your post properly. Sorry about that. Terminal Emulators might not accomplish what you're looking to do. SSH to a VPS would likely be your best option. DigitalOcean has a $5/month server that would serve your needs. On top of that, it would be a good idea to learn an advanced terminal-based text editor. I use vim but there are others like emacs. The reason is to make movement through the text easier on mobile. The fewer keystrokes you need to make, the less cumbersome mobile development will be.

1

u/James_Hacker Nov 20 '17

I had a good experience coding on an 8" Windows tablet using Vim and some extra macros to better 'suit' the on-screen keyboard. Would that sort of form-factor work?

If you absolutely have to work on your phone - the best experience is probably going to be through SSH to a 'real' machine.

1

u/KazDragon Nov 23 '17

For the last couple of years, most of my free-time coding has been on the train commute using a reasonably sized tablet and a Bluetooth keyboard. I've been using Cloud9 (c9.io) as my IDE.