CMPE 280 Web UI Design and Development October 26 Class Meeting

Slides:



Advertisements
Similar presentations
12 October 2011 Andrew Brown IMu Technology EMu Global Users Group 12 October 2011 IMu Technology.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
UNIT-V The MVC architecture and Struts Framework.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
MVC pattern and implementation in java
MEAN Stack c0nrad. Overview Day 1: – MEAN Stack – NodeJS Mini Cat Fact Spammer – MongoDB Cat Profiles – Express Catbook API (Facebook for cats) Day 2:
Dr. Azeddine Chikh IS444: Modern tools for applications development.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
CMPE 226 Database Systems October 28 Class Meeting
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Securing Angular Apps Brian Noyes
CS 160 and CMPE/SE 131 Software Engineering February 9 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
Apache Solr Dima Ionut Daniel. Contents What is Apache Solr? Architecture Features Core Solr Concepts Configuration Conclusions Bibliography.
Vineel Vutukuri. What is SPA? Why SPA? Pros & Cons When to use SPA?
Ur/Web: A Simple Model for Programming the Web
National College of Science & Information Technology.
12. DISTRIBUTED WEB-BASED SYSTEMS Nov SUSMITHA KOTA KRANTHI KOYA LIANG YI.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
J2EE Platform Overview (Application Architecture)
DHTML.
Web Technologies Computing Science Thompson Rivers University
Netscape Application Server
N-Tier Architecture.
Node.js Express Web Applications
MVC Architecture, Symfony Framework for PHP Web Apps
Web Software Model CS 4640 Programming Languages for Web Applications
Distribution and components
CMPE 280 Web UI Design and Development October 19 Class Meeting
EMV® 3-D Secure - High Level Overview
CMPE 280 Web UI Design and Development October 24 Class Meeting
CMPE 280 Web UI Design and Development October 26 Class Meeting
CMPE 280 Web UI Design and Development November 7 Class Meeting
Introduction to J2EE Architecture
CS5220 Advanced Topics in Web Programming Course Overview
CMPE 280 Web UI Design and Development January 30 Class Meeting
SharePoint Cloud hosted Apps
CS 174: Server-Side Web Programming January 29 Class Meeting
MEAN stack L. Grewe.
Model-View-Controller Patterns and Frameworks
CMPE 280 Web UI Design and Development January 30 Class Meeting
Lecture 1: Multi-tier Architecture Overview
Web Application Architectures
Rich single page applications with SharePoint
Building responsive apps and sites with HTML5 web workers
Starting Design: Logical Architecture and UML Package Diagrams
Software models - Software Architecture Design Patterns
CMPE 280 Web UI Design and Development October 18 Class Meeting
CMPE 280 Web UI Design and Development January 29 Class Meeting
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Web Application Architectures
CMPE 280 Web UI Design and Development March 19 Class Meeting
…and web frameworks in general
RESTful Web Services.
Back end Development CS Programming Languages for Web Applications
Web Technologies Computing Science Thompson Rivers University
CS122B: Projects in Databases and Web Applications Winter 2019
CS5220 Advanced Topics in Web Programming Course Overview
CMPE 135: Object-Oriented Analysis and Design March 14 Class Meeting
Web Application Architectures
Web Client Side Technologies Raneem Qaddoura
Back end Development CS Programming Languages for Web Applications
The Future is Now with ASP.NET Core 3.0
Running C# in the browser
Chengyu Sun California State University, Los Angeles
CMPE 280 Web UI Design and Development November 8 Class Meeting
CMPE 280 Web UI Design and Development August 27 Class Meeting
CMPE 280 Web UI Design and Development March 19 Class Meeting
CMPE 280 Web UI Design and Development September 10 Class Meeting
Presentation transcript:

CMPE 280 Web UI Design and Development October 26 Class Meeting Department of Computer Engineering San Jose State University Fall 2017 Instructor: Ron Mak www.cs.sjsu.edu/~mak

