Monday, November 4, 2013

Tools for Developing on ChromeOS

I've been using my Chromebook Pixel as my primary machine ever since I got it for most of my work, with one crucial exception - development. Whenever I needed to do more than just edit a couple of individual files, I had to turn to my MacBook Pro with its trusty Sublime text editor and ability to run things like Node.

I'm happy to report, however, that things have changed dramatically just in the last several months, and it's now easier than ever to do real development on your Chromebook. In this post, I'm going to give an overview of some of the tools that I use when developing on my ChromeOS devices (In addition to my Pixel, I also have an HP 14, a Samsung 550 in developer mode, a Samsung Series 3, and an Acer C720).

Keep in mind that some of these tools are fairly new and still developing, so keep an eye on them as they get better over time. Also note that all the tools I talk about in this post are available for all the supported Chrome Apps platforms (Mac, Windows, Linux, and ChromeOS), but I'm focusing just on ChromeOS here.

The Basics - Offline Editing

Let's start with the basics - editing code. Obviously, having a great code editor that works locally on offline files is a prerequisite for any serious development on any computer. For ChromeOS, we have a couple of good options here.

Text App

Until recently, my go-to text editor was - not surprisingly - Text. It's pretty straightforward, works offline, has support for syntax highlighting, syncs with Google Drive, and can easily handle multiple open files.

Screen shot of the Text editor app from the Chrome Web Store
The Text app from the Chrome Web Store
As of this writing, though, Text has a few shortcomings. It doesn't remember the files I had open between sessions, it doesn't remember the window position or size, and it's not very customizable. All that said, though, it's a good editor for what it does, and I still use it all the time for various text editing tasks.

Caret

I'm a pretty big fan of Sublime Text, and it's one of the things I missed most when working on my Chromebook. I recently came across a new Chrome App called Caret that does a great job of code editing and gives me a user experience that's much more like Sublime:

screen shot of the Caret text editor application
The very Sublime-like "Caret" editor

Some of the things I really like about Caret are:
  • It remembers the files I had open between run sessions
  • It remembers the size and position of the window
  • Support for multiple carets and other Sublime-like features
  • Lots of color schemes, support for font sizes, etc.
  • Code completion
  • Very customizable - lots of user-editable settings
  • It's open source and has a Github project
Between these two tools, I think local code editing is pretty well covered. Caret in particular is in active development by the developer, so I'm looking forward to that app getting better over time and incorporating new features as they become available in the Chrome Apps API.

md everywhere

In addition to editing code, I find myself creating and editing Markdown content quite a bit, since it's how ReadMe files and such are represented in Github. 

The app that I usually reach for when I need to do this on my Chromebook is md everywhere, which - you guessed it - runs as an offline Chrome App. It has two main components: a window for editing markdown content, and a separate viewing window to see the HTML output, which can be shown or hidden separately from the editing window.

Editing Markdown on the left, with preview on the right

It's not perfect, and has a few quirks, but it gets the job done and greatly reduces the amount of guesswork involved. There are a couple of other MD editors in the store, but md everywhere seems to be the best of the bunch so far.

Cloud-Based IDEs

One of the more exciting trends of recent years has been the emergence of cloud-based IDEs. These are full-fledged development environments that work within your browser, giving you full access to a remote development box that can run all manner of environments, tools, etc.

Several of these IDE providers have existing apps in the Chrome Web Store, such as (but certainly not limited to): Koding, Cloud9, Nitrous.IOShiftEdit, and Codenvy. There are also collaborative cloud-based editors like Neutron Drive.

Each of these tools could take up an entire post on their own, and I'm planning to do a deeper dive into them at some point, but for the moment I'm going to focus on Nitrous.

Nitrous.IO

The Nitrous guys recently released their online IDE as a packaged Chrome App, so I've been using it a lot recently (which is not to say that any of the others are somehow lesser; to the contrary, they're all very good and have their own strengths). 

Cloud coding with Nitrous.IO

The Nitrous app is essentially a window that hosts the <webview> control, which displays the remote environment that you're connected to.

