+ All Categories
Home > Documents > Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m...

Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m...

Date post: 23-May-2018
Category:
Upload: hoangdan
View: 215 times
Download: 1 times
Share this document with a friend
35
CS 4720 Mobile Device Architecture CS 4720 – Mobile Application Development
Transcript
Page 1: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

MobileDeviceArchitecture

CS4720– MobileApplicationDevelopment

Page 2: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheWayBackTime• Whenaphonewasaphone…• Plusastory!

2

Page 3: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Ohyes…thiswasaphone…

3

TheMotorolaDynaTAC 8000X• 1983• 13x1.75x3.5• 2.5pounds• $3,995• +MonthlyFee• +Payperminute

Thentherewasthebagphone…

Page 4: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

NokiaInventsMobilePhoneGaming!• ObviouslyI’mtalkingabouttheN-Gage!• …• Okay,rememberSnakeontheoldNokiaphones?

• Otherearlyappsinclude:basiccontactapps,Pong,andTetris

4

Page 5: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Third-PartyAppsBegin• Mobilephonesstoppedbeinganovelty• Batteriesgotbetter,formfactorsimproved,coverageimproved,planswere…better…

• Thehandsetmanufacturersdidn’twanttowritealltheapplicationsforthesenewphones

• However…theydidn’twanttoopenuptheirplatform…

• Thefirstmobilewebplatformwasborn

5

Page 6: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

WAP• WirelessApplicationProtocol• Basicallyit’sastripped-downHTTPthatwasmeanttobebetterattransmittingovertheunreliablemobilenetwork

• WAPusedWMLinsteadofHTML–useda“card”mentality

• TwopopularWAPsites?CNNandESPN

6

Page 7: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

In-AppPurchasesBeforeApps• SMS…

7

Page 8: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Whendiditallchange?• WiththeInternetfullofimagesandmedia…• Andotherhandhelddevicessellinglikegangbusters(GameBoy)…

• Whatchangedwithphones?• Phonesstartedrunningknownoperatingsystems(WindowsCEandLinux)

• Nowbiggerplayerswereinvolved,andhandsetmanufacturesdecidedtoopenup

8

Page 9: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Andwhat’shappenedsince?• Themobilemarketisseriouslyfractured• Whodoyoudevelopfor?• HowdoyoutestforEVERYphone?• Whichmarketworksbest?• Howdoyouportyourappbetweenplatforms?• Whichtoolsdoyouuse?Canyouuse?

9

Page 10: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

AndNowGoogle• TheOpenHandsetAllianceisanattempttoeffectively“geteveryoneonthesamepage”

• OpenSource• FamiliarEnvironmentsandTools• SecureOS(Linuxw/appsigning)• NoRoyaltiesorDeveloperFees

10

Page 11: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheThree-TieredArchitecture

11

Page 12: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheThree-TieredArchitecture• Forawebapplication…

– Thebrowser+dynamicallygeneratedHTMListhepresentationlayer

– Middlewarefiles(function-specificPHP,JavaservletsonTomcat)containthebusinesslogic

– Thedatabaseserveristhedatalayer

12

Page 13: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

It'snotnewstoyou• Theconceptsofthethree-tieredarchitectureapplytomanydesignscenarios– Keepthepresentationseparatesoit'slightweight,easiertomaintain,andcanbetestedseparately

– Keepthelogicseparatesoyoucanchangethelogicasneededwithouthavingtochangethepresentationtoomuch

– KeepthedataseparatebecauseyoushouldNEVERbuildasystembasedonthecurrentdatavalues

13

Page 14: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Model-View-Controller• ThisisthedefinitionofwhatMVCis• TheMVCpatternmaps:

– Identifieswhattheuserisaskingfor– Loadsaparticularresource– Displaysthepertinentinfoaboutthatresourcebacktotheuser

• ToModel,Controller,View(inthatorder)

14

Page 15: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

MVC

15

Page 16: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

MVC

16

Page 17: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Controller• Theroleofthecontrollerisbasicallytrafficcop• Ittakestherequestfromtheuserand(withtheassistanceoftheserverandroutingrules)turnsitintoamethodcallofsorts

• Itfindstheappropriatemodeltoload• Itfindstheappropriateviewtoload• Itreturnsthewholethingbacktotheuser

17

Page 18: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Model• Themodelistherepresentationofthedata• Thismayormaynotbedirectlylinkedtoadatabase(butoftenisinlargerapps)

