Windows 8 Book written in 8 weeks

It’s been a while since I’ve updated the blog.  Several things have happened.  On July 1st, I received notification that I was renewed as a Microsoft MVP for 2012.

This made me very happy since I also had just signed a contract with Sams publishing (Pearson) to write a third book for them, and I figure this would mean early access to the Windows 8 bits through a MSDN subscription.  To me, that subscription is the second best perk of being a Microsoft MVP.  The best perk is being able to talk to the product teams and to see conversations by folks that are much smarter than I.

My first two books were on game development using XNA.  This third book is about creating Windows 8 apps.  I signed the contract the last week of June with the plans of writing the first chapter on July 1.  

Around the same time I was invited to participate in an App Excellence lab.  For some reason I thought it was more of a Dev Camp setting.  The lab is really for for folks who have an app that is at least 80% done and are wanting to put the app in the Windows Store.  The dev camps are a full day (or 2) of learning about what makes a Windows Modern UI style app and what is needed to put the app in the Windows Store.  I found out the day before that what I was attending was the “80% app done lab” and not the “training / work day with experts lab”.  So I apologized to the field engineer and we discussed the app and I got some good pointers about the app in particular.

image

My original idea was to create a version of the app for the book and then finish it up to submit it to the store.  I realized the concept of the app was too complex for the book.  There would be too much time spent on explaining the app instead of the technology behind the app.  So going through that exercise allowed me to have my first failure within the first week.

I created my Table of Contents (TOC) and spent that first week (before July 1) mocking up 3 apps.  Two of the apps mocked up I would use in the book.  The third was a good exercise, but proved to not be the right game for the book.  The idea was to create two apps and one games as a “Putting what was learned it into practice” section of the book.  In fact, here is the table of contents in its current state.  Perhaps some of the words will change a little, but this is what we have:

Part I: Building the Foundation
1    Getting a Refresher on JavaScript, HTML5, and CSS3
2    Trying out File | New | Project
3    Exploring the Windows Runtime (WinRT) and Windows Library for JavaScript (WinJS)
4    Creating WinJS Namespaces, Classes and Custom Controls
5    Understanding Microsoft Design Style Principles
6    Customizing the Style of our Apps
7    Debugging, Securing, and Measuring our Apps Performance
Part II: Handling the Hardware
8    Working with Multi-touch and Other Input
9    Working with Location and Hardware Sensors
Part III: Working with Data
10    Binding Data to Our Apps
11    Storing Data Locally
12    Using Remote Data
Part IV: Making it a Windows Store App
13    Working with Fullscreen, Filled, Snapped, and Portrait Views
14    Using the App Bar and Pickers
15    Handling Our App Life Cycle Events
16    Using Contracts and Extensions 
17    Using Live Tiles, Secondary Tiles, Notifications, and Toasts
18    Creating a Trial and Handling In App Purchases
Part V: Putting it into Practice
19    Making an App: RSS Aggregator
20    Making an App: Finger Painting
21    Making a Game: Simon
Part VI: Sending it out to the world
22    Understanding the Windows Store
23    Getting an App Certified
24    Making Money with Windows Store Apps
Part VII: Appendix
         This Book’s Website

Yeah, this book is about JavaScript development and not C# which has been my bread and butter for the last 12 years.  I started working with JavaScript excessively around April this year and  have really come to enjoy the language.  Something I would have never thought back in 1996 when I first used it.  Visual Studio tooling could be better, but it is much better than was in the past.

The table of contents went through a few iterations but not many changes overall.  It is currently being reviewed by the technical editor.  Once I get notes I’ll make modifications and then it will go on to editing (for thing like, gramar, and, speeling, altho I’m a very goood speeler, and, gramarist person).

Writing a book in 8 weeks is challenging.  I did the same thing for my first book on XNA.  Writing a book in 8 weeks and working full-time provides very little time for anything else.  On the flip side, with my second book, I gave myself 6 months of time, plus it was an update to the existing XNA book.  I figured that would be a breeze, but that was a long 6 months.

The 2 month approach wreaks havoc on my family though.  I thought I’d have a better handle on writing  it this time around but I got behind on my schedule after about the 3rd week and was in catch up mode ever since.  That means the last 5 weeks, out of the 8, I was in my “worst case scenario” phase of not going to bed some nights and neglecting time I had set aside for my family.

End result?  The book content is done and the deadline was hit.  My daughters haven’t suffered too much but my poor wife has had to really pick up the slack.  We homeschool our girls, so my doing the book from June 26th to August 27th caused my wife to not really get much of a summer break.

image I kept track of my time for this book and I spent 695.2 hours researching and creating content. Ouch.  Fortunately, the main content of the book is done and now I’m just waiting the for the technical editor to come back.  I’m also going through and updating the first chapters to work with RTM as all the code (and screenshots) were originally done on Windows 8 RP.  I downloaded RTM on the 15th and installed it on Thursday night (16th) while attending my local .NET User Group where Brian Hitney and Glen Gordon talked about Windows 8.  Their boss, Brett Wolfe was also there and I was able to schedule another App Excellence lab.  This time I was prepared and had 2 apps to choose from.  We got it scheduled for Tuesday morning, the 21st.  It passed and, just like Jennifer Marsman, I got a Windows Store token.  This was extremely beneficial as it allowed me to grab screenshots of the Windows Store and submitting apps which was crucial since I had an entire chapter devoted to it.  So I’m very grateful that Brett hooked me up with another timeslot.

