Category Archives: iPad

An MVC4, iOS And Android App With ServiceStack, Xamarin and C#

A bit late getting this out, but I published a new course for Pluralsight.

An MVC4, iOS And Android App With ServiceStack, Xamarin and C#

This course was really fun to create.  I got to use several of my favorite technologies.

2013 08 19 16 52 05 thumb An MVC4, iOS And Android App With ServiceStack, Xamarin and C#

Here is the course description:

It can be very difficult to build a cross platform application that will work on the web as well as popular mobile platforms like Android and iOS.

In this course, I’ll take you through the complete process of creating an application that works on each of the platforms and uses a REST based backend API to share data and business logic—all using C#.

We’ll start off this course by learning how to build a REST based API using the popular open source framework ServiceStack. I’ll show you how easy it is to get ServiceStack set up and even how to store data for the API using a Redis database.

Next, I’ll show you how to create an ASP.NET MVC 4 application that uses the REST service we built to display it’s data and implement it’s logic. We’ll learn how to use JQuery to make AJAX calls to a REST based API from within our MVC 4 application.

Then, we’ll learn how we can use C# and the .NET framework to build an Android application using the Xamarin tools. We’ll use the same REST API, we created earlier and build a real native Android application that is able to consume that API for implementing its logic and displaying data.

Finally, I’ll show you how to do the same thing for an iOS application. We’ll again use C# to build a real native iOS application with the Xamarin tools and learn how to consume REST based web services from iOS.

So, if you are a C# developer and don’t want to have to learn several other programming languages to build cross platform applications; you’ll definitely want to check out this course. By the end of this course, you’ll have the skills you need to be able to implement an end-to-end cross platform solution complete with a REST based API backend all in C#.

Why My Kid is an iKid

Sophia got her first introduction to the iPad at about 3 months old.

As soon as she could sit in a rocker chair my wife and I let her start playing on the iPad. 

002 thumb Why My Kid is an iKid

We started off with just one game, Interactive Alphabet by Piikea.  It is basically a game that goes through the Alphabet and lets the baby interact with some of the pictures.

We added a few more ABC type of games as she got a bit older, but we mainly just let her play with that one game, because we figured it would be great to let her start seeing letters and learning the alphabet as early as possible.

Right from the get-go she would swat at the screen.  She didn’t immediately understand the cause and effect, but she quickly grasped the idea that when she hit the screen, something would happen.

After a while she became pretty good at being able to do the simple things in the ABC game.  She would still swat the screen, but purposefully swat certain areas in order to do something like build a sandcastle.

Around 12 months, we started adding a bunch more apps.  We added some interactive books and a couple of simple games.

img 4492 thumb Why My Kid is an iKid

Sophia was learning how to do many more things in the apps.  She could point with a couple of fingers and very purposefully touch certain areas of the screen. 

She really didn’t have any concept of touching and dragging though, and would often run into problems of having one hand leaning on the iPad which was causing the other hand’s touches not to register.

She’s now 18 months and she is an iPad master.

img 6639 thumb Why My Kid is an iKid

Sophia can now:

  • Turn on the iPad
  • Unlock the iPad
  • Pick which app she wants to play out of her folders
  • Use the home button to exit an app
  • Double press the home button to switch to a recent app
  • Navigate through menus in apps and get back to the app
  • Use the table of contents in books to pick the page she wants

She also asks for the iPad by name.  She has about 40 apps on the iPad that she subsumed from my wife.  It seems like she is learning something new every day now.

The world is changing

Our children, especially the youngest ones, are growing up in an entirely different world than has existed ever before.

world thumb Why My Kid is an iKid

I know this has been said many times before and it could be argued that my generation also grew up in an entirely different world than my parents, but I think the change we are seeing now is much more substantial.

I predict that this generation will be known as the tablet generation.  With Windows 8 now released we are going to see a rapid decline of non-touch devices.  In a few years all laptops will be touch screen retina displays.

