CS436/636 Wed., Sept. 6:  First Class

Database apps including UI (user interface): we will cover line-oriented and web UI (browser on client).

Databases handle long-term data for dynamic websites all over the world.

Prereq: CS430/630 or equivalent database background, CS310 or Java including Collection classes such as HashMap and TreeSet

Useful: HTML, XML, JUnit, ant, but will cover these.

If your Java isn't strong, consider taking cs637 next term, just as useful as a prerequisite to cs680.  See comparison grid cs636/cs637 on class web page.

Look at syllabus. Collect student-info sheets.

Be sure to get a UNIX/Linux account for cs636 by Friday, 9/8, to list your username for the needed Oracle and mysql accounts, and access to topcat.cs.umb.edu.

Assignments: hw, programming projects, by pairs later on.

hw1 due Mon, 9/18 is available—see link from the class web page at www.cs.umb.edu/cs636.

Class project on music store from Murach’s text. See pg. 664 for non-portable SQL for tables. Challenge: see if you can make it portable.

Reading: Murach, Chap. 1. You could also start reading Chap. 11-12 on databases (specifically MySql), starting at pg. 364.  I’ll create a mysql database for you using mysql on topcat.cs.umb.edu. We’ll also use Oracle.

1. Development Tools

PC

Linux

Java, Eclipse, Ant

Java, Ant

Develop on PC, deliver on Linux

Eclipse has built-in help. We'll cover ant soon.

See dev setup instructions linked to class web page www.cs.umb.edu/cs636.  Try this by Monday. Also apply for UNIX account.

2. Intro.

TDD Test-Driven Development

--Tests First or Very soon

- we will use JUnit for unit testing

Inversion of Control “Hollywood Principle”

--don’t call us, we’ll call you

-- Each object should only passively accept references to other objects, not itself create a dependent object.

---> good software, better testing

Details: Problem with creation of a dependent object:
If class A creates an object of class B, that means that the code in A has b = new B() somewhere, but this requires that B is a concrete class, not just an interface.  We can't substitute a "fake" (mock) test class for B, as is often done in testing.
What you should know:

Idea of enterprise development—serious programming efforts, lasting years we hope, maintainable.

Involving different kinds of people: artistic types, programmers, etc.

3. Client Server vs. Web-based Architecture

Note that the JDBC connection is relatively long-lived here, usually lasting the whole time the client is running.

  

client-server.gif

 

4. Web-based (Browser as Universal User Interface) See Murach, pp. 6-11

HTTP over TCP/IP is used between the browser and the web server.

client-web.gif

The web server program hands off the request to the web app, which runs on the same system as the web server.  The web app makes a JDBC connection (over TCP/IP) to the database, which may be running on the same computer system as the web server, or on another computer. (In fact, the web server and web app may share a single process.)

The JDBC connections are short-lived, lasting only for one HTTP request cycle. But really, they are being “borrowed” from a pool of live connections and used for the short time. More on this later.

The browser: a "universal client". The browser's ability to interpret HTML that we supply from the server is crucial. HTML supports fill-in forms, links, and buttons as well as text formatting and image display. This is enough to create many useful user interfaces for applications, without any use of Javascript. Thus we will avoid using Javascript in the projects for this course. We will use the Chrome browser in class examples.

What about Javascript? Javascript is becoming more and more important for large commercial sites. Although server-provided HTML can do forms and links and buttons, the responsiveness is a little sluggish, especially over poor network connections like cell phones often have. Every user input operation involves a round-trip to the server. Javascript runs in the browser, and can respond to the user right away.

Also, all current browsers support Javascript without any installation by the user. Javascript programs can be linked from HTML and downloaded as needed without any user interaction other than the request for the HTML. Thus an app can have UI code written in Javascript that runs on a smart phone or on a desktop system. The Javascript program running in the browser can access server data using Ajax, i.e., issue its own HTTP requests to the server that originally provided the HTML.

Node.js Javascript usually runs in the browser, but, like any other computer language, can run on its own once someone has written the appropriate compiler. Node.js is a software system for running Javascript outside any browser. Its compiler is actually the compiler used inside of Chrome. Node can serve HTTP requests using a Javascript program to generate the response HTML, i.e., Javascript is "running on the server".

Node.js can also serve HTML with linked Javascript, and serve the program.js files as they are requested by the client, a browser.  Thus it is possible to have a full web application with client and server code written in Javascript.

Any interest in a no-credit reading course on Javascript? Follow the book "Learning Web App Development: Build Quickly with Proven JavaScript Techniques" by Semmy Purewal $23.87 at Amazon. Limit 5 students, with preference to students who have taken cs637. Send me email if interested.

Javascript Showcase What we can't do (without Javascript)!  Bugs walking around on screen

A Big Problem with Javascript

Javascript can be a problem for blind users and others with specialized browsers, because the embedded Javascript programs can't be analyzed in general by the specialized browser. Thus those who want an accessible site need to implement the site without custom Javascript. The US and state governments strive to provide accessible sites. See http://www2.itif.org/2017-benchmarking-government-websites.pdf for a report by ITIF on US government websites, including accessibility scores. Note that ITIF is a well-known non-partisan organization (Wikipedia page).

Example US government site with 100% accessibility score: https://www.whitehouse.gov. Also fema.gov. Should be able to turn off Javascript and still understand these sites. 

ACA site: https://www.healthcare.gov/ Accessibility score only 84%.

These websites show us what can be done without Javascript in use, i.e., using the technology we'll cover in this class. Also see examples on class web page:
 photo carosel (wait a bit for this to start) dropdown in menu bar.

But back to this course: program in Java, use HTML and JSP