Preface

A New (R)evolution in Computing

Google Glass has taken the popular imagination by storm like few other technologies have, potentially being the most transformative consumer device since the iPad…and it did so long before its commercial release. Scores of people have shown ardent interest in learning as much as they could about the mysterious machine and the ecosystem that encapsulates it, and many flocked to develop software for it in order to capitalize on its next-gen model of information delivery. Many producers of mobile services beat down the door to learn how to repurpose their existing data and codebases to establish presence for their applications in this new space.

And a significant number of people were hesitant to embrace Glass due to concerns with privacy, legality, health issues, and the personal image using it conveys.

This book effectively addresses all these issues by presenting a simple philosophy we’ve been heavily promoting to Glass enthusiasts: Think for Glass. While many forthcoming books will discuss coding conventions, design patterns, and development idioms, and will do so very well, our work presents a holistic view of Glass not only as hardware, but as a proper computing platform requiring the adoption of a new mindset for users to truly appreciate the product and with which architects can build maximum value.

Like many of you, we were captivated by our first glimpses of Google Glass in 2012. We immediately knew that Glass was going to be different, more than just a cell phone on our faces, and we wanted to help others understand how it would change our lives. In a series of Hangouts, at first, and later through presentations and helping in the various communities, we shaped our core philosophies of Glass. In this book, we hope to share those philosophies with you.

As two passionate members of the Google development community, each of us an experienced programmer, writer, and Glass enthusiast, we hope this book will serve as a primer to the device, an overview of the platform’s guiding principles, and a broad introduction to writing Glassware.

What We’re Bringing to the Table

What we need to state up front is that this isn’t just a “How to code for Google Glass” book—we wholeheartedly believe it’s much much more than that. Rather than merely copy and paste Google’s API documentation and run through the general environment for programming, testing, and distributing Glass applications, we seek to educate you with a philosophy centered on awareness of the Google Glass ecosystem—getting you to Think for Glass. By this merit, you’ll have a better understanding about the approach necessary to get the most out of this revolutionary new computing platform.

We’ll be looking at what Glass means for users, developers, and society as a whole.

This book is organized to be flexible to your interests while still presenting the material in a logical fashion to teach you all about Glass. We’ve essentially organized the material as a three-act play. While some of the more technical sections build upon concepts that preceded them in earlier chapters, the topics are largely arranged in such a way that they can be consumed completely out of order without losing focus, giving you the freedom to jump to the discussion that intrigues you most, or skip over stuff that doesn’t pique your interest. New Glass owners (or those of you contemplating taking the leap) will particularly enjoy the first few chapters, which deal with how to properly Discover the platform.

Maybe you just want to be one of the cool kids and talk to your peers with deep expertise about what Glass is and how they can use it. Living on the bleeding edge is totally awesome, and we’ve written Chapter 2 just for that reason.

If you’re a designer who wants to create for the hottest UI to hit the consumer tech industry in years, you’ll want to make sure you read the Design section. We’ll be talking about the Glass aesthetic and how to compose effective designs that maximize data in a minimal display, how the experience is fundamentally different than designing for other platforms, and what we mean when we say you should “Think for Glass.” Before you dive into code, you’ll want to consider Chapters 4 through 6 to make sure that what you want to do works well with the people who use Glass.

If you’re a programmer who’s heard the buzz about wearable computing, you’ll then want to continue to the third part of the book, Develop. In this section, it may behoove you to read Chapters 7 through 15 in order, as several of the concepts we’re presenting have a certain sequence. We begin that ambitious quest in Chapter 7, where we drill down into program structure, syntax, and the architecture that governs how RESTful Glassware works with the Google Mirror API. We also help those of you maintaining existing software platforms if you’re keen on integrating with Glass to get a leg up on the other guys. If you’re an Android developer, and you’re interested in exploring the similarities and differences when programming for Glass with Android framework code, head on over to Chapter 13 where we talk about the Glass Development Kit.

Or if you’ve been itching to create a slick mashup with some third-party web APIs and want to corner a very emerging space, we’ve got you covered, too—check out the latter chapters for insight.

