Saturday, June 22, 2013

DevConf Russia

It all started with a tweet:

My first reaction was, woah, Moscow? Not quite sure if I'd like to make the journey all the way from Silicon Valley. But after thinking about it for a while I decided, hey, why not. Initially I was going to make visit both Moscow and St Petersburg, but I was a bit daunted by the task of acquiring train tickets in Moscow, so I ended up just going to Moscow.

I arrived Moscow the day before DevConf, and the organizer was kind enough to come pick me up from the airport. I saw the beautiful Moscow metro on my way to the hotel.

Mosaic at Mayakovskaya station
Mosaic at Mayakovskaya station

Moscow metro
Moscow metro

In the evening I had dinner with other out-of-town speakers, and then the organizers took us for a talk.

St Basil's Cathedral
St Basil's Cathedral

GUM department store
GUM department store

State Historical Museum
State Historical Museum

Conference Day

The conference is from June 14 to 15, but the organizers told me that the second day was all Russian workshops, so I could go sightseeing that day. I assumed then the first day was talks in English, but when I showed up I discovered that all but three talks were in Russian. One was mine, the other two were on the same slot.

I gave my Android Custom Components talk. Here I was, explaining Canvas using the flip board:


Photo Credit: Antony Dovgal

After that I went the Android productivity talk by Alexandre Thomas:

And that was it. The rest of the conference were all in Russian. I ended up going for a walk with Alex and his girlfriend. There was a market right behind the hotel, with lots of interesting buildings:

And then we went to this really big park next door.

For dinner, we found two restaurants next to the hotel. One serves everything with fries, the other one is a Japanese restaurant. So we had sushi for dinner!

Turns out sushi is rather popular in Moscow, to the point where I recognized it in Cyrillic - суши.

Sightseeing

Saturday the organizers took us all around Moscow. First we went for a river cruise.

Russian Academy of Sciences
Russian Academy of Sciences

Ministry of Defence
Ministry of Defence

Peter the Great Statue
Peter the Great Statue

Next we went to the Kremlin.

Kremlin
Kremlin

The Trinity Tower
The Trinity Tower

The Assumption Cathedral
The Assumption Cathedral

For lunch with went to Sanduny for tradition Russian food. It was so nice that I forgot to take photos!

After lunch we went for a walk. Saw the Bolshoi Theatre, GUM department store, St Basil's Cathedral and the Arbat area.

Bolshoi Theatre
Bolshoi Theatre

St Basil's Cathedral
St Basil's Cathedral

The DevConf Russia organizers took such good care of us it was quite amazing. They showed us around town, paid for everything, and even carried water bottles for us! I felt bad for not spending too much time at the conference, but it was really difficult to sit in sessions conducted in a foreign language. Hope the people who came to my talk found it useful!

Monday, June 10, 2013

AnDevCon Boston

Last week I was in Boston, attending AnDevCon Boston. Previous AnDevCon happens in the SF Bay Area, but it is branching out, alternating between east west coasts every six months. Very smart move to bring Android goodness to more people!

Glass Galore

One thing that jumped out at this AnDevCon was the prominence of the Glass Explorers. Quite a few attendees were wearing Google Glass, with a circle of people around them, asking questions, borrowing them for a test drive. Here is my friend Corey trying Glass:

Session highlights

There were so many interesting topics at AnDevCon that often they were scheduled at the same time, which meant I had to pick one at any given time. Fortunately many people were live tweeting, so there was a treasure grove of information to explore afterwards. Here are some highlights:

My sessions

I gave the same talks as AnDevCon IV: Beautiful Android on a Shoestring and Android Custom Components. They were scheduled back to back, at the last slots of the last day. I was very disappointed when I saw the program. My favorite part of speaking at conferences is talking to people, which often happens at lunch and coffee breaks. People who came to my talk spot me in the crowd, and we'd chat about my session and swap some coding stories. No chance to do that when my sessions happen at the end of the conference!

