the bmi calculator project the walkthroughroumani/walkthrough/walkthrough.pdf · mobile, android...
TRANSCRIPT
DevelopmentWalkthrough
ProfHRoumani 1
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
THEWALKTHROUGH
1. THEPROCESS
2. REQUIREMENT
3. DESIGN4. THEPROJECT
5. THEVIEW
6. THECONTROLLER
7. THEMODEL
8. TESTING9. DEPLOYMENT
A. THEMAKING*
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
THEPROCESS
DevelopmentWalkthrough
ProfHRoumani 2
• RequirementAnalysis
• Design
• ImplementaFon
• TesFng
• Deployment
REQUIREMENTS
DESIGN
IMPLEMENTATION
TESTING
DEPLOYMENT
Thewaterfallmodelcarriesrisks:• Requirement-change,• Architectural,and• Assump3on.
Tomi[gate,• Implementitera[vely,processwise.• Incorporatefeaturesincrementally.
DevelopmentWalkthrough
ProfHRoumani 3
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
REQUIREMENT
DevelopmentWalkthrough
ProfHRoumani 4
OverallThePla]ormandtheUI.
InputMechanism,informa[ontype,valida[onrules.
OutputMechanism,informa[ontype,forma^ng.
§ Pla]ormMobile,Android(min=IceCream)
§ Input-Weight(kg)andHeight(m),bothreal-Twotextboxes,prompts,acomputebueon-Novalida[oninthisfirstrelease
§ Output-Theindexroundedto1decimal-Noforma^nginthisfirstrelease
DevelopmentWalkthrough
ProfHRoumani 5
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
DESIGN
OverallAblueprintofhowthesoughtsystemworks.
ComplexityModernsogwaresystemsareverycomplex.Cannotbuildonefromscratchinonelife[me!
StrategyDivide;choreograph;orchestrate.
VIEW CONTROLLER MODEL
ComputeEngines
UIWidgets
LAYOUT ACTIVITY CLASS
XML JAVA JAVA
EventHandlers
LayoutManagers
StylesandThemes
DataAccess
…
DevelopmentWalkthrough
ProfHRoumani 6
§ AlgorithmGiventheweightwinkgAndtheheighthinmBMI=w/h2
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
CREATING&ARCHIVING
THEPROJECT
CreateProjectname(nospaces).
StructureManifest,Java,andResources
Archiving-Zipthewholefolderorjustapp/src-SavetocloudoraUSBs[ck
DevelopmentWalkthrough
ProfHRoumani 7
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
IMPLEMENTING
THEVIEW
TerminologyTextbox=EditTextLabel=TextView
KeyProper;esid,layout_width=match_parent
XMLEn[reviewrepresentedintext
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
IMPLEMENTING
THECONTROLLER
DevelopmentWalkthrough
ProfHRoumani 8
V-to-CGlue-MethodthattakesaViewparameter-Thebueon'sonClickproperty
C-to-VGlue-findViewById(R.id….)-Casttopropertype-Surroundwithparentheses-Invoke.getText().toString()or.setText(…)
CreateanInstanceofthemodel-BMIModelmodel=newBMIModel(…);-Thisgivesusanobjectreferencemodel
Invokemethodsinthemodel-Stringanswer=model.getBMI();-C-to-M:viatheinvoca[on-M-to-C:viathereturn
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
IMPLEMENTING
THEMODEL
DevelopmentWalkthrough
ProfHRoumani 9
AFributes(thestate)privatesome-typesome-name;
Constructor-publicclass-name(parameters)-Setthestate
Method-publicreturn-typesome-name(…)-Returnsomethingifnotvoid.
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
TESTING
ForVandC• Physicaldevice• Framework(e.g.Mokito)
ForM:• psvm(input=Scanner,output=System.out)• JUnit
TestCases:Needanoracle.Coverageisimportant.
DevelopmentWalkthrough
ProfHRoumani 10
ADEVELOPMENTWALKTHROUGH
PROFHROUMANIDeptofElectricalEngineering&ComputerScience
THEBMICALCULATORPROJECT
DEPLOYMENT
1. Turndeviceon2. PluginUSBcable3. GrabdeviceinVBox4. Run(greenarrow)5. AllowindeviceNote:Aboveassumesdevicehasdeveloper'smodeon;USBdebuggingallowed;andVBoxacceptsthevendorin/etc/udev/rules.99/.