And simply starting from page 1 and running through the entire book will give you a well-rounded Glass education in order to understand the Glass ecosystem and build effective Glassware. Being able to Think for Glass means that you have to understand the system in total. You’ll truly grasp what the system is all about and how to best make it work for you once you’re done reading.

And at the end of the book, we’ve included a helpful appendix that focuses on hacking Glass. We also feature “Glassware Done Right,” a series of case studies that highlight noteworthy third-party services and applications that are top-shelf examples of programs written specifically for the Glass experience that really get the job done. Some are simple, some are complex, but they’re all outstanding and all really fun to use, with each illustrating a positive lesson to follow about how to implement a specific software idea or challenge with this new model.

What we want to avoid at all costs is presenting you with content that just lets you rip code and not really comprehend what the Glass experience truly is. We don’t want to give rise to a generation of sloppily crafted apps that wind up being force-fit versions of existing services that don’t fully utilize the best aspects of the platform the way they were intended. Glass succeeds beautifully on both sides of the product development coin—form and function—so having mastery of this new toolset is critical.

As you’ll see, Glass isn’t purely another client-server web system or just the latest fork of Android. The input system, UI/UX, networking capabilities, and application framework—it’s an entirely different animal than what you’ve been used to. Everything about the ecosystem is a radical departure from traditional methods of distributed computing. A new paradigm requires a new mindset—and that’s precisely what we’re giving you. Even experienced developers should appreciate the effective simplicity of Glass’s mechanics for data delivery. This personal area network of sensors and displays provide the wearer with the information they want in exactly a form that’s extremely convenient, contextually relevant, and highly effective for them as they go about their day with their digital lifestyle, as well as doing things in the real world.

We feel that empowering you with the ability to explain, explore, and exploit Glass, confidently and competently, is invaluable because then you can teach others, too! Pay it forward, baby. Spread the gospel. Share the love.

Maybe you can charge people for your expertise as a Glass consultant and recoup your investment for buying this book. Viva capitalism!

How This Book is Organized

Discover

Chapter 1, The Revolution Will Be Wearable

We explore the fundamental question, “Why Glass?” What is Google trying to solve by creating the product, and why do they think people will want to buy it? What underlying technologies are going into it? What is new or different about Glass, and what is the same as what we have seen before? Why is this book a good way to learn all these things? Most importantly, we set the groundwork for the three major sections of the book that follow and start to guide the different types of readers into which parts might be most interesting.

Chapter 2, The Glass Ecosystem: What It Is and How It Is Different

This chapter is the core of educating people to what Glass currently is and the foundation for exploring how Glass apps should be designed. We go over the specifications of Glass. We highlight why the hardware represents a balance between user needs, aesthetics, and design constraints. In particular, we will focus on how this is a product unto itself—not a peripheral or accessory to something else. In conjunction with the hardware, we start to delve into how people use Glass, the timeline, and the software driving it.

Chapter 3, Societal Issues with Glass and How to Avoid Them in Your Projects

It is important, in both educating people about how to use Glass and what to expect from Glass applications, to make sure we are clear about what Glass isn’t and what it can’t do…yet. Although we will go into detail about this as part of designing and developing apps, it is important to take some time out and discuss false impressions that have already built up. In particular, we will discuss some of the controversial issues surrounding Glass—privacy, control, intrusiveness, aesthetics, and whether this is true augmented reality.

Design

Chapter 4, Thinking for Glass: How Glass Is, and Should Be, Personal

We dive into the meat of the aesthetic philosophy for Glass. Much like the change in thinking that took place when people moved from text to graphic programs, then later to web design, and still later when moving from web to mobile apps, writing for Glass requires a totally new way of thinking. Glass is, in some ways, more personal and intimate than a smartphone, and people will be interacting with Glass very differently. Where existing examples do not exist, we will hypothesize other illustrative apps, showing how they can (or in some cases can’t) have counterparts in Glass and how they needed to be rethought.

Chapter 5, The Five Noble Truths of Great Glassware Design

We solidify the design for Glass with The Five Noble Truths, based on the initial guidelines presented by Google, and how they were ultimately expanded. Each of these guidelines will be complete with good and bad design examples that follow the guidelines.