There are some fundamental changes going on in how we interact with computers and even what defines a computer.

Yes, I know you’ve heard all this before, but why is this important?

It is important because the real shift I see is the shift between a primarily analog focused world view to a primarily digital focused world view.

For me the iPad or the computer is an attempt to replicate some process or experience in the real world.  No matter how long I work with computers or use these devices, I cannot escape my world view.  Analog always comes first.

For our children things are different.

I can’t say for sure that picking up a pencil and being able to write is a skill that will even be necessary.

It is very likely that this coming generation will view things through the digital lens first and the analog world will be secondary.

I don’t mean they’ll be jacked into computer all day and live in a virtual world, but I do think that while we try to relate software to tangible things the coming generation is likely to view software as the primary and tangible objects as secondary.

Think about music.  Ever had an 8Track?  How about a cassette tape? CD anyone?

How do we think of music today?  One word comes to mind—MP3.

What started out as a physical record eventually lost its purpose and is now so heavily digital that we tend to think in terms of the digital and don’t even consider the tangible anymore.

The same thing is currently happening with books, movies and to some degree money.

Why we let Sophia be an iKid

With the changing world, computer literacy is more important than ever before.

Even in the world we live in now, it is just about impossible to get any kind of non-labor intensive job without being able to use a computer.

If computer literacy is arguably going to be the most important skill for anyone to have in the future, why not start as young as they start to show an interest?

I think it is a huge asset to develop in our children the ability to use a computer as easily and mindlessly as the ability to eat with a fork and a spoon.

I wish I had that ability. I could be so much more efficient if I would stop writing down lists on pieces of paper and instead pull up my iPad or other tablet to jot down ideas and completely replace paper in my life.

And sure I could learn to wean myself off of the analog world, but I want my daughter to be able to think first in the digital world.  She’ll be way more efficient and see things from a better perspective than I ever will.

Aside from that, my wife and I find that the iPad is an excellent learning tool to help Sophia learn to learn.

There are so many things she is able to teach herself using that iPad.

She already:

  • Has a vocabulary of over 100 words
  • Can count to 4 in order and count actual objects
  • Can say most of her ABCs
  • Can recognize most letters
  • Can name many animals and objects

abc thumb Why My Kid is an iKid

Much of what she knows she learned at her own pace based on what she was interested in playing on the iPad.

For example, one week she’ll be playing many of the numbers apps.  For a whole month she just wanted to do alphabets.

The iPad gives her the freedom to be able to choose what she wants to learn and to do it effortlessly.  She is developing the skills to be able to self-educate.  Sure, we still read books to her and try to teach her, but she seems to get a large amount of her knowledge from what she learns playing on the iPad.  (At least the reinforcement of what she has learned.)

Overall I don’t think there is any reason to stop her from playing on the iPad.  I know some people equate it to TV, but I think it is fundamentally different.  The apps she plays on the iPad are interactive.  You can’t mindlessly sit and watch the iPad.  Instead, there is a constant feedback loop that is not present with TV.

Also we can carefully monitor the apps she uses.  The TV is an open system that brings unknown content into your house, where the iPad can be used as more of a closed system.

To summarize, I think we are preparing her for the future and giving her a huge head start in life.

How to get started

So you may be wondering how to best go about getting your baby or toddler started with the iPad.

While I’m not a child development expert, I can give you some advice from what my wife and I have learned in this process.

I’d start by picking up a used first generation iPad and a good case.

You can of course get a newer iPad or even another tablet, or the iPad mini, but just be aware of two things.

  1. Babies don’t have very precise coordination with their hands so small screen are going to be hard for them to use.
  2. Babies tend to throw things, especially when they get frustrated.

The next thing you need is apps.  My wife, Heather, wrote up this section for me.  So, if you notice the grammar is perfect and is written with a much higher skill level than my usual writing, that is why.

(Please let me know if you have some other ones appropriate for the ages.  I’d like to make a nice resource for other iKid believers.)

