A Moving T arget

29
A Moving Target Our experience of teaching mobile programming on different platforms at Staffordshire University Cathy French Dave Gillibrand Trevor Adams 1

description

A Moving T arget . O ur experience of teaching mobile programming on different platforms at Staffordshire University Cathy French Dave Gillibrand Trevor Adams. Staffordshire University Computing. 2012 intake: 365 first year students + >100 postgraduate degrees in - PowerPoint PPT Presentation

Transcript of A Moving T arget

A Moving target

A Moving Target Our experience of teaching mobile programming on different platforms at Staffordshire University

Cathy FrenchDave GillibrandTrevor Adams1Staffordshire University Computing2012 intake: 365 first year students + >100 postgraduatedegrees inComputer Science, Computing Science, Software EngineeringWeb and MultimediaDigital Forensics and Cyber SecurityComputer NetworksComputer Games ProgrammingApplied Information Technology (Stoke Campus)

2Mobile Computing at Staffordshire Universityfrom 2001 offered degrees in BSc Wireless Networking TechnologyBSc Mobile and Wireless Business SystemsBSc Mobile Device TechnologyMSc Mobile ComputingMSc Mobile Computer SystemsMSc awards popular with overseas studentsBSc awards attracted little interestindividual modules very popular options across all awards

3Mobile Modulesacross all levels, different emphasisintroduction to mobile systems and technologywireless architecture and signallingprogramming for mobile devicesmobile systemsmain platforms:Java MEWindows CE class set of PDAsgood for interface design, socket programmingnow moving to Android, iPhone and Windows Phone4Two second year programming modulesProgramming for Mobile and Handheld DevicesDave GillibrandgamesJava ME -> AndroidSoftware Development for Mobile Computer ApplicationsTrevor Adamsmobile appsJavaME -> Android -> iPhone

5CE00922-5 Programming For Mobile And Handheld DevicesDave Gillibrand

Development of 2D games are taught in this moduleJava ME was previously used but this year for the first time we used the Android platformPreviously JavaME with Netbeans was quite a nice environment to teach withJavaME seamlessly integrates into NetbeansStudents found it straight forward to code, compile and runLater editions of Netbeans introduced a designer where a visual designer allowed students to create an application with little need to recourse to codeThis wasnt used as by handcrafting code it was felt that more of what is going on is understood.6JavaME - ArchitectureThe architecture of JavaME was easily understoodOnce MIDP (Mobile Information Device Profile ) , CLDC (Connected Limited Device Configuration), AMS (Application management software) and the MIDlet life cycle were explained to them they were up and running

7Language and IDEMost of the students were new to JavaME (having studied java in their first year)Because of the explosion in popularity of Smart phones we switched from JavaME to Android teaching essentially the same content i.e. At the end of the module the students were expected to write their own game As an IDE we used Eclipse hooked up to the Android platformThere were more technical issues that the students (and staff) had to sort out, initially setting up the environment and when using the IDE.The emulators are more complex having the ability to emulate saving to an SD card as well as reading in GPS dataThere is lots of help on the Android developers web site8Android ArchitectureThe Android architecture is inherently more complex than the previous JavaME architecture. There are the following conceptsActivitiesServicesContent ProvidersIntentsBroadcast ReceiversNotificationsYou can also specify HCI in Android using xml files which are inflated at run timeExcellent way of designing your applicationSeparation of concerns But new to the students

9Game Programming in AndroidAs the module is about writing a game we focussed on Activities, Threading and specifying the HCI in xml filesThe code to write the game loop in a thread in Android is quite complex and difficult to understand involving the SurfaceView class, SurfaceHolder and SurfaceHolder.Callback interfacesAn example was provided for the students which they could modifyThis leads us to the teaching paradigm employed:Give an exampleUnderstand the exampleModify the example10Teaching ParadigmIs this how we all learn?We applied the above paradigm in teaching the moduleThe first 3 weeks were an introduction to the basics of AndroidIn week 4 we explained how threading is done in Android and demoed a Simple Game loop. The following slide is what we expected the students to do in the week 4 tutorial

1112Tutorial wk4 part3The result of the previous code Tutorial wk4 part4Tutorial wk4 part5Tutorial wk4 animations

Some PointsWhen developing in Android compared to JavaME the high level design is the same, a continually executing game loopBut obviously the APIs are differentIn JavaME we had a Sprite class which you could extend, not in AndroidSo its fun developing your own Sprite class with basic functionality which you can extend Functionality related to its position, movement and the ability to detect collisions Other things to considerA real device is far better than an emulatorE.g. if you use an emulator you are fixed to a particular orientation (portrait) On a real device unless you fix the orientation in manifest.xml or programmatically it switches between portrait and landscape depending on how you hold the device

13Some PointsOther things to consider - continuedThis has consequences! Can lose all of your state information unless you specifically program to save all your state information between orientation switchesBattery LifeIf you develop GPS applications which constantly monitor your position then it can drain your battery. Out on a long walk you could get lost!You may need to take this into account when developing GPS applications so you limit your GPS usage

14Some PointsOther things to consider - continuedKeyboard inputThe emulator has a full set of hard keys where you can use the keys to trigger eventsMost smart phones use touch events to trigger game actions (the emulator supports this) but clunky on the emulatorThis can restrict the number of different game actions, you can detect the direction and length of the swipe, also supports multi touch, but obviously you have to program this added complexityYou can detect the pressure as well !