One obstacle I ran into was not having Windows 8 hardware.  I didn’t attend Build 2011 so I didn’t get one of the nice Samsung Series 7 tablets.  I had purchased an ASUS EP121 in June of that year and have enjoyed using it.  I installed Windows 8 Consumer Preview on it in March and really enjoyed using it.  I then also installed Windows 8 CP on my desktop and only used Windows 8 on those machines.  I was booting to Windows 8 CP on a VHD on my Windows 7 desktop, but I never went back to load Windows 7.  That will change this week as I’ll boot into Windows 7 so I can do an upgrade to the final version of Windows 8. 

Anyway, back to my tablet … I used the ASUS EP121 in order to test my code around touch.  Unfortunately, the device only supports two touch points.  During the App Excellence lab, the Microsoft Field Engineer confirmed that the app was working as expected when 8 fingers were being used.  Writing code for the GPS is no problem even for devices that don’t have a GPS so that was no problem.  But the new accelerometer, magnetometer and gyrometer hardware that will be in all Windows 8 tablet and convertible PCs is something I needed to provide examples on.  The Sensor Fusion software that takes those three hardware pieces and provides results is pretty cool.

image

Unfortunately, my ASUS EP121 hardware didn’t support it.  I went purchased a STMicroelectronics Micro-Electro-Mechanical-System (MEMS) which is the piece of hardware that is in the Samsung devices and will be shipping in many of the upcoming devices.  Paying $140 for that was a lot better than shelling out a grand or so on a device that I would loath after October and November gets here and all the new devices start coming out.  Plus, I was able to snag a seat at the Build 2012 conference coming at the end of October.  I’m hoping there will be some hardware goodness there.

Getting information on the Windows Store and the hardware were the only two problems I had with creating the book (other than running into bugs as I was creating the examples and learning the technology, of course).  This book is an introduction to Windows Store app development in the Sams Teach Yourself series.  It was hard for me to not spend time drilling down into topics as much as I did with my XNA books.  When dealing with a framework like the XNA Framework, there is only so much surface area that needs to be discussed so there is some wiggle room to dig down deep on a topic and even spend a chapter or two discussing non XNA related, but game related content like physics and artificial intelligence.  However, when talking about Windows 8 – that is a HUGE amount of API that can be covered with multiple ways of doing the exact same thing.  How does one determine what is included in a book with limited pages and what is not?  Making those decisions was challenging, but I tried to just stick the items that would be most common to folks starting out and needing to get an app or a game created quickly.

The other challenge was that I wanted to have one of the three main example apps be a game.  Game development can be difficult.  How does one teach game development in a single chapter?  It can’t be done, but what can be done is to introduce the topics such as the game loop and game states as well as introduce other game type of items all throughout the book like working with the HTML5 canvas and using the requestAnimationFrame API.  One of the apps created was a finger painting app.  Even though it is an app and not a game, it has certain properties of a game where the screen needs to be drawn at the refresh rate of the display and separating out the update logic (receiving input from fingers, stylus/pen and mouse) and the drawing logic (of actually drawing lines on the screen based on the touch points).

In another post, I’ll list all of the examples discussed in the book, like the Ink example which uses hand writing recognition, and the three (mostly) complete apps, one of which is a game.  I’ll be submitting those three apps to the store in the next few weeks.  All of the source code for this book will be put on GitHub once the editing process is complete and the book is sent off to the printers.

So while writing the book was a strain on my family I am still happy I did it.  My wife would most likely disagree but she was and is supportive of my efforts.  I think if I did another one, I’d like to have 3 months to do it.  6 months is too long, but 2 months is too short.  I have the ability to focus on something and push through until it is done, but the down side is that I tend shut out almost everything else as I focus on the task at hand.  It is the only way I know of how to get something done when it is very unlikely to get done.

I’m unsure of what the release date of the book will be at this point, but it should be out before general availability of Windows 8.  So writing a Windows 8 book in 8 weeks was challenging, I learned a lot and realized I could write another 2 or 3 books on the subject.  Could, but won’t … at least not for a while … and not in a 2 month period.

Up next, I’ll be putting the finishing touches on the three apps created in the book and submit them to the store.  Then I’ll start work on the next 7 apps.  All of these will be released through my company GlobalCove Technologies.  After the first batch of apps are submitted and before I start work on the next 7, I’ll be redesigning the website to better align with the company’s new focus of Windows 8 app and game development.  While the company will still do training and provide consulting services our main focus will be creating apps for the Windows Store.

If you are contemplating writing an app for the Windows Store, don’t delay.  Don’t put it off.  Get it done.  Some of the first apps will have great success as in millions of dollars success.  Don’t miss out.

Happy Coding,

-Chad

Tell me what you think!