I was also worried that people would go home early, and no one would be around to come to my sessions. Fortunately that wasn't the case. Both of my talks were quite well attended, and people stayed behind a little bit to chat. Still, next time I would check the conference schedule as soon as it is published, and try to move my talk earlier. That way I get more time to hang out with people afterwards.

Hanging out

As always, I love hanging out with fellow Android developers at AnDevCon. Here is a group of us enjoying some seafood.

The next AnDevCon is back in Burlingame, from November 12 to 15. Hope to see you there!

Wednesday, May 1, 2013

Droidcon Tunis

My friend Corey Latislaw spoke at Droidcon Tunis last year, and really enjoyed it. This year she couldn't make it, but recommended me to the organizer. After a few email exchanges, I made the leap and bought a plane ticket to Tunis!

Mainz layover

There are not a lot of flights from San Francisco to Tunis, and I booked mine with Lufthansa, which had a 11-hour layover in Frankfurt. I took advantage of the time and visited Mainz, the birthplace of Gutenberg.

Gutenberg Museum
Gutenberg Museum

The Gutenberg Museum showcases the history of printing, with a few rare specimens of the Gutenberg bible. It also covered the printing techniques from East Asia, and there is circular movable type storage stand for Chinese newspaper printing with rows and rows of neatly sorted characters. I had always wanted to see that since a little kid, so it was quite a pleasant surprise to bump into it in Germany.

Tunis sightseeing

I arrived Tunis around midnight, and went for some sightseeing the next day. My first destination was the Bardo Museum, which is famous for its collection of Roman mosaics.

Roman mosaic at Bardo Museum
Roman mosaic at Bardo Museum

I really enjoyed the mosaics. They were made from tiny pieces of colored tiles, depicting the Roman life and mythology in a durable format. Some of the pieces were put on the floor, where they were meant to be, but I still feel like I should not tread on such beautiful art.

After the museum I headed to the medina, the old town of Tunis.

Tunis medina
Tunis medina

The medina is a maze alleyways lined with blue-and-white houses, traditional markets and towering minarets. I got quite lost in the beginning. Fortunately I found a walking tour map on the wall to orient myself.

Map for the medina
Map for the medina

It was a lot of fun exploring the nooks and crannies of the medina, stumbling upon an ornate door, a snack vendor hawking traditional sweets, or a group of cats sleeping.

Carthage and Sidi Bou Said

The next day I took a train to visit Carthage and Sidi Bou Said.

My first stop was the Carthage Museum. Not a lot to see here, since most of the mosaics were moved to Tunis. However I really liked the Acropolium next door.

Acropolium
Acropolium

Didn't look like much from the outside, but I love the style inside.

Acropolium
Acropolium

I then walked to the Roman theater and the Roman villa, before ending my tour at Antonine Baths.

Antonine Baths
Antonine Baths

The sheer size of the ruins were mind-boggling. The Romans sure loved their baths!

After Carthage I took the train further to Sidi Bou Said, a picturesque little town in blue and white.

Sidi Bou Said
Sidi Bou Said

It was such a joy to walk around and soak in all the blue and white. Every corner was stunningly pretty.

Sidi Bou Said
Sidi Bou Said

In the evening I went back to Tunis for a nice traditional meal: couscous.

Couscous with fish
Couscous with fish

I had a set dinner with appetizer, main course and dessert, only 7.5 dinars. That's less than 5 USD!

Droidcon Tunis

On Saturday I headed to the science city for Droidcon Tunis.

Droidcon Tunis poster
Droidcon Tunis poster

The conference opened with a violin performance. Classy!

After a full day of workshops, the organizers made us a nice traditional barbecue.

BBQ dinner
BBQ dinner

I gave my talk on the next day. The Tunisian crowd is really energetic, and we had lots of audience participation. That's the way I like my talks!

I was going to attend some other talks, but ended up doing some pair programming with a fellow attendee in the hallway.

Pair programming
Pair programming

I managed to go to the USB talk by Miki, which was quite a blast. Literally - he brought a missile launcher!

Miki demoing the USB missile launcher
Miki demoing the USB missile launcher

