Home
>>     < >




In-class notes for 01/12/2018

CS 284 (MCA), Interim 2018

This session:

Submitted questions on assignments and technology

Javascript/React Native packages

  • Function binding: use arrows (lambdas) for this to mean what we expect within object definitions.

  • await() for promises.

    • Doesn't handle failures well; must use async keyword if await used in a function.

    • "async/await pattern

    • May 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.

Packages
  • npm is central repository for JS packages for public use. Also options for private.

  • npmjs.com search bar -- search for react native

  • Determining 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-camera

    • good 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 is npm, not react

    • npm-install always automatically updates the dependencies if ^ used. could break code...

    • If manually remove a dependency, then removed from project

    • devDependencies are for developers only -- not for published version. --save-dev

    • call npm install whenever download. Important to include --save so dependencies are recorded.

    • Downloaded packages go to node_modules.

    • npm start actually launches a script defined in packages.json. Can define your own scripts. npm run scriptname

  • Example - package.json for 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 link addresses 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 to packages.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.iOS and Platform.Android are booleans to determine what running on. Provide message for those who don't have the platform you need.


Spider -- web crawler

To study for quiz

  • Java networking concepts and programming, as in Lab 6

    • Networking, not Message class.

  • 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




< >