Clean Code – Mandatory Reading for Developers

All developers should need to read Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.

If time prevents you from reading an entire book, then at least read this chapter: “17. Smells and Heuristics”.

One of my favourite bits of advice (that actually comes up a lot in discussions with the developers around me) is captured in this paragraph:

There is hardly anything more abominable than a dangling false argument at the end of a function call. What does it mean? What would it change if it were true? Not only is the purpose of a selector argument difficult to remember, each selector argument combines many functions into one. Selector arguments are just a lazy way to avoid splitting a large function into several smaller functions.

The book is filled with code examples, describes concepts rather than programming language idiosyncrasies, and is useful even for seasoned programmers.

Whatever language you code in (today), this book is likely to become a fixture on your desk for a very long time after you’ve finished reading it. Get the paperback version, and fill it with colourful post it notes.

TV Wishlist

I’ve owned an Apple TV for a few months now (I have a Dev Kit unit). I’ve coded for it and I’ve been enjoying it a lot more than I had anticipated. Here are some of the things I’d like to see in the upcoming iterations of the software / hardware.

Accessories for the USB-C Port

Camera

I’d buy a camera compatible with the this new Apple TV in an instant. I’d mostly use it for video chat (FaceTime, Skype, etc) but I can see how some other types of apps could use it too (Snapchat, Livestreaming a video podcast, etc).

Playroom / Kinect style games could also benefit from being able to plug in a video capture device.

Bluetooth is not an option because the camera would needs its own power source.

Game Accessories

This port could also be used for a number of game accessories. From Dance Dance Revolution mats, to Steering Wheels for your favourite driving game.

Web Browser

My reason may be different from yours. If you ever tried setting up an Apple TV in a hotel room, you probably know how annoying the whole log-in via a browser window situation can be.

Search APIs

Apps could be so much more powerful if they could tap into the Siri Remote search capabilities. Search is available to some video streaming services, but I think many more apps could benefit from such a feature. Here’s an example: “Siri, play a 10 minute summary of the new on Reuters”.

Picture-in-Picture

I’d love to be able to watch a film and then launch a Wikipedia or IMDB type app and interact with that app while the movie is still playing.

It would be great to be able to watch some live sports while shopping on Gilt, or browsing my next holiday destination on AirBnB. Anyone can get distracted during a game of cricket, surely.

New Remote

I’m one of those people who watch TV in the dark. Because of this I find myself holding the Siri remote “wrong”. I’m wishing for a less symmetrical remote that I can pick up an instantly know which way I’m holding. I also want a trackpad that is either less sensitive or is a bit smarter and doesn’t activate until I’m holding the remote with a tight grip or is able to detect accidental touches.

I’m hopeful

The reality is, that until the things above are implemented, the Apple TV will have to be shared with some other device. In my case, the couch device of choice is my iPad.

It’s likely that Apple prefers this, but they are also the one company that would be very happy to cannibalize its own product rather than wait for someone else to do it. Come on Apple TV, kick my iPad off the couch and turn it into my bed-side device.

AirPlay Speakers. A SONOS Alternative for iOS Users

I have been jealous of my friends sporting SONOS setups for a while now. My reasons for not jumping on the SONOS bandwagon are not limited to just the steep prices that the SONOS speakers come with. The reality is that I prefer to use my own music / sound playing apps and because I listen to podcasts for a considerable amount of time. In this blog post I will describe a cheaper and more flexible alternative for achieving the multi-room setup that SONOS is praised for, using AirPlay enabled speakers.

Scenario

In this article, I’ll describe my actual home setup. I need at least three speakers: two for my lounge area and one for my office. I wish to be able to play music and podcasts (via my Overcast, my preferred Podcast app) to either speaker independently or to all speakers simultaneously.

The SONOS Ecosystem

Pros

play1-blk-front

SONOS PLAY:1

Part of the SONOS promise is that you can easily and painlessly play the same music in multiple locations (rooms), using speakers that “play nice” and “just work” with each other. I believe that SONOS does deliver on this promise.

Scaling the SONOS setup is trivial, all that’s required is buying another speaker and adding it to the setup.

Cons

I have three main reasons to hold back from buying into the SONOS ecosystem:

  • SONOS speakers are quite expensive (arguably they do have very good sound)
  • They require the use of the SONOS app
  • Integration limitations

Now that Apple Music is available for SONOS my third reason is all but gone, but I have to acknowledge that this may not be your case if you prefer streaming apps that are not available in the SONOS app.

Cost

The cheapest speaker is the SONOS PLAY:1. It costs for $199. A high-er end SONOS PLAY:5 speaker costs $499. The SONOS SUB Wireless Subwoofer and the SONOS PLAYBAR TV cost just under $700 each.

The AirPlay Solution

Pros

iW3S_F.jpg.450x400_q85

iHome iW3