The conference concluded with a rock-and-roll performance. Yup, the Tunisians sure know how to have fun. They are such a friendly crowd, but also very driven to advance their technical skills. The energy made all the difference. Thank you Taher and the volunteers for putting this together!

Epilogue

After the conference we all went out for coffee. And then the organizers wanted to show us some traditional food, so we drove around town in the middle of the night, finally found a place still open, for some phenomenal ojja merguez. It was so yummy that we simply could not stop eating!

Ojja merguez
Ojja merguez

Bonus link: more photos from the trip.

Thursday, March 14, 2013

ConFoo

Before I started speaking I always wonder how people know about the conferences. Turns out most information is still disseminated in the traditional way: word of mouth. And that is how I heard about CooFoo: from other speakers. Specifically, I heard about it when I was in Amsterdam for Dutch Mobile Conference. They told me ConFoo is a very well-run conference covering a variety of technologies, and they treat speakers very well. So I followed ConFoo on Twitter, waited for the CFP, and submitted three talks. Two of the got accepted, which brought me to Montreal two weeks ago.

Ten tracks

I was a bit overwhelmed when I first looked at the program. There are ten tracks going on at the same time! Lots and lots of different technologies, and I often wanted to go to two talks in the same slot.

When there were conflicts, I often picked based on speakers. I know both Sandi Metz and Katrina Owen are great speakers, so I made sure went to their talks. They have great content in their talks, but they also pay great attention to delivery, bringing us on a journey through out the talk.

I also tried to go to talks which will expand my horizons. Creative Machines by Joseph Wilk was a great example. I got to hear about AARON, a machine that was trained by a painter over 40 years. The results are quite amazing.


Sample work by AARON

Overview and deep dive

I gave two talks at ConFoo: Fluid Android Layouts and Mobile Caching Strategies. Mobile Caching Strategies is a high-level talk, no code at all, so I knew it would work well in a general conference like ConFoo.

Fluid Android Layouts is a deep dive, and I found it difficult to cater to the different levels of experience in the audience. To make sure everyone can follow along, I went over some Android basics at the beginning. But I also provided code samples so the Android developers in the crowd had something to take home.

Well-run conference

ConFoo covers so many topics, and yet manages to keep the environment very intimate. There was plenty of opportunities to mingle with everyone, including very nice sit down lunches everyday.


Nice lunch!

There were volunteers at each session to help the speakers set up, give timing signals, and collect feedback forms at the end. Overall everything is well-communicated, and the organizers make sure everyone is having a good time. Bravo!


The organizers

Sugar Shack

With three conference days and ten tracks, there were a lot of speakers. The organizers arranged quite a few activities for us, one of which is to visit a traditional sugar shack. It was an hour drive from Montreal, in an idyllic setting among the snow.

Sugar shack
Sugar shack

We sat down in a wooden cabin and ate everything with maple syrup: bread, soup, sausages, frittata, meat balls, pancakes, coffee, just everything. I got to hang out with many different speakers, and not surprisingly, I already knew a few of them through various conferences, notably Dutch Mobile Conference.

Nuit Blanche

I decided to stay an extra night to do some sightseeing. It happens to be Nuit Blanche, the winter celebration. There were activities all over the city. We started by exploring the underground passageways, which were running an art exhibition. My favorite is by Baillat Cardell & Fils, which consists of a box with a mirror and a few tubes in front of it. But it was cleverly arranged that it looks like you are gazing into a tunnel.

Ici
Ici

We came up from underground and went to a square sprinkled with glowing snowballs. They were translucent ping-pong balls stuffed with an LED light, and so much fun to play! People juggled them, buried them in snow, and of course, threw them at each other. Such a brilliant idea!

LED snowballs
LED snowballs

At 9 o'clock there were fireworks. Afterwards we mingled among the crowd and checked out the various food vendors. The most interested one had open fire pits. People bought sausages and marshmallows to roast in them.

Open fire pit
Open fire pit

