objectives
play

Objectives Review: JavaScript Quality Attributes of Web Software - PDF document

Objectives Review: JavaScript Quality Attributes of Web Software Introduction to Relational Databases, SQL JDBC May 2, 2019 Sprenkle - CSCI335 1 JavaScript review True or False: JavaScript is just like Java How do you


  1. Objectives • Review: JavaScript • Quality Attributes of Web Software • Introduction to Relational Databases, SQL • JDBC May 2, 2019 Sprenkle - CSCI335 1 JavaScript review • True or False: JavaScript is just like Java • How do you declare a variable? (2 ways) • How do you write text to the web page? • What is the syntax for functions? • What are some examples of events? • How do you access a particular element in a document? Ø What are some ways to change that element? May 10, 2016 Sprenkle - CS335 2 1

  2. Most important points? DISCUSSION OF “QUALITY ATTRIBUTES” May 2, 2019 Sprenkle - CSCI335 3 Quality Attributes • How are web applications different from “traditional”/desktop applications? Ø Leads to differences in quality attributes • React to “For most application types, commercial developers have traditionally had little motivation to produce high-quality software.” • What are differences between 2002 (when article was originally published) and now? • Let’s add another point in the comparison: mobile apps Ø Compare mobile apps with web and desktop May 2, 2019 Sprenkle - CSCI335 4 2

  3. Comparison of Applications Attribute Traditional Web Applications Location On clients Client, Server (& more) Traditional languages and Languages Java, C, C++, etc. Scripting languages, HTML, Other languages Technologies Network, DB Programmers, graphics Development designers, usability Programmers Team engineers, Network, DB Returning customers; later Economics Time to market but better Infrequent (~monthly), Releases Frequent (~days), inexpensive expensive May 2, 2019 Sprenkle - CSCI335 5 Quality Attributes Attribute Web Applications Must work, or go to another site Reliability Must be usable, or go to another site Usability Protect user data, information Security 24/7/365 Availability Thousands of requests per second, more? Scalability Short maintenance cycle, frequent updates Maintainability Later but better is okay Time-to-market May 2, 2019 Sprenkle - CSCI335 6 3

  4. Discussion • What are examples of sites that you used to use but you switched because something better came along? Ø How easy is it to switch now? May 2, 2019 Sprenkle - CSCI335 7 DATABASES AND SQL May 2, 2019 Sprenkle - CSCI335 8 4

  5. Web Application Architecture Overview (HTML, CSS, JavaScript) DB or XML Web Application or text files User Interface Server Servlets, Datastore JSPs Java Model/ Application Backend State Automatically generate UI (HTML), Handle user requests Data structures, helper classes May 2, 2019 Sprenkle - CSCI335 9 Database Overview • Store data in such a way to allow efficient storage, search, and update • Relational Data Model - currently most popular type of database Ø Many vendors: PostgreSQL, Oracle, MySQL, DB2, MSSQL Ø Data is stored in tables Ø Attributes : column names (one word) Ø Often contain primary key : a set of columns that uniquely identify a row May 2, 2019 Sprenkle - CSCI335 10 5

  6. DB Popularity Ranking based on web site mentions, searches, questions, job offers, professional profiles, social network mentions https://db-engines.com/en/ranking May 2, 2019 Sprenkle - CSCI335 11 Example Students Table • id is the primary key • What are the attributes? id lastName firstName gradYear major 10011 Aaronson Aaron 2021 CSCI 43123 Brown Allison 2020 ENGL May 2, 2019 Sprenkle - CSCI335 12 6

  7. Example Students Table • id is the primary key • What are the attributes? Attributes id lastName firstName gradYear major 10011 Aaronson Aaron 2021 CSCI 43123 Brown Allison 2020 ENGL May 2, 2019 Sprenkle - CSCI335 13 Courses Table • Primary key is ( Department, Number ) Ø As a group, these uniquely identify a row department number name description Survey of CSCI 101 Computer Science A survey of … Fundamentals of An introduction CSCI 111 Programming I to … May 2, 2019 Sprenkle - CSCI335 14 7

  8. SQL: STRUCTURED QUERY LANGUAGE May 2, 2019 Sprenkle - CSCI335 15 SQL: Structured Query Language • Standardized language for manipulating and querying relational databases Ø May be slightly different depending on DB vendor • Pronounced “S-Q-L” or “Sequel” May 2, 2019 Sprenkle - CSCI335 16 8

  9. SQL: Structured Query Language • Reserved words are not case-sensitive Ø I will tend to write them in all-caps and bold to distinguish them in the slides Ø Tables, column names - may be case sensitive • Commands end in ; Ø Can have extra white space, new lines in commands Ø End when see ; • Represent string literals with single quotes '' '' May 2, 2019 Sprenkle - CSCI335 17 SELECT Command SELECT • Queries the database • Returns a result—a virtual table • Syntax: Optional SELECT column_names SELECT FROM FROM table_names [WHERE condition] ; Ø Columns, tables separated by commas Ø Can select all columns with * Ø Where clause specifies constraints on what to select from the table May 2, 2019 Sprenkle - CSCI335 18 9

  10. SELECT SELECT Examples • SELECT SELECT * FROM FROM Students; id lastName firstName gradYear major 10011 Aaronson Aaron 2021 CSCI 43123 Brown Allison 2020 ENGL • SELECT SELECT lastName, major FROM FROM Students; lastName major Virtual Tables Aaronson CSCI Brown ENGL May 2, 2019 Sprenkle - CSCI335 19 WHERE Conditions WHERE • Limits which rows you get back • Comparison operators: >, >=, <, <=, <> • Can contain AND AND for compound conditions • LIKE LIKE matches a string against a pattern Ø Wildcard: % , matches any sequence of 0 or more characters • IN IN : match any • BETWEEN BETWEEN : Like comparison using AND AND , inclusive May 2, 2019 Sprenkle - CSCI335 20 10

  11. SELECT SELECT Examples • What do these select statements mean? Ø SELECT SELECT * FROM FROM students WHERE WHERE major='CSCI'; Ø SELECT SELECT firstName, lastName FROM students WHERE FROM WHERE major='CSCI' AND AND gradYear=2019; Ø SELECT SELECT lastName FROM FROM students WHERE WHERE firstName LIKE LIKE 'Eli%'; May 2, 2019 Sprenkle - CSCI335 21 SELECT Examples SELECT • What do these select statements mean? Ø SELECT SELECT lastName FROM FROM students WHERE WHERE major IN IN ('CSCI', 'PHYS', 'MATH'); Ø SELECT SELECT lastName FROM FROM students WHERE major NOT WHERE NOT IN IN ('CSCI', 'PHYS', 'MATH'); Ø SELECT SELECT firstName FROM FROM students WHERE WHERE gradYear BETWEEN BETWEEN 2019 AND AND 2021; May 2, 2019 Sprenkle - CSCI335 22 11

  12. Set vs Bag Semantics • Data structures review May 2, 2019 Sprenkle - CSCI335 23 Set vs Bag Semantics • Bag Ø Duplicates allowed Ø Number of duplicates is significant Ø Used by SQL by default • Set Ø No duplicates Ø Use keyword DISTINCT DISTINCT May 2, 2019 Sprenkle - CSCI335 24 12

  13. Set vs Bag lastName SELECT SELECT lastName Smith FROM FROM Students; … Smith Jones Jones SELECT DISTINCT SELECT DISTINCT lastName lastName FROM Students; FROM Smith Jones May 2, 2019 Sprenkle - CSCI335 25 Aggregates • Standard SQL aggregate functions: COUNT, COUNT, SUM, AVG, MIN, MAX SUM, AVG, MIN, MAX • Can only used in the SELECT SELECT part of query • Example Ø SELECT SELECT COUNT(*), AVG(GPA) FROM FROM students WHERE WHERE gradYear=2019; May 2, 2019 Sprenkle - CSCI335 26 13

  14. ORDER BY ORDER BY • Last operation performed, last in query • Orders: Ø ASC ASC = ascending Ø DESC DESC = descending • Example Ø SELECT SELECT firstName, lastName FROM FROM Students WHERE WHERE gradYear=2019 ORDER ORDER BY BY GPA DESC DESC ; May 2, 2019 Sprenkle - CSCI335 27 Majors Majors Table • Another table to keep track of majors • Primary Key: id id name department 1 ART-BA ART 2 ARTH-BA ART May 2, 2019 Sprenkle - CSCI335 28 14

  15. Changes Students Students Table • Use an id to identify major (primary key) Majors: Majors: id name department 1 ART-BA ART 2 ARTH-BA ART Foreign Key Students: Students: id last Name first Name gradYear majorID 10011 Aaronson Aaron 2021 123 43123 Brown Allison 2020 157 May 2, 2019 Sprenkle - CSCI335 29 Join Queries • Do a cross product of the joined tables • Example: Ø Performing a select on 3 tables, each with two rows A1 B1 C1 A2 B2 C2 Ø Results in A1 B1 C1 A1 B1 C2 A1 B2 C1 A1 B2 C2 A2 B1 C1 A2 B1 C2 A2 B2 C1 May 2, 2019 Sprenkle - CSCI335 30 … … … 15

  16. JOIN Queries • Join two tables on an attribute Majors: Majors: id name department 1 ART-BA ART 2 ARTH-BA ART Students: Students: id last Name first Name gradYear majorID 10011 Aaronson Aaron 2021 123 43123 Brown Allison 2020 157 SELECT SELECT lastName, name FROM FROM Students, Majors WHERE WHERE Students.majorID=Majors.id; May 2, 2019 Sprenkle - CSCI335 31 JOIN Queries • Join two tables on an attribute SELECT SELECT lastName, name FROM Students, Majors FROM WHERE Students.majorID=Majors.id; WHERE From Majors Majors From Students Students lastName name Aaronson CSCI Brown ENGL May 2, 2019 Sprenkle - CSCI335 32 16

Recommend


More recommend