• AmodelisoftentranslateddirectlyintoaDBtable,withthecolumnsasitsattributes

• Think“classdefinitionw/DBbackend”• Oftencontainsrelationshiprules(aStudenthasmanyClasses,forinstance)

18

Page 19: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

View• Theclosestthingtowhatyou’vebeendealingwithsofaristheview

• It’seffectivelyanHTMLtemplatethatwillbepopulatedwiththeappropriatedatafromtheloadedmodel

• ItoftenhasPHP(orwhatever)embeddedinit• AllUIcomponentsgohere

19

Page 20: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

PuttingitallTogether• So,ifyouwerebuildingablog,whatmightsomeofthemodelsbe?

• Whataretheresourcesthatshouldhaveaddressestothem?

• Howdotheyrelatetoeachother?

20

Page 21: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Non-shockeroftheday• Weneedtoconsiderthesamethingsforamobilearchitecture

• Why?Whataddedconcernsdowehavewhenweconsidermobileapplications?– PresentationLayerconcerns– LogicLayerconcerns– DataLayerconcerns

21

Page 22: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

MobileArchitectures

22

• RichMobileArchitecture– Businessandsomedataservicesonthephoneitself– Goodforappsthathavetorun“offthegrid”

• ThinMobileArchitecture– Mostbusinessandalldataservicesontheserver– Goodforappsthatrequirephoneservices,butdoesrequireInternetconnectivity

• RichInternetApplication– Eschewstheuseofanyphoneresourcesotherthanabrowser

– Goodforappsthatcanrunonanythingwithabrowser

Page 23: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

Whicharewedoing?

23

• RichInternetApplication– Well,it'scertainlynotthisone…whynot?

• RichapporThinapp?• Dobothfollowthethree-tieredarchitecturestructure?Whyorwhynot?

Page 24: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

RichMobileArchitecture

24

Page 25: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

ThePresentationLayer• Remember:it'saphone!

– Simple=good– Peoplehavedifferentsizedfingers– Useractionscallfunctionswhichexecutefeatures;useractions!=features

– Phonescanhavevaryingamountsofpower/resources

– Phonescanbeonoroffthecellulargridatanypoint

25

Page 26: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

PresentationApproach• Rememberyourclienttype• Determinehowyouwillpresentdatainacoherent,unifiedmethod

• Determinehowyouwillguardagainstuntrustedinput• Ensureyouhavefactoredoutyourbusinesslogic• Determinehowyouwillpassdatabetweenlayers(i.e.howyouwillcalltheservice,howyouwillgetmoreinfoaboutabuilding,etc)

26

Page 27: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheBusinessLayer• Forthemostpart,theseareyourwebservicesandrelatedfunctionalities– Eachofyourthreewebservicesyouareusing

27

Page 28: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

BusinessApproach• IdentifyFEATURESthatwillexistatthislevel• Buildcomponentsthatsupportafeature'sexecution

• Hideimplementationdetailsfromthepresentationlayer

• Determineif(how)youwillcacheinformationonthedevice

• Mapoutusecases

28

Page 29: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheDataLayer• Thiswillbeyourmodulethattalkstothedatabase

• Willbeintertwinedwiththebusinesslayertosomedegree

29

Page 30: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

DataApproach• Foreachfeature,determinewhatdataisrequired

• BuildSQLqueriesaroundthefeatures• Ensurethatyouareusingpreparedstatementstoguardagainstincorrectdataentry(orinjection)

• Determinehowyouwillmanageconnections• Determineifyouwillbatchupcommandsintoonebigcommand

30

Page 31: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

YourMobileArchitecture

31

• YourApproach:• Android/iOS UIwhichcalls…

• …your “businesslogic”cope

• …thatconnectstosomedatastore(localorremote)

Page 32: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheAndroidArchitecture

32

Page 33: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

YourMainComponents• Activities– representasinglescreenwithaUI• Services– representsaprocessrunninginthebackground

• ContentProvider– alinkbacktothedata• BroadcastReceiver– listensforsystem-widemessagestorespondto

• Application– asetofActivitiesthatmakeupacohesiveunit

• Intent– amessagetobepassed33

Page 34: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheActivity

34

Page 35: Mobile Device Architecture - CS 4720 4720 Nokia Invents Mobile Phone Gaming! • Obviously I’m talking about the N-Gage! • … • Okay, remember Snake on the old Nokia phones?

CS4720

TheIntent

35


Recommended