15Some PointsOther things to consider - continuedUsing Http connections to connect to a JavaEE6 application glassfish server.Problems developing an android mobile applications client which talked to a glassfish server For development and testing purposes for the client you couldnt use localhost or the local web address in the android client, the server had to be externally visible

16AssignmentThe students were required to produce an application with the following functionality:A games design (storyboards)Background ScrollingPlayer Sprite - creating and displayingAnimation (simple or more complex)Enemy SpritesFiring of pelletsCollision detectionAnimation when players(including enemy) dieA welcome and finish screenDisplaying scoresStoring and retrieving scores

1718

An Example of a students workFYP (Final Year Project)At Staffordshire University we have a FYP which comprises 3 (out of 8) modules in the Final Yearthe project is related to the award they are onIncreasingly more of them are choosing mobile devices to develop their application onoften they pick a platform they haven't previously been taughtand learn it themselvesOne of my FYPs this year developed an applications which runs on a Windows 7 phone, it was a very good FYPLocation based app which located nearby restaurants and displayed menus on a phone, allowed customers to write reviews, allowed restaurant owners to edit their detailsHosted on a webserver with a database which worked from a real deviceCreated web services to enable the functionalityDeveloped it using an agile methodUsed test driven development and Kanban boardsUsed subversion for version control19CE00343-5 Software Development For Mobile Computing Applications Trevor Adams

Longstanding 2nd year moduleAimed at general computing studentscomputer science, software engineering, web, ..until 2010 - JavaME2010-11Android2011-12iPhone Objective CThis is a popular module with 3 times as many students electing to do this module compared with the Android level 5 module (games).everyone (thinks they) wants to do iPhone development!

20iPhone vs. AndroidDevelopment Environmentthe most obvious barrier to teaching iPhone development is the development environmentneed a lab of Apple Macswhere are your students going to do their practical exercises and assignments?some will have their own Macsothers will hate the idea of being tied to a labcan they get enough access?not very mobile!have to enrol on Academic Developer Program (free)need iPhone / iPods for testing have to register each devicenot as simple as hooking up the USB cable (Android)cannot create commercial apps without paying a fee

21iPhone vs. AndroidLanguageour students already know Javafirst programming languagecan jump right in to Android frameworkiOS uses Objective-Cnot intuitive or obvious if used to .dot notationrequires a few weeks to cover the language basicsbut is an opportunity to look at programming fundamentals in a new wayneed to allocate memory explicitlyAndroid has garbage collector

22Efficiency23Mobile programming gets students to appreciate the cost of codeIn both time and space crucial on mobile devicesMost students do not consider thisThey do not seem too impressed about having toGenerally do not have enough memory to be luxurious and you have to allocate it properlyBad programming here has ramificationsIncreased battery use, memory limit etc.

iPhone vs. Android FrameworksMost of the concepts required for iPhone/Android are common across OO languagesHowever, these concepts are obfuscated under layers of framework and APINecessary, for app reliability / securityDoes not make the step up easyThe concepts are similar in generalBut often implemented in platform specific waysiPhone requires Model-View-ControllerAndroid requires Model-View-Presentercan't just output a simple "Hello World" to the Console!

24iPhone and AndroidDesign PatternsCannot escape them in either platformMVC, observer, delegate, proxy, strategyEntire books on subjectBuck, E. M. and D. A. Yacktman (2010). Cocoa design patterns. Upper Saddle River, NJ, Addison-Wesley.Challenge teaching design patterns as you goYou cannot avoid themPoint out the architecture in examplesShow how it fits together with worked examplesBreak the problem type down it overcomesShow how the pattern addresses the problemThen name it!

25iPhone vs. AndroidHardwareAndroid many devices, many manufacturersAPIs are numerous for many different devicesNo consistency between device characteristicsInput, screen size, memory, cameras and othersSome large shifts between API levelsActivities, intents and data sources.Open devices, requesting access to device resources via use of config. and queryStudents can use their own phones easilyJust connect USBiPhone limited devices, single manufacturerAPI is fairly steady and stableA lot of consistency across versionsLimited variations common feature set amongst devices (iPhone/iPad)To use hardware requires code signing certificates and membership to Apple Developer Program

26Student expectationsThere is an expectation of simplicityGet a reality of complexityMobile seems to be considered easyLess functionality than PCs - should be easier to developMobile Apps are smaller / simpler than desktopTheir impressions seem to be fuelled by their experience as a consumerAt least early onLack of size != lack of complexityUsually, the simpler something is to use, the more it does under the hood in mobileThe constrained device gives the impression of simplicity of applicationMaking things simple requires a lot more thought

27General Conclusionsstudents are keen to learn mobile programmingsmartphone development is more difficult than they thinknot suitable as an introductory moduleJava ME and Windows CE development was more straightforwardbut this learning curve makes it an ideal second year topicgets them to really appreciate and understand advanced topicsdifferent language paradigmsuser interface designmemory managementprogram efficiencythreadingtestingobject-oriented conceptsdesign patternsdeveloping complex applicationsand it's fun!

28QUESTIoNs?29