3 Months – 12 Months

  • Interactive Alphabet by Piikea.  This is by far the best app I’ve seen for the youngest of kids. It has a baby mode which prevents babies from exiting by accidentally batting a menu button and most of the items respond to simple taps or swipes.
  • Juno’s Musical ABCs by Juno Baby.  This app also goes through the alphabet but with a musical theme. The interactions aren’t as neat as the Piikea app and the button to return to the menu is prominent and easily pressed.
  • Peekaboo Baby. This is my app.  Warning, it is very simple.  I was learning MonoTouch and wrote it in a day as an experiment.

12 Months to 18 Months

  • Seuss ABC, Green Eggs These stories have autoplay, read to me, or self-reading features and will say the word of anything the child touches on the screen. There is actually an entire line of the Dr. Seuss books, but I prefer these two. The ABC app is great because each letter is said multiple times. The Green Eggs app is my daughter’s favorite, and I suspect this is because so many of the words in this story (eggs, boat, house, mouse, car, train, etc.) are ones most 18 month olds know. These books are a little long so if you’re more interested in the stories, go with the Bright and Early Board Books instead of these apps. The Mercer Mayer, Little Critter books are also available and tend to be shorter in length.
  • I Hear Ewe This neat little app has three screens of picture tiles: two of animals, one of vehicles. When touched it says: "this is the sound a [insert animal or vehicle here] makes:" I like this because it doesn’t require page navigation. A child can sit and do this for a short period and when they get bored, you can switch the screen for them. Sophia plays this occasionally at 18 months but it doesn’t hold her interest as much, so I suggest trying it at a little younger age.
  • Pat the Bunny by Random House. There is both a paint and interactive option with this app. The paint seems to always crash, most likely due to the mad tapping of a toddler, so I avoid it. The read option has a bunch of items on the screen that kids can interact with (turn off a light, put shave gel on daddy’s face, wave bye bye, play peek a boo, etc.) I’ve never seen the real book, but I wouldn’t be surprised if this app is better than the book. Changing screens is manual and may require adult help. There is an obnoxious Easter egg on every page that brings up the bunny.
  • Princess Baby by Random House. I was actually disappointed there wasn’t more to this app, but Sophia has played it enough that it makes the list. It begins by having you “Choose your favorite princess.” Each princess has 3 toys that can be interacted with in a very limited way: wand, drum, ball, flower, blocks, cat. The princess can be put to bed, which Sophia likes doing over and over and over again.

18 Months +

  • A Monster at the end of this book.  Starring your lovable, furry pal Grover from Sesame Street, this app has a very cute storyline. In order to advance through the book certain tasks, such as touching knots to untie the page or knocking down bricks must be performed. This is another one where the app may be better than the book itself. One bonus: the pages are locked when Grover is talking, which keeps an eager toddler from advancing through too quickly. My daughter loved this book earlier on but I had to help her with some of the action pages and it was just recently that she started doing it all on her own.
  • Another Monster at the end of this book.  Starring Grover and Elmo, some of the tasks are a little trickier than the first book (matching colors, wiping away glue), but did I mention it has Elmo?
  • Little Fox by GoodBeans. This is one of my favorite apps. It has 3 different songs to choose from and each has its own scene: London Bridge is Falling Down, Old MacDonald, and The Evening Song. Each scene is cleverly interactive and entertaining. Old Mac Donald has 4 seasons to select from and the interactions change based on the season. There is also a little "fox studio" with a ton of interactive objects used to make music.
  • Nighty Night by GoodBeans.  Adorable. The animals at the farm house need to go to sleep. This is done by clicking on the area each animal resides in and turning off the light. The animals respond to touch. Additional animals can be purchased (2 sets of 3 animals each).
  • Itsy Bitsy Spider by Duck Duck Moose.  Another fantastic app, this may be the one Sophia has clocked the most time with. In order to progress through this app, you must click on the spider. Each time the spider is touched one line of the song is sung and the spider moves. There is a lot to interact with at each spot and one the second time through the song there are decorated eggs the child can collect on the spider’s back. There is a cute little narrator fly that teaches the child about items the child clicks on (i.e clouds, the sun, rainbows).
  • Ewe Can Count.  This is a cute counting game where you count a random number of sheep, horses, apples, etc. There is a learning and a quiz mode.
  • Logic Lite.  This app is great because it teaches the complicated click and drag gesture. The full version has three additional tile sets: Numbers – match dots to the written number, Pictures – match a picture that contains a shape to the shape it contains, and Letters. The letters are great at 18 months, but the other two are too complex.

