Posts Tagged ‘programming’

Codea

Codea (formally called Codify) is an $11 iOS application in which not only can you develop applications, you can run them (you can’t run them outside of the app – i.e. this isn’t a way to develop iOS applications).

The application is very pretty – and that counts, this is iOS!  At launch, you’re presented with a set of example projects, and you can create your own (I don’t think touch-and-hold is a great way to get the contextual menu for delete/duplicate/copy into new project, but it works well enough).

Inside of a project, there are two views: the code editor and the execution window.  The editor is good – it’s not as good as Textastic (and there’s no configuration possible – not even changing font size via pinch & zoom), but it’s perfectly usable (the worst part are the tabs at the top where you can switch between files, where the tabs are bizarrely small).  There are elements of the editor that are superb: if the editor can tell that the function arguments are a colour, then you get a colour wheel, if the argument is a sprite, then you get a sprite picker, and so on.  That’s the way to make coding on an iPad faster and more enjoyable.  The keyboard, like Prompt and Textastic, has an additional top row with keys you’re likely to need (paired quotation marks and brackets, +=, and so on – it’s interestingly a very different set of keys to Textastic (both have their advantages).  Also available via this extra keyboard row is a very nicely formatted set of help documents that explain the methods that are available and how to use the app in general.

Applications are developed in Lua – this isn’t a language I’ve done a lot in, but I’ve seen enough and it’s similar enough to other languages that it’s easy to get familiar with it.  I sincerely hope that the developer plans to offer additional languages (Python!) in the future (perhaps as in-app purchases?).  Most importantly, there are methods available that expose the iOS interface to the code (especially touch information and drawing routines).  These are somewhat limited compared to writing an iOS Objective C application in Xcode on a Mac, but perfectly usable in this context.

Once the application is complete, you can switch to an execution window.  Two thirds of the screen are the application’s display, with a sixth for textual output (e.g. debugging) and a sixth for parameters (e.g. sliders that you can use to pass values to the application – these are extremely easy to use in the code).  Unfortunately, given Apple’s restrictions on apps, this is all that you can do with an application at present.

The app is well made and does what it aims to do very well.  There’s clearly room for expansion (minor interface tweaks, more languages, more access to iOS features) as well.  The remaining question is whether there is any practical use to the app, given that you’re restricted to running your applications within the Codea app itself.

(It’s possible that this restriction will be lifted or weakened in the future – with Apple it’s difficult to tell.  It does seem likely that there could be a version of the app that allowed you to export (as a collection of text files) and import code, just as an application like Textastic can – or even some sort of seamless sharing via Dropbox or iCloud.  This would make it easy to share applications, but you’d still need to run them in Codea itself, unless they were pure Lua and didn’t use iOS at all.  However, it seems feasible that someone could then write an emulator/interpreter for Codea apps for OS X (replacing touch with the mouse), so you could run your apps externally if you liked.  It seems very unlikely that you’ll ever be able to turn them into full-fledged iOS applications).

The app demos very well – it shows a glimpse into the future where not all development is done on traditional desktop/laptop systems.  However, I can’t see how it can be of any practical use – except for education.

For education, this seems like an extremely valuable application.  In an educational context, it doesn’t matter if the app can run standalone or not (it would be nice if you could easily share it with someone else, like a teacher).  The interface is approachable, and the language friendly, and there’s potential for creating very impressive apps.  I would love to teach a short course where the students did all their development in Codea (perhaps on a beach away from a typical “lab” environment…), assuming that the students all had iPads already (and we have an AppleTV and large TV to demo things to each other).  I hope that someone does do this (and writes it up somewhere where we can read about it!).

This application is amazing.  Even if you have no interest in programming, you should buy it to support the developer.  If you do have an interest, you should have bought it already.

Advertisements

Textastic

Textastic is a programmers editor for iOS.  It’s not perfect, but it’s very close to the app that I was waiting for ever since the first iPad was released.

Even before I had an iPad, I’d mostly stopped using my laptop.  The only time I did use it was when travelling overnight (I’d take it if I had to work while away, or in case there was an emergency and I had to work on something).  I don’t need a full computer for this – typing on a software keyboard on a 9.7 inch screen is perfectly adequate for emergency work, and when combined with a bluetooth keyboard (which is small enough to easily pack, and I already own) and a monitor (now a TV via AirPort mirroring) it’s quite useable as a work-while-travelling device.

The only missing component was the software: for a very long time there was nothing available.  There are oodles of word processing applications, note takes, and there are even a few HTML editors – but nothing designed for real programming work.  I’m not sure why this is, but I suspect that most professional programmers already have something along the lines of a small MacBook Pro or Air and find it convenient to travel with that, so wouldn’t use an iPad, even in these situations.  The best available was, unfortunately, using SSH (this was before Prompt, too) and doing the word in a command line on a server somewhere.

At $14, Textastic is expensive for an iOS app, but cheap for a programmers tool (it’s definitely worth the price).  This is a text editor, not an IDE, so you don’t get a debugger or interactive prompt or anything like that – it would be difficult to do that anyway given Apple’s restrictions, and I prefer a dedicated programmers text editor to an IDE anyway.  (You can easily switch to other apps that together provide most of what an IDE does).

It’s a good editor – it does syntax highlighting for many languages (including Python and everything else I’m interested in), shows line numbers, and you can switch the file’s encoding and line ending choice.  You can quickly jump to “symbols” (e.g. method), although I generally just scroll since I know where I’m going.  There’s a decent find (and replace), and you can choose from DejaVu Sans Mono, Courier New, Luxi Mono, Monofur or Inconsolata for the font.  There are a variety of colour themes, there’s control over tab settings (including soft tabs) and word-wrap.  Although you can set the font size, you can also just pinch & zoom to get the size that you’re after, which is far superior to manually picking a size.

Generally the app does what it should: it gets out of the way and lets you get on with writing/editing the code.  There’s an additional top row in the keyboard that offers symbols that you’re likely to need (this oddly scrolls horizontally to fit everything in) so that you don’t have to toggle between keyboards often (except for numbers) if you’re not using an external keyboard.

Where the app falls down for me is where iOS in general performs badly: moving data between applications.  You can share files to the app (e.g. from Dropbox), and there are actually many ways of getting files in and out (via WebDAV, iTunes, creating local files), but you’re left with the same issue that lots of iOS apps have: you end up with duplicates.  To its credit, the app tries to address this (e.g. it can know that a file you’re editing belongs in a particular Dropbox location and sync the changes back), but at the end of the day it’s clearly a hack.  The app is still useable, but this does mean that I more often read code in it than write it (it’s far better for reading code than the Dropbox app is).

It seems obvious to me how to fix this problem (I don’t understand why it isn’t already the case).  Surely nearly every programmer that would use this app has their code stored in some sort of repository (CVS, SVN, Git, Mercurial, Bazaar, etc).  The repository is the file system.  The app has a working copy checked out, and you can commit changes back to the repository.  The app doesn’t need to support every action that the VCS/DVCS offers – really just (in SVN terms) add/remove/update/checkout (and perhaps propset) – if you need to do something else, then you use a dedicated SVN/Git/etc app).  This completely solves the issue of multiple copies of files, because that’s exactly what these tools are designed to handle.