Setting up a remote Nitrous box is pretty easy, and you have your choice of Node, Ruby, Python, and Go environments. The Web IDE is straightforward, includes collaboration options, and lets you upload source files to the remote box. There's also a command shell for executing commands and such. The docs are pretty extensive, too.

I recently tried out Nitrous on a small NodeJS/MongoDB project, and the experience was about as easy as it could be. I just provisioned the box, uploaded some source files, and was working away within minutes. The Web IDE even provides a "Preview" function that launches the app within the local browser with the URL already set up.

Between working on source files locally and having a cloud IDE to test and deploy in, I can easily see how a setup like this could become the future of development.

Testing and Debugging

One of the greatest things about developing on a Chromebook is that you have access to the best Web developer tools in the business - the Chrome DevTools, naturally. You would be amazed at the number of people who don't yet realize this.

Chrome DevTools

Whether you are working on Chrome Apps, Extensions, or regular Web sites, the Chrome DevTools give you unparalleled features for debugging, profiling, logging, etc. Now, I'm not going to go deep into the Chrome DevTools here because all the information that you need to use them effectively is at that link that I've provided above, but here are some of the features you might not know about that you should definitely investigate:


Postman

If you do any work that requires transferring data to and from RESTful Web services (and who doesn't these days?), then you'll find that Postman is a great utility for testing REST based APIs.

Postman comes in two flavors - the original V1 Packaged App, and the newer Chrome App. I prefer the latter, since it works offline and in its own window. It also comes with a great set of online docs.

Postman makes working with REST APIs easy

Postman has some features that make working with REST services a breeze:

  • You can define collections of requests, and group them together to reflect your API
  • Adding headers and query parameters is quick and easy
  • You can set up different environments (such as "Production" vs. "Development") and then customize the way that requests are sent using variables
  • There are helpers for setting up various authentication schemes, such as OAuth2
  • The app adds each request to its History, which makes it easy to experiment
  • It is easy to customize the app's settings, and there are a lot of ways to tailor Postman to your particular needs
If your work involves REST APIs, then I highly recommend you download Postman.

Dimensions

Dimensions is a legacy, or "V1", Chrome Packaged App, but it's still useful and runs offline so I included it here (and hopefully the developer is working on updating it to be a Chrome App). Dimensions essentially does one thing - it shows you how your UI will lay out at different screen sizes.

Using Dimensions to view various layout sizes

Essentially, you start up the app, point it at a URL, and then slide the grab-handle left and right to simulate different screen widths. Assuming you've written your HTML to use responsive layout techniques, the page will change at various widths so you can gauge what it will look like on various devices.

Dimensions include pre-defined layout sizes for iPhone, Android, and Tablet sizes, and you can rotate each device to display different widths.

By default, the app will load in a browser tab, even if you're offline (that's what v1 Packaged Apps do). I usually set Dimensions to open as a regular window (just right-click on the app icon and choose the appropriate setting), which gives it a more app-like feel.

Useful Utilities

Editing and debugging get all the attention, but there are always those small utilities that developers use to make their lives somewhat easier when it comes to the workflow and other parts of development. Two of the utilities that I've found really useful so far are GistBox and HexReader.

GistBox

I've started using Github more and more to store things like code snippets (or "Gists", in their terms) because it's really easy to access them from everywhere, and GistBox makes organizing and working with Gists simple.

You can edit your Gists directly in the app, create new ones, apply labels, search Gists, and even share them via email or Twitter.

Organizing Gists with GistBox

Unfortunately, since it relies on Github access, it doesn't currently work offline, but given its purpose and usage scenario, I haven't found a situation where that has mattered for me yet.

HexReader

This one is pretty straightforward, and will be familiar to anyone who's ever had to manipulate binary files. Want to make sure that the file you're working with really is a proper PNG? Need to extract some embedded data from a PDF file? HexReader has you covered.

HexReader in action

It supports large files, you can copy data as text or hex, and it has bookmarks too.

Yes, it's a bit of niche app, and not exactly for everyone, but for those people who need it, HexReader is one of those developer utilities that you're glad is there.

