In-class notes for 01/12/2018
CS 284 (MCA), Interim 2018
Lab 7 assignment due "midnight"
HW2 on React Native development now available, due Sunday "midnight"
Next quiz: Monday, 1pm. Topics, reference sheet
React Native packages
Submitted questions on assignments and technology
Javascript/React Native packages
Function binding: use arrows (lambdas) for
thisto mean what we expect within object definitions.await()for promises.Doesn't handle failures well; must use
asynckeyword ifawaitused in a function."
async/awaitpatternMay not work on all systems
JS default error handling is to continue, but increasingly standards are moving towards crashing program if error uncaught, as with other langs.
npmis central repository for JS packages for public use. Also options for private.npmjs.comsearch bar -- search for react nativeDetermining whether a package looks promising - npm-published pkgs could be buggy, limited features
Stats: number of downloads. Could be little doc, little support
Release number and number of releases
License, which your software must inherit. e.g., MIT license common in react, and important to know what it says
JS unlike other languages -- more like quilting than looming
Not an easy way to be sure that you don't include significant security issues. Stats may give some evidence.
facebook/react-native on github -- reports.
Installation command in upper right corner. Package names may be deceiving, e.g., malicious code from misspelled "raect".
Note that every package has 51 react dependencies.
Suppose want to use camera? Search shows
react-native-cameragood stats, lots of doc, active working on project
look at eg code
(looks good!)
Doc from FB about how to use packages.
Should not have to write native code in this class, but have packages with native code.
--save, installing packages with native code.Be careful with
package.json-- can break project. This isnpm, notreactnpm-installalways automatically updates the dependencies if^used. could break code...If manually remove a dependency, then removed from project
devDependenciesare for developers only -- not for published version.--save-devcall
npm installwhenever download. Important to include--saveso dependencies are recorded.Downloaded packages go to
node_modules.npm startactually launches a script defined inpackages.json. Can define your own scripts.npm runscriptname
Example -
package.jsonfor All About Olaf app.Without promises, there is a list of projects that might serve as a starting point for package search
New - React Native linking.
Native modules used to be difficult.
react-native linkaddresses this, and is always safe. Moves packages around so everything can be found.Can find install steps on page for npm package -- follow those instructions.
linking may need to be done manually for older packages, etc.
Some steps can't be automated. E.g.,
AndroidManifest.xml, similar topackages.json, has capabilities to limit use of certain hdw in certain apps. Can ask permission of user in standard way. Not automatic.Platform-specific software --
Platform.iOSandPlatform.Androidare booleans to determine what running on. Provide message for those who don't have the platform you need.
Spider -- web crawler
Test-driven development (TDD)
Unit testing - per (Java) class in the implementation
Eclipse JUnit
Importing from existing code into Eclipse
Someone else's code...
Stubs
Eclipse Javadoc
Web crawlers
Parallel spider
Runnableinterface (alternative toThreadclass for starting threads)
To study for quiz
Java networking concepts and programming, as in Lab 6
Networking, not
Messageclass.
Java threads concepts and programming, as in Lab 7.
Focus on (1) creating and using threads such as
TimerThread; then (2)SteppingProcess.
Problems will involve some coding, some concepts.
Bring one page, one side of notes and/or code of your choice
< >