Unfortunately, the app would need to support at least SVN, Git, Mercurial, and Bazaar since there’s a lot of diversity at the moment.  However, it seems likely that there are libraries that can be used (even in iOS) that would handle a lot of the grunt work.  If the app let me check out a SVN working copy, make changes, and then commit them back, it would be absolutely perfect (I’d pay ten times the price if the app supported this).

If you need a programmers text editor on iOS, then I highly recommend Textastic.

PyPad

PyPad is a Python interpreter for iOS.  This sounds incredibly exciting, right – finally I can do proper development and run Python programs on iOS!  Unfortunately, that’s not really the case (mostly due to Apple’s restrictions).

PyPad lets you create multiple modules and execute each of them.  However, only a subset of the standard library is available, and there’s nothing iOS-specific available (so you can’t access the camera, or touch information, and so on).  Getting code in and out of the app is done via copy and paste.  The standard keyboard is provided, with start/pause/stop buttons.

I keep the app installed so that I can (via AirPlay mirroring) demonstrate simple Python snippets.  However, if I have an Internet connection available, then I can do that in Prompt (ssh’d to a server that has Python installed) much more elegantly.

The app is clearly limited by Apple’s restrictions as to what’s acceptable for iOS.  However, it does seem like it could do much more (e.g. see Codea) if more of the standard library was available (this would mean rewriting chunks, I presume) and if there were special iOS-specific modules available for accessing things specific to the device (especially for accessing touch and graphical output).  It could accept .py and text files from other applications, making it easy to get code in (e.g. from Dropbox) and share files (as text) – although perhaps that crosses Apple’s boundary for what’s ok.  It would be nice to include the Python documentation, too (I have a separate app for this, but it makes sense to have it in once place).

The app is only $2, so if you’ve any interest in Python on iOS, then I’d recommend buying it to have a look and to encourage more development.  You probably won’t end up using it that much, however.