Your mileage may vary

Having your little one use an iPad might not work out as well as it has for us, so I think it is only fair to disclose some of the circumstances which govern our life that may help to make our experience successful.

  1. My wife is a stay at home mom.  She used to be a techie, but left the digital world to raise our daughter.  I only bring this up, because she interacts with Sophia all day.  If we were putting Sophia in day care, I would be more hesitant to give her the iPad during our interactive time with her.  (But I would probably try to get the day care to let her use it.)
  2. We have almost 0 TV in our house.  I don’t watch any TV at all or movies.  My wife very rarely watches TV and Sophia never does.  I think this is important, because if she were watching TV, I would also be a bit more hesitant to let her play with the iPad as much.
  3. We do LOTS of other activities.  Just about every day of the week she has either swimming, gym class, play date, or something else going on.  My point here is that she gets plenty of outside time, social interaction and physical activity.
  4. Sophia took the to the iPad right away.  We didn’t have to force it on her or even encourage her to use it.  I don’t know if other kids are like this or not, although I suspect most would be.

So doing the same thing my wife and I are doing might not be the best for you family—you’ll have to decide for yourself—but as far as our daughter has been concerned the experience has been overall positive and beneficial.

Introduction to MonoGame

I’ve been playing around quite a bit with MonoGame lately and thought I would take some time to write a bit about it and talk about how to get started.

I’m also currently working on a Pluralsight course on cross platform development with MonoGame.

monogamelogo100x100 thumb Introduction to MonoGame

What is MonoGame?

Well, if you are familiar with XNA, then you already know what MonoGame is.

If you are not familiar with XNA though, it is basically a game development framework that allows for creating games quickly without having to write all that repetitious code that all games need.

Basically it makes creating games more about the game and less about the technical details.

The only problem with XNA is that it only really works for Windows, XBox360 and Windows Phone 7.  If you want to create a game on Android and iOS, you can’t use XNA.

This is where MonoGame comes in.  MonoGame is an open source port of the XNA framework that can run on many more platforms that Microsoft’s XNA.

Great, so what does this actually mean?

Well, if you are interested in game development, especially if you are interested in game development for the most popular platforms today, MonoGame might be able to help you to write pretty close to the same exact code and have it work on Android, iOS, Windows 7, Windows 8, Windows Phone 7, MacOS, XBox 360, Linux and the new Playstation console.

That is pretty awesome!  Especially if you are trying to monetize your effort.

In my mind MonoGame helps overcome two huge barriers to getting into game development.

  1. Difficulty of monetizing the effort.  By allowing the same code to be shared on most platforms, a game developer can get paid for their effort in multiple marketplaces.
  2. Not knowing where to get started.  The XNA API is so simple to use that you can get a simple game, like a Pong clone for example, up and running in about a couple of hours.

Also, because MonoGame is basically just XNA, you can find a whole host of resources on how to develop a game using the platform.

In my upcoming Pluralsight course, I show how to create a Pong clone on Windows and then we get that game up and running on Android, iOS and Windows Phone 7, with minimal changes.

dgun 853 50 games pr h thumb Introduction to MonoGame

Getting started

It can be a bit challenging to find good information to get started in each platform using MonoGame, but the basics are located on the Github page.

