Ubuntu In a Nutshell: The Ubuntu SDK and Developer Story

This article is part of a series of blog posts covering the many different areas of work going on in Ubuntu right now. See the introduction post here that links to all the articles.

In my last article I talked about the new app upload process, but today I am going to talk about how developers write apps in the first place.

For a long time our app developer story in Ubuntu has been quite fragmented. This has been due to a number of reasons:

  • We have not had a single consistent platform that we ask developers to write to. We have traditionally supported GTK, Qt, and anything else that lives in the archive. This not only presents a inconsistent developer experience, but also an inconsistent user experience too.
  • We lacked app design guidelines around how developers should build apps that look consistent on the platform.
  • We didn’t have a single consistent developer portal and support network to provide the support and guidance app developers need to build awesome apps and get them into the platform.
  • We also didn’t have a good answer for writing an app that can work across multiple form factors.
  • Finally, we didn’t have a single consistent SDK that developers could use to write apps: they had to pick from a plethora of tools, with varying degrees of quality.

We tried to rectify some of these issues by recommending people write apps with Python and GTK, and we wrote a tool called Quickly to optimize this process. Quickly would generate a project and help with tasks such as editing, creating your UI, and generating a package, but quickly was a somewhat primitive and incomplete solution to the problem.

The work on Quickly also showcased some limitations in our tooling. At the time we recommended people write apps using GEdit, Glade, and GTK. Unfortunately, this collection of tools just didn’t compare favorably to the developer experience on Apple and Google’s platforms, despite the best efforts of the respective upstreams. We needed to provide an end-to-end SDK for developers that would take a developer from a new project through to submitting the app into the Ubuntu Software Center.

Choosing a Technology

We set out to resolve these issues and build a consistent Ubuntu SDK.

The first decision we made was around which frameworks we wanted to support when developers write their apps. These frameworks needed to be highly efficient and able to converge across multiple devices. We finalized this list as:

  • Qt/QML – native applications that can be run on any of the devices and adapt to the screen size.
  • HTML5 – web applications that can also adapt to the device with deep integration into the system services (e.g. messaging menu, launcher etc).
  • Online Services – integration of web apps into the system services (e.g. messaging menu and unity integration).
  • OpenGL – full OpenGL support for games.

Some time ago we decided to focus on Qt as a platform for not only building our SDK but building our convergence story too. Qt has many benefits:

  • It provides a fast C++ library and toolkit as well as a neat higher-level declarative technology in the form of QML. This means that we have the power of C++ for system software (e.g. writing Unity) but app devs can write apps using a high-performance higher level technology that is easier to learn and faster to write apps with.
  • Qt provides an awesome set of tools – an integrated IDE, debugger, designer and more.
  • The Qt Creator IDE is very pluggable which means we could use it for our main IDE and use it for writing apps in HTML5 and OpenGL.
  • Qt and QML documentation is fantastic.
  • Qt has a strong eco-system surrounding it and lots of companies in that eco-system. This makes contracting out work and hiring much easier.
  • Qt is a healthy upstream and very keen to work with those who consume it.

We also started looking into the best way in which we could support HTML5 developers. While the IDE decision had been made (Qt Creator) we also decided to invest in building Apache Cordova support into our SDK to make writing HTML5 as flexible as possible. This way you can either write a stock HTML5 app or use the cordova functionality…all accessible within the same IDE.

The Ubuntu SDK

We formed the SDK team and started work. This work was broken into two areas.

Firstly, we started work on the app developer platform. This is largely identifying the needs of app developers for writing apps for Ubuntu devices, and ensuring we have support for those needs (which largely requires integrating that support and creating APIs). This has included:

  • Building the Ubuntu Component set – a set of widgets that are usable in QML and HTML5 that developers can use to construct their apps.
  • Application lifecycle (suspending apps to preserve battery life).
  • Location Services.
  • Multimedia and Music.
  • Alarms.
  • Calendar Integration (using Evolution Data Server).
  • Sensor services (e.g. accelerometer).

This work is currently on-going and in various stages of completeness, but all of these platform APIs will be ready by the end of August and many apps are already consuming them. Remember, these services will be made available across all form factors.

The second piece was the SDK itself. This is tuning the Qt Creator IDE for our needs and ensuring it can be used to create QML, HTML5, and OpenGL apps. This work has touched on a number of different areas and has resulted in the following features:

  • We have project templates for QML, HTML5 (Cordova), HTML5 (Stock), and Scopes – here you can easily generate a project to get started with.
  • Source control integration for Bazaar and Git – this makes collaboration around an app easier.
  • Device integration – with just a click of a button you can run your app on an Ubuntu device to test that it works correctly.
  • Click package generation – generate a click package that you can use to upload to the Ubuntu Software Center.
  • Ubuntu Component Showcase – browse all the different Ubuntu components and see the code for how to use them.
  • Integrated documentation, IRC, design guidelines, and Ask Ubuntu support.

We rolled all of these features into the first Beta of the SDK which was released about a month ago and you can get started with it on developer.ubuntu.com.

developer.ubuntu.com

Speaking of developer.ubuntu.com, we have invested significantly in making the site a central resource for all of your development needs.

Currently the site provides tutorials for building apps, API documentation, and a cookbook that brings together the top rated questions from Ask Ubuntu. The site provides a good spring-board for getting started.

We are however in the process of making a number of improvements to developer.ubuntu.com. This will include:

  • Revised site navigation and structure to make it easier to use.
  • Better and more clearly integrated API documentation.
  • Wider API coverage.
  • Cookbooks for all of the different app templates.
  • Full integration of Juju Charm documentation and API.