My needs are quite specific, therefore some of these pros may not apply to everyone.

  • AirPlay is available to any app (it’s a global iOS setting). It’s also easily accessible from the iOS Control Center
  • Big choice of speakers (most are budget friendly)
  • Old Airport Express units can turn any speaker with Line-In into an Airplay Speaker
  • Very easy to use as external speakers for Apple TV
  • Can stream the sound from any of my Macs (iTunes even has support for multiple speakers)
  • Most speakers have Bluetooth too, thus making them really good travel companions (to locations where WiFi is not available)

Scaling the AirPlay setup is not too difficult, after adding another speaker to the setup, there’s an option AirFoil configuration step.

Cons

The initial setup is more complex than with SONOS. Usually it requires joining an adhoc WiFi network provided by the speaker, followed by entering the local WiFi settings which enable to speaker to join the local network and become a wireless speaker for any AirPlay device.

SONOS speakers can easily turn into a 5.1 setup when enough speakers are added to the setup. AirPlay speakers haven’t really solved this, yet.

Cost

One the the most affordable options is the iHome iW3 AirPlay Rechargeable Wireless which retails for $49.95!

The audio aficionados can splash out on a Bowers & Wilkins Zeppelin Air Wireless AirPlay Speaker Dock. Amazon sells it for $420 at the moment.

I happen to have a Mac that is always on at home, so I decided to also purchase AirFoil. This has enabled me to group my speakers into “rooms”.  The Mac version costs $29.

Alternatives

Bluetooth

Most people will probably just use Bluetooth, and that’s ok. Not everyone needs the lossless audio that SONOS and AirPlay offer.

AirPort Express

As I mentioned above, an old Airport Express can turn an existing speaker into an AirPlay enabled speaker. Check out Apple’s refurbished store for a deal on AirPort Express units or buy from Amazon for $29. You don’t need the current generation one.

Android

There are apps out there that allow Android to tap into AirPlay. I am not familiar enough with them, and I suspect the new Chromecast Audio may actually be a more suitable solution. Chomecast Audio sells for $35.

Conclusion

I implemented the AirPlay solution for myself and I’m happy with it. I’d love to hear your thoughts, especially if you prefer an alternate setup.

3D Touch vs. Long Press

Apple announced the new iPhone 6S line at their September event. One of the tent poles of their new iPhones is 3D Touch, a hardware feature that provides “depth” to touch interactions. An argument can be made that this feature can be replicated by a Long Press (a gesture that is already available).

Interestingly enough, almost all the interactions demoed during the event could be built today, using a UILongPressGestureRecognizer. Even the taptic feedback could be faked with a vibration.

Here are some of the differences between the two gestures that I can think of.

  1. Resting a finger on the screen could mis-fire a Long Press, but not a 3D Touch
  2. 3D Touch can provide instant gratification. Long Press gestures are defined by a minimum touch delay, therefore they would be laggy in comparison
  3. It would be very difficult to implement an app with multiple Long Press gestures, but it would be straight forward to mix a Long Press gesture and 3D Touch
  4. Long Press does not provide depth. Games can benefit from using this feature

Neither 3D Touch, nor Long Press gestures are discoverable. That is potentially why we have not seen many Long Press implementations this far. Looking at the Apple Music app, the Long Press gesture (on a For You playlist for example) opens the overflow action menu. It will be interesting to see if 3D Touch replaces that, or augments it in some way. Even the Instagram implementation doesn’t really “need” 3D Touch to offer a preview of the selected photo. A one second tap could provide the same functionality, albeit with a bit of a delay.

I’m thinking of an analogy with the home button. Pushing it down twice takes the user to multi-tasking. Tapping it twice invokes the “reachability” which makes the screen slide down. I often forget that the latter feature even exists… Long pressing an app’s icon will compete with the gesture that invokes “wiggle” mode. It will be interesting to see if users will be confused by the two gestures.

I have a feeling that many developers will start implementing Long Press gesture fallbacks for 3D Touch and that more and more apps will start providing Peek + Pop behaviours in their applications. This alone can be a huge win for many users out there, as long as the developers don’t start hiding essential functionality behind a gesture that I believe is not very discoverable. (Did you know that a Long Press on the back button of OmniFocus takes you to the app’s home screen?)

Notes:
I have not used an iPhone with 3D Touch yet (pre-ordered mine yesterday) so many of the things above are just guesses.

The one fear I have is that the 3D Touch edge-screen-swipe multi tasking gesture will interfere with the back navigation gesture. I sure hope I’m wrong…

Deciding on which iPhone to Buy

I bought a new iPhone today. My current one is damaged, but to be honest with you, I probably would have upgraded anyway. Here’s how I decided which iPhone to buy.

iPhone 6S

The choice was between the iPhone 6S and the iPhone 6S Plus. I have never owned a phone as large as the iPhone 6S Plus and I sometimes find even the screen size of the iPhone 6 to be too large for me.