For the Windows tutorial there, you can use Visual Studio instead and use the MonoGame installer.

For each platform things area slightly different, but really not all that hard.  If you want to have your game run in Android and iOS, you’ll need Mono for Android and MonoTouch respectively.

For Android development, you can use Visual Studio as long as you have Mono for Android installed and all you really need to do is link your files from your Windows project and create a small bit of startup code in an Android Activity to start the game.

For iOS development, you will need to use MonoDevelop, which is packaged with the install of MonoTouch.  MonoTouch itself uses XCode and the iPhone SDK, so you have a bit more installing to do there, but the idea is pretty much the same.  One you have MonoTouch running on your Mac, you can link over the files from your Windows project, add a small bit of startup code, and you are up and running.  (You’ll also need to download the actual MonoGame source code to add to your project, since there isn’t an installer for Mac currently.)

Xamarin also has a seminar they did on MonoGame to help you get started.

True cross platform development, finally

At least for game developers.  For other applications in the mobile space, there are some solutions that help you share your code, but nothing that really allows you to have near 100% portability without a big sacrifice.

I was pretty amazed the first time my game just ran on my Android and iOS devices with virtually no changes.

I’d definitely encourage you to check out MonoGame and stay tuned for my Pluralsight video on the topic, where I will go through all the details of creating a game and getting it running on most of the major platforms.

MonoTouch

I’ve been so busy lately that I have neglected to write about a great platform for developing iOS applications called “MonoTouch.”

I recently released a new course on MonoTouch at Pluralsight.

I wanted to take a bit of time here to talk about MonoTouch and to tell you why you should be using it instead of developing iOS applications in Objective-C

text monotouch thumb MonoTouch

Flipping directions

gophoto 0197 scanned image 00363 thumb MonoTouch

When I first started developing with iOS, I firmly believed that the job should be done using the tools that Apple provided.

I still think it is a very good idea to learn Objective-C and how to develop an iOS application using Objective-C and XCode.

But I am convinced now that overall MonoTouch is the way to go.

Objective-C is a decent language, but it has a fairly steep learning curve for a C# or Java developer.  XCode, the IDE for developing iOS applications, is a decent IDE, but it is not nearly as powerful as MonoDevelop or Visual Studio.

The reality of the situation is that Apple’s development platform is still back in 1990.  Even though there have been some changes and growth, I firmly believe now that Objective-C and the underlying technology cannot ever catch up to .NET or Java.

I don’t say this lightly.  As I said, before I developed a fairly large application in Objective-C.  I authored a Pluralsight course on iOS development with Objective-C.  I was pretty convinced this was the way to go until I gave MonoTouch a try.

An unfair test

I really gave MonoTouch an unfair test, but it passed anyway.  I set out to learn, configure, build a MonoTouch application, and deploy it to the Apple App Store in 1 weekend.

I figured if MonoTouch could pass this test then I would immediately save more than the $400 cost for the software since the next application I was going to build was going to probably take at least a week worth of time to build in Objective-C.

MonoTouch easily passed my test and really exceeded my expectations.

The main advantage

By and far the main advantage in using MonoTouch is the language.

C#’s ability to wire up events through event handlers and delegates makes working with iOS so much easier.

There are many situations in iOS where you have to create a special class to act as a delegate for providing behavior for various iOS controls and classes.  In C#, many of these delegate classes can be replaced by a C# delegate or lambda expression.

Another really painful situation in Objective-C is memory management.  If you aren’t used to tracking memory usage it takes a bit to get adjusted to it in Objective-C.  Sure, it really isn’t that hard, but once I started working with C# to build my iOS application, I realized how much faster I could fly through the code without having to even think about it.  (The newer version of Objective-C has somewhat built in memory management, but it is not a true garbage collection implementation.)

Along with C#, you get the full power of the .NET framework.  Almost all of the base class libraries from .NET are available in MonoTouch.  (You basically have the silverlight .NET profile.)