There was so much going on I couldn't describe it all. We saw fire dances, light shows, projections, blacksmithing, glass blowing... the whole city was awake until the wee hours. We couldn't believe it when we got back to the hotel - it was already 2am!

Monday, February 4, 2013

Learning iOS as an Android developer

As a veteran Android developer, I have always been curious about the iOS platform. Is Objective-C hard to learn? Is it really much easier to make beautiful UI in iOS?

I decided that the best way is to write an app on both platforms and compare. An app that I actually launch, so I experience the whole process, from coding to UI design to distribution. The result is Heart Collage, available on both Apple App Store and Google Play.

Here are my thoughts after learning iOS for two months.

The setup

I wrote an universal app in iOS 6, with auto layout and storyboard. I chose iOS 6 for the new functionalities like UICollectionView and UIActivityViewController. Auto layout and storyboard trickled down from the iOS 6 decision. Since I was on the latest version, I may as well take advantage of the latest tools.

Learning curve

The first three weeks were painful. Not only I did not know anything, but I lacked the vocabulary to ask questions. I would search for something and find 5 Stack Overflow threads, all of which sounding kind of related to what I need, but not really. It was really frustrating.

But things changed on the third week. By then I knew which classes I was using, so I prefixed all my image manipulation searches with UIImage, navigation searches with UINavigationController. I also had some basic understanding of how things were organized, and was able to skim and judge if a particular thread was relevant.

Once I knew how to find answers on the internet, development speed really picked up. I felt like I was actually coding, instead of walking into a wall.

UI Editing

Initially I thought I would really be bothered by all the square brackets in Objective-C, but I got used to the syntax fairly quickly. What tripped me up was Interface Builder / Storyboard.

In both iOS and Android, there are two ways to specify layout: xml and code. The difference is that Android has readable xml. Not so much in iOS.

Both systems use unique ids to refer to the various components. In Android, you define the id like this:

<Button android:id=”@+id/start_button” />

The build system gathers all the id tags and generate unique ids in Java:

public static final class id {
  public static final int start_button=0x7f08003b;
}

To refer to a view in your code, use findViewById:

Button startButton = (Button) findViewById(R.id.start_button);

In iOS, the storyboard directly generates the unique ids in the xml:

<button id="vMl-QF-OAb" />

To refer to a view in your code, you first define an IBOutlet in your .h file, go to the storyboard, right-click drag your view into the view controller. This assumes you have already told storyboard that this particular window is linked to that view controller, otherwise the IBOutlet will not show up.

It all makes sense after the fact, but when I first started I would drag and drag and drag and not be able to link the views. Sometimes I forgot to specify the view controller. Other times I forgot to add the IBOutlet. On late nights I forgot it’s right-click drag, not just drag.

The most difficult part is that I cannot compare my implementation with sample code because it is all visual. In Android I would diff the whole project, code and xml and all, to find out what I missed. The XML produced by Interface Builder / Storyboard is not diff friendly at all.

Built-in Components

Once I got the ropes around UI editing, I can build the various screens for the app. People claim that the built-in components in iOS are much more beautiful than Android, but the gap has significantly narrowed since Ice Cream Sandwich. Sure, the iOS UIPickerView is still much more delightful to use than the Android Spinner, but the basic components like buttons are pretty much on par.

There was one thing that was much much easier to use on iOS than Android: the camera preview. Heart Collage shows a square camera preview for you to pose. In iOS, I can ask for a preview window in any aspect ratio, and the system crops the camera feed automatically. In Android? The system stretches the camera feed to the aspect ratio of the preview. To make a square camera preview I had to make the preview window the same aspect ratio as the camera feed, and cover up some parts so it appears to be a square. It was really involved. Who wants a distorted camera feed anyway? Cropping is the right thing to do.

For the rest I almost always find direct correspondences: ImageView maps to UIImageView, TextView maps to UILabel, ListView is roughly UITableView, and GridView... well GridView is interesting. Up until iOS 5 there is no built-in grid view. You have to use a UITableView and layout the cell on each row yourself. I was shocked when I heard that. Guess I’m spoiled by Android? We have that since version 1! Fortunately UICollectionView was introduced in iOS 6, and unlike Android, it is okay to target the latest OS release because most users upgrade very quickly.

