Unchaining The Opportunistic Developer
In this article Jono Bacon describes a number of tools for developers who want to write small, focused fun applications for GNOME.
Within the GNOME community, something we have always tried to communicate effectively is that GNOME is not just a rocking desktop, but a rocking development platform too. Hours and hours of work have been poured into a variety of different areas in the platform, and what we have is a compelling software environment for building a range of applications that satisfy a range of use cases and needs.
The platform has been exercised well; applications such as AbiWord, Gnumeric, PiTiVi, Jokosher, GEdit, Gwibber, Inkscape, Cheese, and the core desktop itself all show off just what is possible with GNOME. While these applications are comprehensive and complete, they are serious engineering projects: they are driven by systematic programmers who are often career developers too. While the platform has served the needs of serious systematic programmers well, recently I have been particularly interested in exploring how we can make GNOME (and on a more personal level, my native Ubuntu community) a more compelling place for a different kind of programmer – the Opportunistic Developer.
Opportunistic Developers are people who want to write small, focused, fun little applications that scratch an itch, even if that itch is merely to have fun. Today on the other side of the field, these kinds of developers are having a whale of a time filling the iPhone App Store with scratch-your-itch types of applications: track your exercise, view a specific website, or push a button and get a fart noise. The iPhone platform has lowered the barrier for bridging the gap between creativity and implementation. I am really keen to see more of these kinds of applications on the GNOME desktop, and on a more personal level, making Ubuntu the perfect platform to deliver GNOME technology on which to produce these tools.
In much the same way that Linux/Apache/MySQL/PHP (LAMP) became a popular arrangement of tools for web development, we have been seeing a similar scenario in the Ubuntu world too, in which a set of tools work well together and are often preferred by developers. These are:
- Python – a simple, easy to learn, flexible and efficient high-level language.
- GTK – a simple, comprehensive and powerful graphical toolkit for creating applications.
- GNOME – the desktop environment that ships with Ubuntu, offering many integration facilities.
- GStreamer – a powerful but deliciously simple framework for playing back and creating audio, video and other multimedia content.
- Glade – an application for creating user interfaces quickly and easily, which can then be loaded right into your Python programs.
- DesktopCouch – a framework for saving content in a database that is fast and efficient, hooks neatly into Ubuntu One and is awesome for replication.
With the exception of Python and DesktopCouch, these tools are entirely based on GNOME technology. Many of the applications that we ship in Ubuntu are written using this platform, and this has helped make it simple for others to get involved and contribute patches and bug fixes to those apps. As such, we have been really keen to expose this collection of tools as a definitive platform for building applications for the Ubuntu desktop; it has helped build a common skill-set across our contributors. Of course, there are other languages and tools too, and they are all welcome components in the opportunistic developer vision, but we have found that choosing a set of tools as a platform and exposing it as a common development target has been useful in building awareness of GNOME for opportunistic developers.
To do this, we have also built a few additional tools which I wanted to share with you folks in this article.
Quickly is a tool for generating and working on software projects. It provides a range of features:
- Project generation – with one command, Quickly can generate a GNOME project with a window, menu bar, status bar, widgets, boiler-plate code and more.
- Editing – you can load all your source files with one command.
- Running – running code is also one command.
- Editing your UI – Quickly has a series of .ui files you can edit in Glade with a single command.
- Packaging – with one command you can generate an Ubuntu package.
- Releasing – also with one command, you publish your application to an Ubuntu Personal Package Archive and deliver it to Ubuntu users.
While most GNOME developers know that Quickly makes it easy to generate GNOME projects and package them for Ubuntu, Quickly actually has a template-based system, which means you can write any kind of application in it (this could include KDE applications and packaging for other distributions). What I like about Quickly is that it automates much of the repetition surrounding software development and it ultimately allows you to deploy software to your users. This instantly allows opportunistic developers to feel a sense of success around their projects as they can develop with ease—and deploy to real users with ease too.
I love Python and I love PyGTK and I am passionate about how tools such as Quickly are lowering the bar for opportunistic programmers to scratch their itch. The problem is, much as Python and PyGTK are incredible for writing apps, like any other tool they still need to be learned, and the best way to learn is by downloading, running and playing with code snippets. Traditionally, this has involved finding scattered bits of sample code online and stuffing them into a directory. Not only do we download other people’s sample code, but we often write our own little code snippets as we learn new parts of these tools, and these would be perfect to share with others. Unfortunately, many of us never end up putting them anywhere online.
I wanted to make it easier for opportunistic developers to get their hands on code snippets and examples to learn from. As such, I created the Acire and Python Snippets projects. These projects provide a simple means in which you get access to a freely available regularly updated library of examples, across a range of different areas. The project has two components:
- Python Snippets – this is simply a library of snippets that live in /usr/share/python-snippets with a series of sub-directories holding different types of snippets (e.g., pygtk/, clutter/, and gstreamer/). We have produced a daily PPA for Python Snippets. This means that every day new snippets are delivered right to your desktop.
- Acire – this is a GNOME front end to the library of snippets and named after my wife, Erica. This provides a great way of browsing and using the snippets.
I have deliberately designed the framework so that the data (python-snippets) is separate from the viewer (Acire), as I am keen for us to have a central body of data (python-snippets) but multiple front ends. While Acire exists today, there is a KDE version in the works and even a web front end.
Acire lets you do a number of things:
- Browse snippets by category.
- View the code (all syntax highlighted and reflecting your system Monospace font choice).
- Run snippets.
- Copy code and paste it elsewhere.
- Edit code inline and execute it, so Acire can be a place to play with the snippets themselves.
- Read links to online documentation and manual pages for included Snippets.
With Acire you will always have a growing knowledge base of real code that you can read, run and share, and the community works together to regularly add to and support that knowledge base.
As a little side story, I saw a rather nice comment on a blog entry I wrote about Acire and the Ubuntu Opportunistic Developer week I put together:
Thank you and the entire Canonical team for putting the Opportunistic Developer Week together!
I’ve been stuck doing heavy, back end enterprise Java programming for the past few years. My interest in programming slowly fizzled out.
On a whim, I decided to check out quickly, acire and the learning materials your team put together. PyGTK erased all the bad taste in my mouth from the Swing applications I’ve coded. (-: I haven’t had this much fun programming in a long time! Thanks so much!
The final component which I wanted to share is pretty Ubuntu-specific, so feel free to skip over this section if you are not interested in using Ubuntu as a collaborative development platform.
So, at this point we have all the tools needed to build applications, learn from code examples, and publish packages that will ultimately be visible in the Ubuntu Software Center. The one area that neither Quickly nor Acire has focused too heavily on is how we collaborate together on software. Few Open Source projects have one sole developer, so we really want developers to work well together, in conjunction with translators, documentation writers, bug triagers and more.
While I love Launchpad and Bazaar, their integration in Ubuntu could have been better. As an example, to get code in and out of Launchpad so you can contribute to a project, you use the bzr command and the process typically works like this:
- You download some code from the Launchpad project with bzr.
- You branch the code. This effectively means making a duplicate directory of the code.
- In that duplicate directory you add a feature, fix a bug or make some other kind of improvement.
- You then commit your changes to your local branch. This effectively tells Bazaar of the changes you have made.
- You then upload your branch to Launchpad. This is called pushing a branch.
- The final step is to propose a merge. This is when you offer your branch and its changes to the project maintainer to merge into the main codebase. Launchpad ties together nicely with bzr to handle this process and has a web front end for doing code review.
Now, understanding how all this works and doing it a few times takes a little getting used to, and much of it is learning how to use the different bzr commands and how they hook in with Launchpad. Recently some work has been going into a project called Ground Control, which provides a graphical interface to the whole process by building it into Nautilus. It works a little like this:
- You create a Projects directory in your home directory.
- Click Places->Home Folder and go to the new Projects folder.
- In there you can see an Identify Yourself button to identify yourself with Launchpad. Click the button and you see a form to enter your Launchpad username and password or create a new Launchpad account.
- Once that’s done, you see a a button where you can select a project to work on. Click on it, enter a project name, select it, and it creates a new folder.
- Now go into that folder. There is a button to download the code. Click it.
- You can now hack on your feature and a button will appear to commit your changes.
- Finally, you will then see a button to propose a merge. You enter some text to describe your change, and it is uploaded.
In addition to this general collaborative process, there is also a process built-in for fixing bugs. You can search for a given bug to fix, it will download the code, and when you click the Upload a Fix button it will upload the branch and attach it to the bug report.
No commands. None. What I love about Ground Control is that it is highly contextual; it is built into the file manager and it only ever shows you a button for what you can do at that time. It is simple and quick and Martin Owens has done a wonderful job with it.
With each of these components we are seeing more and more gaps in the integration and ease of the development process getting filled. I am hugely excited about this and I am excited about it bringing more and more people to GNOME as a development platform and it ultimately generating more and more Free Software for us all to use. We still have a long road ahead though and plenty of good work yet to do.
About the Author
Jono Bacon is the Ubuntu Community Manager, author of The Art of Community by O’Reilly, founder of the Community Leadership Summit and contributor to various GNOME projects, including Jokosher.