Chapter 6, Glassware Antipatterns: Avoiding Poor Design

The natural inclination of people will be to think about developing for Glass as either being “just like” developing for other mobile platforms, or expect it to be tied to a mobile device. We’ll discuss why these perceptions may cause problems. We’ll also reiterate some of the design constraints in the system and how it constrains some of the applications that are available.

Develop

Chapter 7, Overview of the Mirror API

We present the prerequisites for developing for Glass using the RESTful Google Mirror API. We will also discuss how the Mirror API is language-agnostic but requires an understanding of how to build and host web apps. We’ll touch on Google App Engine as a container while emphasizing other available options. Finally, we’ll discuss the infrastructure for how Glass will communicate with your app and how we will present each of the concepts.

We talk about concepts, with a couple of language-specific code examples in some cases, and make sure people understand how those concepts will map to the Google-provided documentation and the language-specific APIs. Think of this entire section as providing a way to help you translate between Google’s documentation and your language experience.

Chapter 8, Security and OAuth

We talk about how to authenticate users with OAuth 2.0 and authorize services to communicate with Glass on their behalf.

Chapter 9, Working with Timeline Cards

The fundamental UI aspect of Glass is the timeline card, which we’ll have seen illustrated in earlier chapters. We’ll now learn more details about these cards, how they are bundled together, how Google helps you manage them, and how you can format them. Some of the tools that Google provides to help design them will also be reviewed, along with the various parameters and procedures involved in creating, editing, and deleting them.

Chapter 10, Card Actions and Subscriptions

It wouldn’t be a very interesting program if it couldn’t handle input from users. We’ll discuss how cards can have actions attached to them and how your program needs to define what actions are available, accept these actions, and verify that they are authentic responses to your cards.

Chapter 11, Sharing Resources with Glassware

Beyond attaching actions to your own cards, you can also allow photos, videos, and other resources captured through Glass to be shared with your application. We’ll discuss how you need to handle this data and what Google does to help you with it.

Chapter 12, Context Is King: Using Location and Other Signals

The curious topic of the use of geodata within the Glass ecosystem will be detailed here, alongside other forms of input for contextual computing, like identity, time, and activities. Particular attention will be given to the way Glass handles location data updates via the Mirror API.

Chapter 13, The GDK

We provide an overview of the SDK libraries that constitute the Glass Development Kit that makes writing Android framework code possible, giving Android programmers the ability to create installed applications for Glass.

Chapter 14, Getting on MyGlass: Glassware Submission, Review, and Distribution

Getting seen on MyGlass should be the destination you aim for after building an amazing product, as it yields the greatest rewards. You’ll learn how to prepare for Google’s review of your projects, how to be approved quickly, and then how to distribute and promote your Glassware to the masses.

Chapter 15, Reflections on the Future

This discussion addresses some more advanced topics and issues relative to the progression of the platform, how Glass might be used from an organizational standpoint, and how the Glass ecosystem can be extended.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This element indicates a warning or caution.

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/design_develop_glass.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

We’d like to thank O’Reilly Media for picking up the project and believing in us and our concept for a book to help educate, inspire, and motivate people to get involved with this exciting new movement. Mike Hendricksen and Rachel Roumeliotis have been incredibly gracious, informative, patient, and available throughout. The Glass team at Google[x] and several Googler friends of ours have also gone above and beyond with guidance and motivation, so a tip of the cap to Jonathan Beri, Angela Chien, Timothy Jordan, Jenny Tong, Sarah Price, Dori Storbeck, Alain Vongsouvanh, Natalie Villalobos, and Teresa Zazenski for their input and constant nudging-on to make this community contribution a reality.

And even though we mention them and their work more than a few times, we’d like to especially recognize our friends and fellow Glass early adopters—those endlessly talented people that have been part of this unforgettable experience with us from Day 1, producing Hangout shows and media appearances, coding Glassware, leading discussions in community groups, organizing meetups, writing about Glass, being critical of the platform, and sharing our interest in making it a success. Thanks to Cecilia Abadie, Keith Achorn, Noble Ackerson, Libby Chang, Ethan Bresnick, Mike DiGiovanni, Katy Kasmai, Israel Knight, Dan McLaughlin, Gerwin Sturm, Daniel Ward, Andrew Pritykin, Abraham Williams, the members of UbiTech NYC, and all the Glass Explorers from all over whose diverse contributions to our community are outweighed only by their boundless passion for Glass.