This brings us to the famous fragmentation debate.

Fragmentation

There are two kinds of fragmentation: OS version and device form factor.

OS version

iOS is definitely better positioned against OS version fragmentation, since Apple is the sole manufacturer of all iOS devices and they completely control the OTA schedule.

Device form factors

Until recently the device form factor was pretty uniform. There is Retina and Non-Retina, that’s it. Different density, same aspect ratio. Same aspect ratio means you can still use a coordinate-based layout system and align your views in Interface Builder.

Everything was peachy until iPhone5. Suddenly there is a different aspect ratio, and Apple needed something more powerful than struts and springs. The solution is Auto Layout.

Auto layout is a declarative way to specify the positions of your views. Instead of saying, put this image 240 pixels from the top, you say, center vertically. The system computes the xy-coordinates based on your constraints, so it adapts well to different form factors.

Auto layout sounds good on paper, but it is really clunky to use in practice. In Interface Builder, you still drag and drop your views, and XCode tries to guess your intention. Most of the time it gets it wrong, so I have to remove the automatically generated constraints and create my own. I also tried doing it in code, but it is very verbose, and very easy to make mistakes. The visual format helps a bit, but most of the time I want to center my views, and there is no way to specify that in ASCII.

This is the time when I really really miss Android. The system was designed from day one to handle multiple form factors, and you are introduced to concepts like match_parent and wrap_content from the very beginning. I declare my layout in xml, spell out relationship among the the views with human-readable ids, and I can easily verify my rules whenever I need to add a view. In iOS I am always doubtful when I drop in a new view. What did it do to the existing views? It is so tedious to click through them one by one and examine all the constraints.

Perhaps there is a better way. But all my iOS developer friends started before iOS 6, before auto layout was available. They declare their views in code, compute the frames by hand, and basically run their own layout algorithms. And there is no reason to convert once you have a system in place, so I am on my own on the auto layout front.

Intents

Another thing I miss about Android is the intent system. Both for navigation and integration.

Navigation

For Heart Collage, I capture your poses with the camera, then replace the camera activity with the view collage activity, showing the mosaic. Here is what I do in Android:

Intent intent = new Intent(this, ViewCollageActivity.class);
startActivity(intent);
finish();

In other words, I add the view collage activity onto the activity stack, and remove the camera activity by calling finish().

It took me a very long time to figure out how to do that in iOS. In storyboard, most of the time you push a new view controller onto the stack by adding a segue to a button. You can also push a manual segue, which is what I do after the camera snaps all the photos. The tricky part is, how do I pop the old view controller? If I push first, the old view controller is no longer on top on the stack, so you cannot pop it. If I pop first, the old view controller is no longer on the stack, and I am not allowed to ask for a segue from it.

This is the moment when I doubt if it was wise to go with storyboard. It seems to be designed for very simple navigation needs, and even my 4-screen app is too complicated for it. I ended up popping one level higher with a flag to automatically forward me to view the collage. Bit of a hack, but I was too far deep into storyboard to back out and recreate all the views in xib. Especially since I have no way of copying and pasting the layouts, so I have to drag and drop everything again.

Integration

After you make a Heart Collage, the app lets you share it with your friends. This is super easy on Android. I just create an Intent saying that I want to share an image, and the system automatically generates the list of installed apps that can handle that. It’s an elegant way to have a personalized and extensible experience. Users can share their collages with any apps they prefer, and I don’t even need to know they use that app, let alone creating a new integration point.

For sharing, iOS 6 provides a similar functionality with UIActivityViewController. I set up the message and image, and it brings up a list of options for sharing. The big difference is the list is curated by Apple, and not extensible by the user. So everybody will see Sina Weibo as an option, whether they care about it or not.

This is where Android really shines, the seamless integration among apps, and as a result a very personalized experience.

Distribution

Beta testing