Midterm Solution: Question 1 A typical Express architecture maintains separate routes and views directories. Briefly explain their purposes. The routes directory holds the code that routes an HTTP request to code that processes the request. The request consists of a method (GET or POST) and a URI. The views directory holds the code (such as Jade templates) that dynamically generates HTML pages.

Midterm Solution: Question 1, cont’d What are the advantages of having separate directories? Make clear, in an MVC architecture, the separation of controller code (in the routes directory) from the view code (in the views directory). Keeping them loosely coupled allows developers to work separately in each directory, and changes can be encapsulated and isolated.

Midterm Solution: Question 2 Briefly describe how each of the following technologies helps enable the development of a compelling single-page application (SPA). AJAX Enable only the parts of the page that changed to refresh, thus making the UI of a web app behave more like a desktop app.

Midterm Solution: Question 2, cont’d UI design patterns Proven ways to design a web UI that enhances the user experience. The same design patterns are used to improve the UI of traditional desktop apps. jQuery UI Themes and widgets for a web UI that traditionally are used in desktop apps.

Midterm Solution: Question 2, cont’d REST The web app can implement new functionality by incorporating web services that expose a REST API. Web apps can feature as many functions as a traditional desktop app.

Midterm Solution: Question 3 Briefly explain, in general, the main differences between how NoSQL databases and relational databases deal with scalability. A relational database will scale up. To handle larger loads, increase the processing power of the database server by adding more cores, memory, etc. A NoSQL database will scale out. To handle larger loads, add more database servers to the network and distribute the work via auto sharding.

Midterm Solution: Question 4 A MongoDB database query returns a cursor. What are the primary advantages of returning a cursor? The cursor is a pointer to the result set of the query. It is the conduit for accessing the query results, and therefore not all the data from the result set needs to be downloaded all at once.

Midterm Solution: Question 4, cont’d Briefly describe how an application would use a cursor. The app uses the cursor to iterate over the result set. Data from the result set downloads only when the cursor points to the document. To improve performance over the network, more than one document may download in anticipation that the cursor will move forward.

Midterm Solution: Question 5 For web application FindMyNewCar.com: Briefly describe three components of a dashboard you could design for use by the sales manager. How does each component provide situational awareness for the manager? Bar chart: Visitors per time period. The sales manager can see how much traffic the site has. Pie chart: Types of visitors per time period. The sales manager can see who is visiting the site. Line chart: Number of visitors vs. amount of sales over time. The sales manager can see the trend of how effective the site is.

Midterm Solution: Question 5, cont’d Why is this chart poorly designed? The bars are 3-D which makes it hard to read their values. The printed values of the bars are very hard to read. The y axis doesn’t start at 0, which magnifies differences.

Midterm Solution: Question 5, cont’d You are designing a RESTful API for your web application. Users will need to log in. Briefly discuss what should happen on the node.js server for each of the following two routes: GET /findmynewcar/login Respond with a login form whose action is a POST to /findmynewcar/login POST /findmynewcar/login Process the data from the login form.

Midterm Solution: Question 6 HTTP is a stateless protocol. Briefly describe the key technologies that enable a web application to maintain a conversation with a user across multiple requests. How do these technologies work together? session: Maintains information on the server about a user, such as whether or not the user is logged in. cookie: Data written and sent by the server to the user’s browser. The browser returns the cookie on each request. The cookie data allows the server to identify which session belongs to the user.

Rendering the Home Page

Recall: MVC Architecture Design goal: Identify which objects are model, view, or controller. A user cannot directly modify the model.

MVC Model Objects Represent the persistent information maintained by your application. AKA entity objects Maintained in a database such as MongoDB. Manipulated by JavaScript code via object-document mapping (ODM). Analogous to object-relational mapping (ORM). ODM implemented by packages such as Monk or Mongoose.

MVC View Objects View objects represent user interface components. Input components of a web page. In each use case, users interact with at least one view object. A view object collects information from users in a form that the model and controller objects can use.

MVC Controller Objects Coordinate the model and view objects. Often have no physical counterpart in the real world. Collect information from view objects for dispatch to model objects. This is how user-entered data can update the model. Can be implemented by routing. Represent application control flows.