This really comes in handy in 3 main areas:

  • Working with XML
  • Working with databases
  • Calling web services

If you try to do these things in Objective-C, it is possible, but it will hurt like hell.

Give it a shot

If you are interested in developing iOS applications and you haven’t tried MonoTouch, go give it a try.  Trust me, it is worth the effort.  One of the big factors that had me developing Android applications and shying away from iOS was the hurdle of trying to learn and work with Objective-C.

MonoTouch lets you reuse your C# skills without any extra overhead, since the application is compiled down to native ARM assembly code.

If you don’t know where to get started or want to learn a little bit more about MonoTouch, feel free to check out my course on Pluralsight.

Kudos to the Xamarin team for building such a great product!

(BTW, that photo is me flipping.  Actually it is a thing I used to call “throwing myself at the ground for dramatic effect.”)

As always, you can subscribe to this RSS feed to follow my posts on Making the Complex Simple.  Feel free to check out ElegantCode.com where I post about the topic of writing elegant code about once a week.  Also, you can follow me on twitter here.

iPad is Punching Your Kindle and Netbook in the Stomach

I’m not exactly an Apple enthusiast.

I don’t own a Mac for the sole purpose of running Windows in a virtual machine so that I can actually do my work.

In fact, I bought a Droid.

But I bought an iPad on Saturday anyway!  Why?

product wifi iPad is Punching Your Kindle and Netbook in the Stomach

Well, like any good software developer, I don’t like duplication.  I don’t like two devices of similar size taking up space and having to be charged.

Sometime last week, I realized that my Kindle DX and my netbook, could both be replaced by an iPad.  (At least I realized my Kindle DX could be, and once I actually used the iPad, realized the netbook also can be.)

I bought the device expecting it to be basically a replacement for my Kindle DX with color.  I thought that for almost the same price, I might as well get a device that is color, since I am really using the Kindle DX for mainly reading PDFs.

Even with just that functionality, it is a very good bargain. Both the iBooks application and Kindle’s own iPad application provide a better user experience than the Kindle or any other eReader that I know of.  There is just something about being able to turn pages, and have color images in your books, that makes it feel so much more like a real book.  You don’t really realize how much better the eReader experience can be until you try an iPad.

In addition, I have been pretty impressed with other aspects of the iPad that I had scoffed at before the release.  Perhaps the most impressive thing about an iPad is the screen.  It really does feel “magical.”  It is hard to explain, but the viewing angle, combined with the crisp colors and very responsive refresh are like nothing I have ever seen before.

Browsing the web and typing are much easier than I would have expected.  I can actually hold the iPad landscape and thumb type.  (Which might not be possible for some.)

I spent a good amount of time this weekend staring at my netbook, trying to figure out why I would not put it on Ebay.

I didn’t come up with a good answer.  There were some things that I might want to do on a laptop, that I couldn’t do on an iPad, but for pretty much everything I would want to do on a netbook, I could do it easier on an iPad.

One of the really important features of the iPad that makes it smack down netbooks is that it turns on instantly.  Having to boot up the netbook is enough of a deterrent to make it sit over in the corner unused, unless it is worth waiting 20 seconds to boot.  (Which most uses of it are not.)  The iPad is also another device that you don’t really have to manage configuration on.  If you are like me and have a home PC and a laptop, you probably aren’t thrilled with managing configuration on a netbook on top of all that.  The iPad just works.

After seeing how good Plant’s vs. Zombies runs on the iPad, and how nice it looks, it may turn out to be a good gaming platform also.  Time will tell.

All in all, I haven’t had the iPad for more than 2 days so far, but I am liking it.  I intend to give a more in depth comparison between Android OS and iPhone OS, now that I have a device running each.  I highly recommend at least going out and demo-ing one, because it is kind of difficult to understand why the device is so neat until you’ve actually played with it yourself.

fight stomach punch2 00 quick e mail view iPad is Punching Your Kindle and Netbook in the Stomach