Finally my app was ready for beta testing. Yay!

Here are the steps for both platforms:

Android

  1. Compile the apk
  2. Email it to some friends
  3. There is no third step

iOS

  1. Collect UUID from friends
  2. Create provisioning profile from iOS dev portal
  3. Add UUID for each new test device
  4. Download provisioning profile from iOS dev portal
  5. Compile ipa
  6. Email provisioning profile and ipa

The most painful part is that I have to manually add each test device on the provisioning portal, and then download it to my local disk to compile the ipa. So tedious.

The flip side though, I know exactly who can run my app, and I don’t need to worry about leaks. For Android, once you send out an apk you have no idea where it will go. And there isn’t really a good way to limit the distribution.

Release

And now, the final moment - release to store. No anxiety for Android at all. Just upload, wait for an hour or so, and it’s live. For iOS, there is the review process.

I want to release Heart Collage before Valentine’s Day, so I submitted at the end of January. There should be plenty of time, but the potential rejection was stressing me out. I was so relieved when the app got approved the first try, in 6 days. Jubilation!

Verdict

I have been mostly pointing out the difference between iOS and Android. But at the end of the day, they are more similar than different. In terms of technology, at least. The verdict is still out on the money. Is it true that iOS users are more willing to pay for apps? Which platform will generate more revenue? That will be the driving force for my decision to spend time on iOS vs Android, and the numbers are still out. Will Heart Collage get more downloads on iOS or Android? We shall see.

Many thanks to Cyril Mottier and Tim Burks for reviewing the draft of this article.

Wanna check out Heart Collage? Download it here:

Friday, February 1, 2013

Heart Collage launched

Super excited that I just launched my app Heart Collage, just in time for Valentine's Day!

The app shows you how to pose for each part, snaps the shots one by one, and stitch them all together into a Heart Collage. I love watching people pose for the various parts of the heart - it's hilarious!

Get the app from Google Play or Apple App Store, and let me know what you think!

Tuesday, January 1, 2013

2012: Year of Speaking

Happy New Year! 2012 has been wonderful to me. I started out with the goal of becoming a public speaker, with the specific goal of 5 lightning talks and 3 full-length lectures. While I came short on the lightning talks (4 instead of 5), I went way beyond on the lectures (13 instead of 3), speaking at far away places like London, Bucharest and Antwerp. You can see all my talks at my speaking profile. (Yup, I have a speaker profile!)

Besides giving talks, I also wrote a few blog posts on speaking:

All in all, I consider it mission accomplished!

New Resolution?

I really enjoy public speaking, and will continue to do so in 2013 and beyond. I wanted to set a new goal for the new year, but I couldn't come up with a crisp one like last year. Here are a few of my candidates:

  1. Mentor others to speak at tech conferences
  2. Give a keynote speech
  3. Write a book

Mentoring

Mentoring others is a great goal, but I have difficulty coming up with a measurable result. Initially I thought, "put 3 people on stage", but I suspect I won't be the sole reason someone is speaking, so it is really hard to quantify.

Keynote

Keynote speech is an interesting goal. Keynotes open conferences, address to a large crowd with a diverse background, and have everybody take home a learning or two. It is quite a daunting task. My aspiration would be to give a keynote speech that is deeply rooted in my technical knowledge, but unveil general life lessons. I have no idea how I would write a speech like that, and even if I do, keynotes don't have open call for speakers, so I have no idea how I would be invited to deliver one. The lack of a game plan makes me uneasy, but perhaps that's the kind of goal I should shoot for?

Book

For the book, I'd like to write an advanced Android book that expands on my various talks. The main holdback for this goal is the time. I have spoken to many tech book authors, and all of them told me it is a lot of work. More work than you think, and then some more. I have so many projects going on that I am not sure if I should take on such a big goal.

No Resolution

In the end I decided I won't have a new year resolution. I will still mentor others to speak, think about my pie-in-the-sky keynote, and test the writing waters with a chapter or two. But I won't have a resolution with a font-size: 1.8em measurable result like last time ^_^