A JavaScript Framework for Presentations and Animations on Computer Science Laszlo Korte Bachelor Thesis Technical Aspects of Multimodal Systems Department of Informatics University of Hamburg 1 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Outline 1. Introduction 2. Web Platform ○ The Browser ○ NodeJS ○ Workflow ○ Graphical User Interface 3. Components ○ Demos 4. Architecture 2 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Introduction Motivation 3 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Motivation ● Computer Science deals with abstract topics ● Hard to grasp without trying ● Short feedback cycle for building intuition ➔ Interactive learning experience 4 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Matlab Components ● Boolean expression parsing and evaluation ● Binary number encoding and decoding ● Finate-state machine simulation ● Algorithm visualisation ● … 5 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Matlab Components - FSM finite-state machine simulator 6 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Matlab Components - number encoding number “circle” 7 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Matlab Components - base conversion visualisation of an algorithm for base conversion 8 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Java Applets ● Karnaugh map editor ● Advanced FSM editor 9 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Java Applets - Karnaugh map Karnaugh map editor 10 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Java Applets - Karnaugh map Karnaugh map editor 11 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Java Applets - FSM Finite-state machine editor 12 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Java Applets - FSM Finite-state machine editor 13 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Issues ● Matlab ○ Not free, licensing restrictions ○ Not trouble-free with current Matlab version ○ Not on mobile devices 14 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Issues ● Matlab ○ Not free, licensing restrictions ○ Not trouble-free with current Matlab version ○ Not on mobile devices ● Java Applets ○ Not on iOS (iPad, iPhone) ○ Not usable on touch screens 15 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Introduction Objective 16 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Objective ● A new collection of components ○ no licensing issues ○ not limitted to a small set of devices ➔ The web as free and open platform ➔ Touch screen support ➔ Support a wide range of screen sizes 17 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Objective - components ● Karnaugh map editor ● Finite-state machine editor ● Boolean expression editor ● Number circle ● ... ➔ Expandable later on 18 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Web Platform The Browser 19 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser ● Display HyperText Markup Language Documents (HTML) ● Documents can be styled via Stylehsheets (CSS) ● Documents may contain code to execute (JavaScript) 20 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser - example HTML document index.html 21 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser - example HTML document index.html 22 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ CSS index.html 23 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ CSS index.html 24 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ JS index.html 25 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ JS index.html 26 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ JS index.html 27 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ JS index.html 28 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
+ JS index.html 29 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser - example document index.html 30 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser ● HTML Document is the entry point ○ links to/embeds stylesheets ○ links to/embeds javascripts ● Most of the application is defined in JavaScript (JS) ➔ start with an almost empty document, build everything in JS 31 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser - Document Object Model ● DOM API allows querying and modifying the whole document 32 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
The Browser - JavaScript ● No module system ○ difficult to split application into modules ● No static type system ● Weird semantics ○ 5 + "5" === "55" ○ 5 * "5" === 25 ● API differences across browsers 33 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Web Platform NodeJS 34 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
NodeJS Source: https://nodejs.org/en/about/resources/ ● JavaScript runtime environment ○ Based on Chrome’s JavaScript engine V8 ○ Run JavaScript outside the browser ➔ Large ecosystem of open source libraries and tools 35 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
NodeJS - Package Manager Source: https://www.npmjs.com/ ● Command line tool for managing dependencies ○ Like maven for Java or easy_install for python ● Access to >250.000 libraries 36 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Web Platform Workflow 37 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Babel Logo: https://github.com/babel/babel ESLint Logo: http://eslint.org/ Webpack Logo: https://webpack.github.io/ Workflow - Tools ● BabelJS ○ Access to future JS features (eg. module system) ● ESLint ○ Check source code for common errors ● Webpack ○ Module bundler ○ combine multiple JS files and libraries into one file 38 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Babel Source: https://github.com/babel/babel ES6 module import syntax 39 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
vendor/LibX Workflow - Tools moduleA.js moduleB.js main.js 40 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - ESLint Source: http://eslint.org/ moduleA.js moduleB.js main.js 41 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Webpack Source: https://webpack.github.io/ moduleA.js moduleB.js bundle application.js main.js 42 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Webpack layout.css moduleB.css Source: https://webpack.github.io/ moduleA.js style.css application .js moduleB.js bundle application. css main.js 43 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Webpack Dev Server 44 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Webpack Dev Server ● No manual recompile ● Watches the file system for changes ● Pushes changes to browser (via websocket) 45 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Workflow - Webpack Dev Server ● No manual recompile ● Watches the file system for changes ● Pushes changes to browser (via websocket) connect moduleA.js watch Dev Server main.js notify moduleB.js browser http://127.0.0.1:3000 file system 46 / 76 May 3, 2016 - Laszlo Korte - JavaScript Framework for Presentations on Computer Science
Recommend
More recommend