Debating Storyboards vs. Nibs vs. Code
In Storyboards vs. NIBs vs. Code: The Great Debate!, you can watch a debate that took place in a Google+ hangout on October 1 between three developers over which way is the optimal way to build user interfaces. Cesare Rocchi argues for code, Tammy Coron takes the pro-nib argument, and Felipe Laso Marsetti sides with Storyboards, which Apple seems to be pushing hard. It’s interesting lunchtime viewing:
Building a Space Invaders-like Game with Sprite Kit, Part 1
Here’s part one of a Ray Wenderlich tutorial that walks you through the process of building a classic arcade game (all the way back from 1978) in iOS 7 using the new Sprite Kit library. They recommend that you go through their Sprite Kit Tutorial for Beginners before you tackle this tutorial, which walks you through controlling player and enemy ship movements.
Key-Value Observing
Key-value observing is handy. It’s also a pain in the ass. Or, as NSHipster Mattt Thompson puts it:
“Ask anyone who’s been around the NSBlock a few times: Key-Value Observing has the worst API in all of Cocoa. It’s awkward, verbose, and confusing. And worst of all, its terrible API belies one of the most compelling features of the framework.”
Key-value observing is one of those “let me know when something happens” systems that you can use in Objective-C, along with NSNotification
s, delegates, and callbacks. Thompson says that of the four, key-value observing is the least understood. He aims to fix that by sharing some observations and techniques that have worked for him.
The ZXingObjC Barcode Library
ZXing is short for “Zebra Crossing”, which is a pretty clever name for an Android/Java barcode encoding/decoding library. ZXingObjC is a full Objective-C port of ZXing, and it’s available on GitHub. If you need to encode or decode any of the following barcode formats on an iOS device or Mac:
- UPC-A and UPC-E
- EAN-8 and EAN-13
- Code 39
- Code 93
- Code 128
- ITF
- Codabar
- RSS-14 (all variants)
- QR Code
- Data Matrix
- Aztec (there’s “beta”-level support for this)
- PDF 417 (there’s “alpha”-level support for this)
…then you’ll want to get your paws on ZXingObjC. The library comes with example apps, including a basic barcode scanner/decoder app and another app that accepts user input and turns it into a QR code. Keep in mind that…
I may have given the impression that I’m only about iOS development, but Android development is also in my sights as well. One of the reasons I picked up a Samsung Galaxy S III last year was to get learn how to write Android apps, an undertaking that’s been delayed by life, work, and all sorts of nonsense from which I expect to free myself really soon.
I recently got around to setting up my systems for Android development, with a Lenovo laptop computer running Windows 8 as the development machine, and my S III as the testing device. I took screenshots along the way, and have put together this little bit of documentation in the hope that someone out there will find it useful.
Part 1: Install Samsung’s Android USB Drivers for Windows
If you’re using Windows to develop Android apps and plan to use Samsung devices while developing, the first thing you should do is get the installer for Samsung’s Android USB drivers for Windows. Point your browser at the charmingly misspelled Samsung “Andorid” USB Driver for Windows page:
Download the SAMSUNG_USB_Driver_for_Mobile_Phones.zip and unzip it. Run the enclosed installer; you should see this:
Click Next:
Choose the appropriate language and country for you. I went with the plain and simple “US English / United States of America”, then click Next. You’ll see this:
In most cases, the default installation location of C:\Program Files\SAMSUNG\USB Drivers should work. Click Install to start the installation process, where you’ll see…
…which will then be followed by…
Click Exit, and the first part of the Android development setup will be done.
To confirm that the driver works, connect your device to your computer via USB…
…then get a look at File Explorer to see if your device appears as another location on “My Computer” on Windows 7 and earlier systems, or on Windows 8 and later systems, “This PC”. Here’s what my Galaxy S III looks like in File Explorer:
Part 2: Turn on Developer Options on Your Device
In order to push apps to your device during development, you need to turn on developer options on your device, which you do by going to Settings. Once you’re in Settings, scroll down toward the bottom until you see the Developer options item:
Tap Developer options. You’ll be taken to the Developer options screen:
Move the Developer options switch to the on position, then check the USB debugging option. You might also want to check Allow mock locations; see this article for more details.
Part 3: Install Oracle’s Java SE Development Kit
Now that the drivers have been installed and your device is set up, it’s time to install a JDK. Go to the Java SE Development Kit Downloads page:
Scroll down to the Java SE Development Kit 7u40 table, where the JDKs for supported platforms are listed:
In order download the Java SE Development Kit, you have to sell your soul to Oracle and accept Larry Ellison as your Dark Master. Do this by clicking the Accept License Agreement radio button. The table’s appearance will change slightly…
…after which you can choose the JDK to download. I’m running the 64-bit version of Windows 8.1 RC (I like to live a little dangerously), so I downloaded the Windows x64 installer.
Once the installer is downloaded, run it. You should see this window:
Click Next:
The default setting, which installs all the development tools and source code, is good one. Just go with it and click Next. Installation will begin you’ll see this:
After which you’ll see this:
The installation process is now complete; click the Close button.
Java is now installed on your system, but your system doesn’t necessarily know where to find Java. It’s time to edit the Path environment variable. Go to explorer and right-click on the This PC icon (on pre-8.1 Windows systems, it’s called Computer, and on Windows 7 and earlier, it’s My Computer), and select the Properties item from the menu that appears:
This window (or one similar to it) will appear:
In the list of items along the left side of the window, click on Advanced system settings. You’ll be shown the System Properties dialog box:
Click the Environment Variables… button, and you’ll be shown the Environment Variables dialog box:
We want to edit your system’s Path variable, so select the Path item in the System variables list and click the Edit… button
We want to add C:\Program Files\Java\jre7\bin to Path. Do this by adding the following to the end of the contents of the Variable value text field:
;C:\Program Files\Java\jre7\bin
Click OK, which will take you back to the Environment Variables window:
At this point, you can dismiss all the other windows that you opened in the process of setting the Path variable.
There’s only one more application to retrieve…
Part 4: Install ADT — Android Developer Tools
Go to the Get the Android SDK page:
Click on the Download the SDK button, which will take you to this page:
Check the I have read and agree with the above terms and conditions checkbox, which declares your soul the property of Larry and Sergei forever, and then:
- If you downloaded and installed the 32-bit (x86) version of the Java development kit, choose the 32-bit version of ADT.
- If you downloaded and installed the 64-bit (x64) version of the Java development kit, choose the 64-bit version of ADT.
Make sure you’ve chosen the correct version of ADT; the 32-bit ADT will not work with 64-bit Java, and the 64-bit version of ADT will not work with 32-bit Java!
Click the Download the SDK ADT Bundle for Windows button, which will start the download process of a .zip file. The .zip file I got had the filename adt-bundle-windows-x86_64-20130917.zip; yours should have a similar one. The .zip file will contain a single folder with the same name as the .zip file, minus the .zip filename extension:
Unlike most Windows applications, ADT doesn’t have to be installed using an installer. You simply unzip it, and it’s ready to run. I renamed my ADT folder to simply just ADT and put it into the Program Files directory. You don’t have to do this, but it keeps things consistent.
Part 5: Confirm Everything Works By Building “Hello World”
You’ll be using the Eclipse IDE to write and compile Android apps. Eclipse is in the ADT folder’s eclipse directory:
Open the eclipse directory and double-click eclipse.exe to start Eclipse:
You’ll see this splash screen:
Followed by this dialog box, asking where your Android projects should be stored. I went with the default, which is typically \Users\your login name\workspace:
I checked Use this as the default and do not ask again and then clicked OK, after which this was displayed:
Once ADT has fully loaded, you should see a window that looks like this:
Let’s build a quick and dirty application. Click the New Android Application… button that appears below the “Welcome!” message. This will open the New Android Application dialog box:
Enter Hello World into the Application Name text box. The Project Name and Package Name text boxes will fill themselves in appropriately as you type. Then click the Next button. You’ll be taken to the next step:
The defaults work for what we want to do, so just click the Next button. You’ll be taken to this window:
This window lets you define the icon for your app. The default “Android” icon works just fine, so click Next. You’ll be taken to this window:
The simplest way to describe an Android activity is “a ‘screen’ presented to the user”. Android developers who are a little more pedantic might disagree, but for now, it’s a good enough explanation. Make sure that Create Activity is checked and that Blank Activity is selected in the list, then click the Next button. You’ll be led to one more setup window:
For the purposes of this quick-and-dirty app, the defaults are fine. Click the Finish button to conclude this setting-up phase, and you’ll be taken to the ADT IDE’s main window:
If you haven’t done so already, connect your Android mobile device to the computer with a USB cable.
Let’s run our newly-created app to see if it works. from the menu bar, open the Run menu and choose the Run item:
You’ll be shown this window:
Make sure Android Application is selected, then click the OK button. You’ll be taken to the Android Device Chooser:
With my Samsung Galaxy S III plugged in, it showed up in the Choose a running Android device list as samsung-sgh_i747m-4908d022. If you successfully installed the drivers for your device, it should appear in the list. Select your device and click the OK button. If everything’s working, you should see the following on your device’s screen after a moment or two:
Success! You’ve now got a working Android developer setup.
The Toronto chapter of Tech in Motion, the meetup run by the Toronto branch of the recruiting firm Jobspring, takes place tonight at 6:30 at The Burroughes Building (639 Queen Street West, just east of Bathurst).
Tonight’s Tech in Motion theme is “Collaborative Living Demo Night”, which is all about collaborative living and working. Tonight’s presentations will be given by:
They’re holding the event in The Burroughes’ very nice event space and providing food and drink as well. If I were in Toronto tonight, I’d have added this to my social calendar.
Back in July, I wrote about Jennifer Dewalt’s project to learn programming by building 180 sites in 180 days. As of today, October 3, 2013, she’s done just that, and written a blog post titled After 180 Websites, I’m Ready to Start the Rest of My Life as a Coder.
About her progress, she writes:
I started by making very simple websites with just a little bit of CSS andJavaScript. Soon I was playing with complex CSS animations. By day 37, I was digging into js by exploring the <canvas> element. On day 69, I made my first Rails website which opened the door to building sites that allow people tocommunicate with each other. On day 119, I made my first Backbone app, though I’ll admit I was pretty confused the whole time. By the end of the project I made everything from games to toys to tools. I tapped into external data using API’s from companies like Instagram and Twitter and I built real-time dynamic communication apps using Node.js.
Her approach:
One of the most important mantras for me has been “Start Small. Keep Building.”
…
Tackling small goals gave me small, solvable problems which led to new small goals and more small, solvable problems. Eventually, after I solved enough small problems my conception of a small problem changed. A small problem for me on day 100, for example, is much more complex than a small problem on day 1. Bit by bit I inched toward being able to make dynamic websites.
What’s next:
Keep coding! The end of my 180 websites in 180 days project marks the beginning of the rest of my life as a coder. The project certainly hasn’t given me a comprehensive understanding of software development, but it has laid a broad foundation for me to jump off of. I plan to work on a couple of more complex websites that take more than a day to complete. Doing some larger websites will allow me to fill in the gaps in what I learned through this process. After I feel like I’ve filled in the gaps a bit, I’d like to work with a smallish team of passionate people who are equally interested in making awesome stuff happen.
Jennifer’s example is inspiring. I know a lot of people who, when trying to learn a new language or technology, try to master every last nuance of it before building anything substantial, and their efforts often end up for naught. I like Jennifer’s approach of learning by doing and following the mantra of “consistency beats intensity” much better. We’d all do well to borrow that trick from her.
Congratulations, Jennifer, and best of luck as you continue the journey!
Justin’s Been Hired!
Justin, back when he was looking for work.
A little less than a month ago, I posted an article titled Hire Justin Kozuch! and pointed you to his page. I’m happy to report that he has been hired by Kanetix, and yesterday was his first day at the new job. He tells all on his blog.
Congrats, Justin!