Routes A route is a mapping from an incoming HTTP request to the appropriate controller code. Associates a URI plus an HTTP method (GET or POST) with a particular controller action. HTTP method also called HTTP verb Most widely used HTTP methods in web apps are GET, POST, PUT, and DELETE. Defined by the HTTP standard.

MVC Architecture Request-Response Flow

MVC Architecture Data Flow

Refactor Directory Structure for MVC Refactor a standard Express application to better reflect an MVC architecture: Create directory app_server Move in existing directories routes and views Create new subdirectories controllers and models

Refactor Directory Structure for MVC, cont’d Modify app.js: Add to app_server/routes/index.js: var index = require('./app_server/routes/index'); ... app.set('views', path.join(__dirname, 'app_server', 'views')); var ctrlMain = require("../controllers/main");

Refactor routes/index.js From: To: routes/index.js /*  * GET home page.  */ router.get('/', function(req, res, next)  {     res.render('index', { title: 'Authentication Demo' }); }); app_server/routes/index.js router.get('/', ctrlMain.index); app_server/controllers/main.js module.exports.index = function(req, res, next)  {     res.render('index', { title: 'Authentication Demo' }); };

Refactor routes/index.js, cont’d From: To: /*  * GET registration page.  */ router.get('/register', function(req, res) {     res.render('register',               { message: "Please register!" }); }); app_server/routes/index.js router.get('/register', ctrlMain.get_register); app_server/controllers/main.js module.exports.get_register = function(req, res) {     res.render('register',               { message: "Please register!" }); };

Refactor routes/index.js, cont’d Refactor the other routes the same way. Also: app_server/routes/index.js /*  * GET protected page.  */ router.get('/protected_page', ctrlMain.loggedIn, ctrlMain.get_protected_page); module.exports.loggedIn = function(req, res, next) {     console.log("Checking if logged in:");     if (req.session.user)     {         // Proceed if the user is logged in.         console.log("Logged in: "); console.log(req.session.user);         next();       }      else          console.log("Not logged in");         res.send("You must first log in.");     } } app_server/controllers/main.js

The MEAN Full Stack Architecture Full stack: All the components of a web app. client side server side database server The MEAN stack MongoDB Express AngularJS (different from Angular 2) node.js

AngularJS A JavaScript framework for working with data directly on the client side. Traditional web app: App logic and data processing on the server HTML page views and user interactions on the client AngularJS: Move some or all app logic and data processing to the browser. The server might only pass data from the database.

AngularJS, cont’d jQuery: AngularJS: Provides interactivity to a web page Takes effect after the HTML has been sent to the browser and the Document Object Model (DOM) has completely loaded. AngularJS: Comes in earlier and helps put together the HTML based on the provided data. Two-way data binding

AngularJS Two-Way Data Binding Live view of the data. The view is bound to the model. Immediately update the HTML if the data changes. Immediately update the data if the HTML changes.

AngularJS Two-Way Data Binding, cont’d Traditional: Two-way data binding: Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

JavaScript is the Common Language JSON is the common data format. Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

Single-Page Application (SPA) AngularJS is designed to support SPA functionality. Everything runs inside the browser. application logic data processing template delivery user navigation Never do a full page reload. But slower first page load.

Single-Page Application (SPA), cont’d Greatly reduces the amount of resources needed on the server. Each user’s browser does the hard work. The server basically only serves static pages and data upon request. Better user experience. Fewer calls to the server. Reduced network latency.

Hybrid Applications Example: A blogging application: Blogging interface for users: Not ideal for an SPA Admin interface: Ideal for an SPA Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

Hybrid Applications, cont’d Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

Application Design Options Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

AngularJS App Development Steps Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

AngularJS App Development Steps, cont’d Getting MEAN with Mongo, Express, Angular, and Node by Simon Holmes Manning Publications, 2015

AngularJS App Development Steps, cont’d

AngularJS App Development Steps, cont’d

Network Architectures

Network Architectures, cont’d Scale out MEAN apps with server clusters.