Summing It All Up

ChromeOS has a come a very long way in a short period of time, and the developer story has improved right along with it. I find that I can do pretty much all of my every-day development tasks right from my Pixel (or, thanks to Chrome Sync, any one of my Chromebooks) while getting all the usual benefits of ChromeOS: speed, simplicity, and security.

And this is just the beginning - more developer tools are on their way, and the built-in Chrome DevTools continue to improve at a rapid rate.

App Links

I've included all the links to the apps I mentioned in this post here in one handy list for those of you looking to try some of these out:


Do you have any tools that you like to use to develop on ChromeOS? Be sure to let me know in the comments.

Happy Coding!

17 comments:

  1. For developing 3D web apps and games, there is PlayCanvas - http://playcanvas.com
    You can build game worlds collaboratively in realtime and code game logic (in JS) all from within Chrome.

    ReplyDelete
  2. Awesome article; thanks for shedding some light onto the subject. I was wondering, are there any options for working with GIT locally (without going into developer mode)? I know using a web IDE would be the "chrome" path to take, but I'm having a hard time wrapping my head around that. Will check out Nitrous.IO

    ReplyDelete
  3. There's a tool called Tailor, which used a JS implementation of Git, but I haven't had the best of luck with it. Now that the Chrome Apps platform recently added support for arbitrary directory access, it should be possible to create a client version of git as a Chrome App.

    ReplyDelete
  4. anyone know a link to where i can read up on all the stuff MD Anywhere can do? I have had humility beaten into me on nearly constant basis over the years and found it best to ask.. I can tell this will be majorly useful down the line

    :D

    ReplyDelete
  5. Thanks for sharing it! Really useful article, and maybe StackEdit is more powerful then md everywhere you would give it a shot.

    ReplyDelete
  6. StackEdit definitely looks interesting, but I really wish it was a Chrome Packaged App.

    ReplyDelete
  7. I recently got a Pixel and was keen to use it for development on the move. As I wanted to work with my favourite editor but didn't want to run a separate X session I hacked up support for running Emacs in Aura. I have a CLI based Crouton install for the rest of the development environment. I just got back from a week long conference with hacking sessions and I can report the combination worked well.

    ReplyDelete
  8. I often work alone on my coding projects. I have been using the SFTP plugin for Sublime to manage uploading my code. I also use Google Drive to keep a cloud-based backup. Caret sounds great for replacing Sublime but what can I use to replace the SFTP plugin?

    ReplyDelete
  9. NitrousIO may be the the favorite at the moment, but there's no assurance that they will be around next year. Given the tendency of SaaS announcing shutting with 1 month notice, I'm not putting my livelihood on cloud IDEs.

    ReplyDelete
  10. Just this week I have tried several apps from Editey. I was looking for basic XML, JSON and CSS tools. This suite seems pretty solid.

    ReplyDelete
  11. Secure Shell allows ops to dealing with AWS/GCE -- but not saving the pem files? Do you think its possible we could a ChromePackageApp with local storage... how can I get the keys to my local Chrome file system?

    ReplyDelete
  12. Hi, you make mind blowing ideas and a spectacular article here.Web development Last time, when I saw your site this was a little better but today I visit the web site again and find that you guys making a very smart work on the site.

    ReplyDelete
  13. https://codio.com/ is my favorite

    ReplyDelete
  14. Nice list, thanks Joe. Do you know if the Cloud Compute folks are looking at ways to make developing for AppEngine on ChromeOS (especially offline) an option?

    ReplyDelete
  15. Decent rundown, much appreciated Joe. Do you know whether the Cloud Compute people are taking a gander at approaches to make producing for Appengine on Chromeos (particularly disconnected from the net) a choice?
    Affordable Web Design

    ReplyDelete
  16. I'm thinking about getting a chromebook, for school work.
    Could it be used for basic mobile app dev, either running something like the MIT AppInventor + Java natively (unlikely I imagine) or download something built on a remote system (EC2/Windows or perhaps a Mac Mini) and push it to a locally connected droid device?

    ReplyDelete