software development - the java perspective
TRANSCRIPT
Software Development= the Java perspective =
Database
Storage
>GET SALES TOTAL
>GET SALES TOTAL
GET LIST OF ALL SALES MADE LAST YEAR
ADD ALL SALES TOGETHER
4 TOTAL SALES
QUERYSALE 1 SALE 2 SALE 3 SALE 4Data tier
Presentation tier
Logic tierThis layer coordinates the application, processes commands, makes logical decisions and evaluations, and performs calculations. It also moves and processes data between the two surrounding layers.
Here information is stored and retrieved from a database or file system. The information is then passed back to the logic tier for processing, and then eventually back to the user.
The top-most level of the application is the user interface. The main function of the interface is to translate tasks and results to something the user can understand.
Three-Tier Architecture
Three-Tier Architecture
The Presentation Tier
<html><head>
...</head>
<body>...
</body></html>
Hyper-Text Markup Language
start tag
data related to the pageCSS, JS, page title, etc.
actual page content
end tag
HTML 5 layouts
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_layout_divs
HTML - Demo
#header { background-color:black; color:white; text-align:center; padding:5px;}
Cascading Style Sheets
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_layout_divs
http://www.mezzoblue.com/zengarden/alldesigns/
http://www.csszengarden.com/217/
http://www.csszengarden.com/215/
CSS - Demo
var sum = function() { var i, result = 0; for (i = 0; i < arguments.length; ++i) { x += arguments[i]; } return result;}
sum(1, 2, 3); // returns 6
JavaScript
public int sumAll(int... numbers) { int result = 0; for(int i = 0 ; i<numbers.length;i++){ result+=numbers[i]; }
return result;}
sum(1, 2, 3); // returns 6
JavaScript is NOT Java
JavaScript is NOT Java
JavaScript Java
Can Run in a Browser? Yes Yes, with applets (old technology)
Can Run on a Server? Yes (e.g. Node.js) Yes
Compiled? No, interpreted Yes, to bytecode
Threads Single-threaded Multi-threaded
Types Loose typing Strong typing
Characteristics Prototype-basedHigher-order functions
Classes
JavaScript is NOT Java
Database
Storage
>GET SALES TOTAL
>GET SALES TOTAL
GET LIST OF ALL SALES MADE LAST YEAR
ADD ALL SALES TOGETHER
4 TOTAL SALES
QUERYSALE 1 SALE 2 SALE 3 SALE 4Data tier
Presentation tier
Logic tierThis layer coordinates the application, processes commands, makes logical decisions and evaluations, and performs calculations. It also moves and processes data between the two surrounding layers.
Here information is stored and retrieved from a database or file system. The information is then passed back to the logic tier for processing, and then eventually back to the user.
The top-most level of the application is the user interface. The main function of the interface is to translate tasks and results to something the user can understand.
Presentation --> Logic
A method of communication between two devices over a network.
Web Services (WS)
A method of communication between two devices over a network.
Web Services (WS)
REST
● Exposes RESOURCES which represent DATA
● Uses HTTP verbs (GET / POST / DELETE)
● Simple point-to-point communication
● Multiple data formats (XML/JSON)
● Stateless communication
SOAP
● Exposes OPERATIONS which represent LOGIC
● Uses HTTP verb: POST● Loosly coupled distributed
messaging● Only XML● Supports stateless and stateful● Async messaging● Strong typing (WSDL)
Data Formats
JSON{ "books": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95, "copies": 3 }, { "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99, "copies": 5 } ]}
XML
<books> <book> <category>reference</category> <author>Nigel Rees</author> <title>Sayings of the Century</title> <price>8.95</price> <copies>3</copies> </book> <book> <category>fiction</category> <author>Evelyn Waugh</author> <title>Sword of Honour</title> <price>12.99</price> <copies>5</copies> </book></books>
SOAP
Request<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body> <GetWeather xmlns="http://www.webserviceX.NET"> <CityName>New York</CityName> <CountryName>United States</CountryName> </GetWeather> </soap12:Body>
</soap12:Envelope>
SOAP
Response<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body> <GetWeatherResponse xmlns="http://www.webserviceX.NET"> <GetWeatherResult>
Wind from the NW (320 degrees) at 13 MPH Visibility 3 mile(s)SkyConditions overcastTemperature 39.9 F (4.4 C)
</GetWeatherResult> </GetWeatherResponse> </soap12:Body>
</soap12:Envelope>
REST
RequestGET /globalweather.asmx/GetWeather?
CityName=NewYork&CountryName=United%20States HTTP/1.1 Host: www.webservicex.net
ResponseHTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length
<string xmlns="http://www.webserviceX.NET">Wind from the NW (320 degrees) at 13 MPH Visibility 3 mile(s)SkyConditions overcastTemperature 39.9 F (4.4 C)
</string>
SOAP and REST
A web server serves up static resources (HTML, CSS, JS, text, images, etc.)
and nothing else.
A servlet container is using Java to dynamically generate the web page on
the server side.
An application server supports the entireJava Enterprise Edition stack
(JEE, formerly known as J2EE)
App Servers
A web server serves up static resources (HTML, CSS, JS, text, images, etc.)
and nothing else.
App Servers
A servlet container is using Java to dynamically generate the web page on
the server side.
App Servers
An application server supports the entireJava Enterprise Edition stack
(JEE, formerly known as J2EE)
App Servers
Database Management Systems is an umbrella term that refers to the systems that handle, or heavily assist in handling, dealing with collections of information that need to be persisted.
DBMS are based on database models, structures defined for handling the data:● The Relational Model● The Model-less, Schema-less (NoSQL) Approach
Popular DBMS:● Relational (RDBMS)● NoSQL (NewSQL)
Databases
Relational (RDBMS)
Relational (RDBMS)
Database Management Systems is an umbrella term that refers to the systems that handle, or heavily assist in handling, dealing with collections of information that need to be persisted.
DBMS are based on database models, structures defined for handling the data:● The Relational Model● The Model-less, Schema-less (NoSQL) Approach
Popular DBMS:● Relational (RDBMS)● NoSQL (NewSQL)
Databases
Relational (RDBMS)
NoSQL databases
Schema-less databases do not come with a model as used (or needed) with structured relational solutions.
●Key-values Stores●Column Family Stores●Document Databases●Graph Databases
NoSQL databases
Key-values Stores: Using a hash table where there is a unique key and a pointer to a particular item of data.
NoSQL databases
Column Family Stores: There are still keys but they point to multiple columns. The columns are arranged by column family.
NoSQL databases
Document Databases: The model is basically versioned documents that are collections of other key-value collections. The semi-structured documents are stored in formats like JSON.
NoSQL databases
Graph Databases: Instead of tables of rows and columns and the rigid structure of SQL, a flexible graph model is used.
NoSQL databases
Term Matching Databases
Key-value
Memcache, Redis, Riak, Dynamo, FoundationDB, Aerospike, FairCom c-treeACE
DocumentMongoDB, CouchDB, Couchbase, MarkLogic Clusterpoint,
Column Cassandra, Accumulo, Hbase, Druid, Vertica
GraphNeo4J, InfiniteGraph, OrientDB, Allegro, Virtuoso, Stardog
History of NoSQL
HTML + CSS + JSREST API
Java application serverMySQL database server
Demo