They continually lent their vast knowledge and experiences to this book’s production, so we’re eternally grateful for having kindred spirits whose insight and enthusiasm matched our own, and who so readily shared it with us.

— Allen and Jason

My special thanks to Jason, my coauthor, collaborator, benevolent taskmaster, and friend, for his work in getting the book off the ground and for serving as the sounding board for all of my design ideas. It has been my honor to work with you, and I look forward to the day when we can meet in the same time zone.

— Allen Firstenberg

I also thank my coauthor and friend for collaborating with me on this book from half a world away and for providing the vision throughout its production. While I came up with the idea on a whim during a Hangout that we write a book about Google Glass, Allen supplied the creative direction. I may have raised the sail, but he steered the ship. It’s been an absolute blast working with you, partner!

— Jason Salas

About the Authors

image with no caption

By day, Allen Firstenberg is a Senior Project Engineer at Objective Consulting where he has been instrumental in creating websites and mobile apps for companies and organizations from the American Booksellers Association to the National Science Foundation. By night he dons his super-coder cloak and creates tools, software, and tutorials to help people share their stories and improve their digital lives.

Allen is a Google Developer Expert, recognized by Google as one of the leaders in the developer community for Google+ and Google Glass, and is a Glass Explorer and Pioneer, having attended the New York Glass Foundry event run by Google in early 2013. Appearing on the YouTube shows Our Android Week and Google Plus Week (which he cohosts), he is one of the first to heap praise on good ideas, one of the most brutal in criticizing problems, and is relentlessly focused on helping people understand the grand vision. In the early days of the World Wide Web, he created one of the first collaborative websites, Addventure, in an effort to push the boundaries and explore what could be done with the new media that was beginning to evolve.

Allen holds a BS in Computer Science from Rensselaer Polytechnic Institute.

He was inspired to join the Glass Explorers program when he realized how intimate and personal Glass would be, yet at the same time be inherently social. His goal is to help people find the experiences with Glass that can be done by nothing else on the market today, to watch people look at each other as they discover new ways to play games together with Glass, and to watch (and record) his son’s face as the two of them roll in laughter during a tickle fight.

Allen is on Google+ and LinkedIn. He blogs about life and other four-letter words at iaflw.com.

image with no caption

A software developer, marketer, broadcaster, sportswriter, and filmmaker, Jason Salas enjoys perpetual summer living on the island of Guam. He fell in love with the Web the moment he first got online in 1994, seeing it as the world’s biggest toy, and began helping people embrace the Internet before shifting his focus to content development and ultimately to designing data-driven systems. In the last few years he’s been concentrating on Google Glass, Android Wear, Hangout extensions, HTML5 games, and Chromecast apps. Since 1999 he’s worked at KUAM News, where he runs the company’s R&D group and also co-anchors the nightly news (no, really).

Jason was twice named a Microsoft MVP for his involvement with the ASP.NET community, is a four-time winner of the Edward R. Murrow Award for cutting-edge web development in the news industry, and is constantly interacting in Google+ Communities for Glass users and developers. He’s served as technical editor for a book on Microsoft Hailstorm, has written for .NET Magazine, MSDN, and Wrox, and authored an ebook about the trials and tribulations of a semipro football league. He holds a bachelor’s degree in marketing from the University of Guam and an MBA with emphasis in technology management from the University of Phoenix. He’s also an adjunct professor of MIS and business at the University of Guam and a member of the Football Writers Association of America.

He wants to make good on his public promise to be the first man on the planet to do three distinct things with Glass: host a Hangout On Air from Epcot Center, call play-by-play for a game while broadcasting his POV video to give viewers a behind-the-scenes look at a live sports production, and direct a stage version of Hamlet with all actors performing the tragedy of the troubled Prince of Denmark through their own first-person perspectives.

Jason is online at jasonsalas.com.

Get Designing and Developing for Google Glass now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.