We are expecting to have many of these improvements in place in the coming weeks.

Are We There yet?

As we stand today we now have a powerful Ubuntu SDK with support for writing convergent apps in Qt/QML, HTML5, OpenGL, and writing Scopes that fit into the dash. You can go to developer.ubuntu.com to find out more, install the SDK, and fine tutorials for getting started.

We are only just gettin started though. The 1.0 of the SDK will be released in October and expect to find more refinements, better integration, and more features as we understand the needs of our developers better and expand the platform.

  • Guilherme Aiolfi

    I have this feeling that everything is moving so fast in Ubuntu. It seems ubuntu had evolved so slowly until 10+ months ago. And now: WOW! I had never been so confident in linux @ desktops. I don’t know what changed there, but keep it up. It’s working. Congrats and I can’t wait to see the full vision concrete in 14.10.

  • Human Kindness on the Edge

    It seems to me that sizes of elements in ubuntu-html5-theme CSS files are adapted to 96 DPI only. Is any way to use the Grid Unit in Cordova Ubuntu? If not, maybe new non standard property window.ubuntuGridUnit (or navigator.ubuntuGridUnit) could be the solution. For example, if window.ubuntuGridUnit = 8 then 1gu = 8px. Of course, this solution is good for JavaScript+HTMLDOMStyleObject, not for CSS.

  • http://www.mhall119.com/ Michael Hall

    Not with just straight CSS we couldn’t, we’d have to use some kind of CSS pre-processor where we could use variables that would later be replaced by the right px/gu value.

  • http://paglias.net/ Matteo Pagliazzi

    What is really missing are resources and tutorials for desktop apps. Is there any plan or better date for desktop resources?

  • http://www.mhall119.com/ Michael Hall

    Not yet, we’re still finishing up the mobile app development story. However, next week we’ll be planning on providing design guides for desktop apps and what component work will also need to be done. If you are interested in this, you should try to attend (it’s a Google+ hangout with IRC) http://summit.ubuntu.com/uds-1308/meeting/21919/appdev-1308-convergence-designs/

  • Human Kindness on the Edge

    window.ubuntuGridUnit (probably should be added to QtWebkit) property could be useful in an app for all cases not based on the ubuntu-html5-theme and its CSS files.

    For example, what if I want to create DIV with width 40gu and border-radius 1gu? JS solution: divObject.style.width = (window.ubuntuGridUnit * 40) + “px”; divObject.style.borderRadius = window.ubuntuGridUnit + “px”;

    Another case: changing the values dynamically.

  • Miguel Cañedo

    well, maybe all this proves that many years ago the right chioice was in fact KDE/Qt instead if GNOME/gtk

  • Human Kindness on the Edge

    I thought about what I wrote above. Now I thing that the better solution will be creating new Cordova plugin – the equivalent of the UCUnits class in the QT/QML world (http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/ubuntu-ui-toolkit/saucy-proposed/view/head:/modules/Ubuntu/Components/plugin/ucunits.cpp).

    //Here are a few theoretical examples of use: (1) divObject.style.width = navigator.units.gu(40) + “px”; divObject.style.borderRadius = navigator.units.gu(1) + “px”; uiElement.style.height = navigator.units.dt(1) + “px”;

    (2) var c = document.createElement( ‘canvas’ ); var gu = navigator.units.gu(1); divElement.appendChild(c); c.width = gu * 80; c.height = gu * 40; var ctx = c.getContext(“2D”); ctx.beginPath(); ctx.rect(gu * 15, gu * 20, gu * 10, gu * 3); //… ctx.lineWidth = gu * 0.1; //…

    In my opinion HTML5/Cordova app without the Grid Unit support is not a “first-class citizen”.

  • CheeseBurg

    Will a timeline for the Desktop session be discussed as well? I was hoping that in 14.04 (or before) we can get an alpha for it.

  • CheeseBurg

    A couple of quick questions.

    1) Will there be APIs for Ubuntu one, HUD, notifications, etc. 2) Will Canonical be making something like a Game Center? Is it something that will be discussed at a later point or is it something you want the community to create? 3) Will there be a JuJu template in Qt Creator? 4) On developer.ubuntu.com, will the guides/resources be split by device? So will Desktop, Phone, Tablet, TV, and JuJu get their own pages? 5) When and how is Canonical going to lure in developers in large amounts? I figure once the App Store is finished but not sure. Also how can I help in that regard?

  • http://wellsb.com Brad Wells

    Will we be able to generate click packages for more than just qml projects in the near future? (For example, those with a C++ backend)

  • CheeseBurg

    I don’t want to seem rude or anything but is someone from Canonical going to answer these questions. Some of these questions are from my friends who are developers.

  • SyNAPSE NeuroCogni
  • Vi veri universum vivus vici

    “Protection of QML code” (JavaScript and GLSL too) http://qt-project.org/forums/viewthread/10704

    The Canonicals, can you comment on this in the context of the universum of Ubuntu?

  • Marcos V.F.

    Hi Michael,

    You can share the link of this Hangout? Thanks

  • http://www.mhall119.com/ Michael Hall
  • http://ltmo.com.ar/ Matías Iturburu

    Today was about to start making an app for ubuntu. Was really surprised that python support is nowhere present in the sdk.

    Javascript is cute and all, but is a real nightmare to deal with and QML is halfway between dart and java (if that is at all possible).

    Python was a first class citizen in ubuntu. The best stack to work with for a solid six years.

    Now we are stuck with half assed solutions and a joke sdk.