I considered the 6S Plus because of these factors:

  • Optical Image Stabilisation for both Photos and Videos
  • Longer battery life
  • With a screen that large, it could replace my Kindle

In the end I bought an iPhone 6S because of these reasons:

  • Easier to handle single-handedly
  • More comfortable in my front pocket

The two things above I will be doing a lot of and I just don’t want to have to pay attention to how I handle the phone. The size of iPhone 6S Plus would make me be too aware of how I handle the device.

I have no doubt that the iPhone 6S Plus is a superior phone. Sometimes though, the more pragmatic choice prevails, even when it’s not a matter of cost. There are people who have to have the best, and to them I say: enjoy your iPhone 6S Plus.

Android Fragmentation – Just the way I like it

The 6th instalment of the Wellington Android Meetup took place today. I decided not to write about the content (I wouldn’t do justice to the presenters, and the audience contributed so much content, that I’d surely forget to mention something important), instead I wish to write about just how “fragmented” Android is … in Wellington, New Zealand.

Four talks

We had four speakers. Two men: Matt and Lucas; and two women: Jayna and Leonie. That was not planned, it just happened.

Matt talks about I/O

We had two fairly technical presentations that encouraged us to improve our technical chops and solve problems in more beautiful ways, and two that challenged us to think about what we like, what brings us joy, and what we are prepared to do from the goodness of our hearts.

People in the room

I glanced around the room and I was so happy to see how diverse it was. So many skin colours, genders, ethnicities, and ages!

Jayna impresses everyone with her knowledge and passion

In the room we had students, unemployed folks, business owners, developers, designers, testers, and even Windows Phone developers! There were people working for startups and people working for organisations with 500+ employees!

There were women. Not just sitting on chairs but engaging in the discussions. Driving them and asking the tough questions. Challenging the speakers and the audience. Recommending better ways to do things. As it should be!

I bring this up because I think back of where we started. I looked at some old photos I took and I struggle to find the women. I looked at the GDG Wellington reports I sent, and I blush seeing a mere two women attending one of the early sessions! Today, almost 20% of the audience were women!

Lucas in full swing

But we are not stopping here. Tonight Lucas announced that we are planning a GDG Dev Fest W.   The plan is to create a safe place for an evening, a day, or a weekend, where women can come and learn about technology without fearing that they may get laughed at, looked at in a condescending way, interrupted or ignored. Get in touch with Lucas or with myself if you want to help.

Fragmented

The Android community in Wellington is fragmented in the best possible way. This diversity makes the meetings more interesting, the points of view more diverse and more relevant.

I was the proud host of tonight’s gathering. It this kind of fragmentation that keeps me going, that motivates me to try harder, that makes me proud to be a small part of this incredible community. Our group now has more than 200 members, so I am hopeful that we have not seen the best of what this incredible bunch of people have to offer!

Thanks to everyone who attended.

Google I/O 2015 Extended Wellington

I am so proud to have helped organise what is likely to be an amazing Google I/O Extended event!

If you appreciate Google technologies, are keen to view a bunch of very interesting five minute talks, and stay up to date with Google’s announcements at I/O, and meet more like-minded people, then you should register here! Make sure you fill in the RSVP and you may take home some very attractive swag, too.

I am especially proud of my friends and colleagues Kate, Konnie, Gili, and Matt for helping coordinate this event.

Many thanks go out to the sponsors who’ve been providing support to our group: Trade Me, Powershop, Uber, and Victoria University. 

Testing is organised skepticism

You can let all the different types of software testing scare you out of your pants or you can look at the funny side of testing.

These quotes could be a starting point… I shared them with the amazing Android folks here in Wellington as part of the fourth edition of our Android Meetup.

Thanks to the lovely people at Powershop for hosting the evening, for the food, and for making this happen.

 

Thoughts on Notifications

Last Friday I was invited by the friendly people at Springload to give a talk on Push / Interactive Notifications.

The slides are targeted at Product people who are responsible with making the decision of including Push Notifications in the roadmap of their apps.

The gist of that talk is that just because you can send Push Notifications or display alerts to the user, it doesn’t mean you should. Notifications are the number one reason why people delete apps and you should keep this in mind when building your apps.

Here’s my (current) Top 10 Notification best practices:

  1. Guided “Opt In” rather than “Opt Out”
  2. Allow user to specify the types of messages they wish to receive. Support DND. Think Time Zone
  3. High volume of Notifications? Consider providing a “Snooze” custom action
  4. Only send relevant messages. This is NOT a direct marketing channel
  5. Don’t send confidential or sensitive data through push notifications
  6. Consider promoting custom actions that do not require the app to start up
  7. Use clear language and keep the message short
  8. Choose the lowest frequency of notifications that still delivers a great user experience
  9. Be aware of context. Is the user in your app right now?
  10. Consider aggregating multiple messages into a more generic “group”