12- Exam Procedure And course summaryunibz.ectrldev.com/awslab13/12-ExamProcedureAndSummary.pdf ·...
Transcript of 12- Exam Procedure And course summaryunibz.ectrldev.com/awslab13/12-ExamProcedureAndSummary.pdf ·...
12- Exam Procedure And course summary
A. Venturini
Exam
Final dates:
28-30-2013 deadline for the delivery of reports and application
Send by email (use read receipt) to [email protected]
Send the zip file with the application (in case use some file
transfer server
source code
Instruction on how to install the app (sql scripts if needed,
settings)
report
3-07-2013. Project results communicated via email to the
students.
05.07.2013 14:00-16:00 : Written Exam
Examination deliverables
Project: 15 marks:
1) Project Report (correctness of design,
readability) (7,5 marks)
2) Developed portlets (functionality, source
code) (7,5 marks)
3) Written exam (15 marks)
From 15 to 20 questions on the topics of the
course
Threshold for each step: 9 points
Report (1)
To allow different potential readers to understand
your project
For the user or customer
To understand the functionalities that are
provided
For the software architect
To understand the structure of the modules
For the developer
To understand the components to be developed
For the system administrator
To know which are the major building blocks and
how should be deployed
Report (2)
It should be a simple architecture Document
Table of Content:
Introduction
Description through GUI snapshots
Use Case View (could be omitted if the GUI is
sufficiently described)
Infrastructural View
Logical View
Deployment view
Include UML diagrams
Use Cases (1)
Provide a description of the major user functions,
by higlighting the actors (people or external
systems) interacting with the system, from a
functional point of view
Not how the function will be implemented, but
which functionalities the system provide
Use Cases (2)
Use case Diagrams
Actors
Different types of users that interact with the
system
Diagram summarising the use cases
Description of each use case, in a descriptive
form
Use case Diagram: Example
Name: Register Participant User
Actor: The Administrator
Description: This use case describe how to register a
participant into the portal
Precondition: The administrator should be logged
Postcondition: The new user is registered
Basic Flow:
The administrator enter in to the user admin section
…..
The new user has been created
Alternative flow (if any): if the user name already exist,
a different user name suggestion is shown…..
Use Case Description: example
Logical View
Multiple sections, each with one or more
diagrams
Each diagram should be described in the
appropriate section
Presentation Layer
Logical View High Level Architecture (put your major components there)
Services Layer
Dao Access Layer
My GUI Components
Data Beans
Data access pattern
MVC Pattern
Repository
MyService
MyDaoComponent
MyBean
Logical View – Class diagrams
All the layers of the application
Web Layer
Service Layer
Data layer
Class diagram (classes and interfaces)
Use relationships in the correct way
Goal is to provide a good comprehension of the
system
Weather Portlet Class diagram
Logical View – Sequence diagrams
Consider the most significant use cases
Show, by means of sequence diagrams, the
sequence of methods are called when the use
case is executed
It should touch all the layer of the application
Example Class diagram
WeatherPortlet
+doView()
+processAction()
WeatherServiceFactory
+createInstance(): WeatherService
+getFactory(type: String)
WeatherComService
YahooWeatherService
WeatherService
<<interface>>
+getWeatherByCity()
WeatherComServiceFactory
+createInstance(): WeatherService
YhaooWeatherServiceFactory
+createInstance(): WeatherService
Infrastructural View
Infrastructural components, description, roles
and motivations.
Major technologies used
Often is a layered diagram
Example infrastructure view
Application Services
Phisical view
Consider a simple Phisical view:
One physical server hosting the RDBMS and
the portal server
Describes the configuration parameters (db
connection for example)
Coding
Use the best practices we introduced
The code should reflect the design !
Package names should reflect patterns adopted
and application layers
Comment the code (at least the signatures of the
interfaces)
Suggestions:
Start from the Rolodex portlet. Clean it up and
adapt to your needs
http://unibz.ectrldev.com/awsmaterial/Rolodex
-portlet.zip
Summary of the lectures
Software Architecture
Software architecture deals with the design and
implementation of the high-level structure of the
software.
To describe a software architecture, are used a
model composed of multiple views or
perspectives.
In a “Software Architecture Document”, typically
each view is one or more chapters
The project report should be structured like a
software architecture document
4+1 View Model
Ref: Architectural Blueprints—The “4+1” View Model of Software
Architecture, Philippe Kruchten, IEEE Software, 12
Logical View
The logical view is the object model of the design
supports the functional requirements—what the
system should provide in terms of services to its
users.
The system is decomposed into a set of key
abstractions, taken (mostly) from the problem
domain, in the form of objects or object classes.
They exploit the principles of abstraction,
encapsulation, and inheritance.
Class diagrams and sequence diagrams
Scenarios
The elements in the four views are shown to work together
seamlessly by the use of a small set of important scenarios
(instances of more general use cases)
The scenarios are in some sense an abstraction of the most
important requirements. Their design is expressed using
object scenario diagrams and object interaction diagrams.
A driver to discover the architectural elements during the
architecture design
as a validation and illustration role after this architecture
design is complete, both on paper and as the starting point
for the tests of an architectural prototype.
Portlet Technology
JSR 168 Value Proposition: Portability of Portlet Apps
JSR 168
Compliant
Portals
Write Once
Deploy to Many
Po
rtle
t In
terf
ace
What is a Portlet?
Java technology based web component
Managed by a portal container
Generates a piece of markup called “fragment”
Adheres to certain rules such as no <html>
tags, for instance
Fragment generated by a Portlet aggregates
with that from other Portlets to form a portal
page
Fragment generated by a Portlet may
vary from one user to another depending
on the user configuration
Portlet Specifications
JavaTM Portlet Specification
First version: JSR 168
Second version: JSR 286
http://www.jcp.org/en/jsr/detail?id=286
Standard specificatitons defined by the major
portal vendors (ibm, sun, bea, …) for portlet
technologies
Portal and Portlet Interaction
User Portal Portlet
container
Portlets
A B C
render
render
render
processAction
A
B C
A’
B’ C
Action on B Do action on B
Render A
Render B
Render C
These requests
may be done in
parallel
Scope of the Portlet specification Outside of the scope of the Portlet specification
JSR 286
JSR 168 and JSR 286 are specifications defined
by the JCP, Java Community Process Program
JCP is Program for the development and revision
of Java technology specifications, introduced by
SUN
Specifications led by Martin Scott Nicklous (IBM)
Expert group formed by the major players
(Oracle, Sun, Vignette, BEA, Liferay, Red Hat,
TIBCO…)
http://jcp.org/aboutJava/communityproces
s/final/jsr286/index.html
Extension introduced by JSR 286
JSR 286 allows portlets to send and receive
events
Request lifecycle as extended by JSR286
serveResource
View Technologies
“Models” of JSP development
Origin of the terms “model 1” and
“model 2.”
JSP 0.92 spec: “You can apply the JavaServer
Pages technology in two ways . . . Model 1: A request sent
to a JavaServer Pages file. . . . Model 2: A request sent to
a Java Servlet.”
Simple “model 2” example public void doGet(HttpServletRequest request
HttpServletResponse response) {
// business logic that results in object ’data’
request.setAttribute(”d”, data);
sc.getRequestDispatcher(”/view.jsp”);
}
view.jsp
We have some data to display: <b>${d.property1}</b>
• In this case, the data passed is a simple bean-style object. It could also be an XML document; we’d then use JSTL’s XML-manipulation tags.
JSTL 1.0 libraries
Library features Recommended prefix
Core (control flow,
URLs, variable access)
c
Text formatting fmt
XML manipulation x
Database access sql
Major patterns and how they are adopted in the Spring Framework
The Inversion of Control Pattern
Design
and
maintainability
issues
Design maintainable systems
Design maintainable systems
= cope well with change and iterations
key issue: manage dependencies
Other important aspects/techniques:
Design by Contract
clearly define the Contract of a class/interface
(Javadoc)
Contract: what it does, how it behaves
NOT how it is implemented !
Unit Testing
write tests that verify the class/interface's Contract
Separation of Concerns
write a class/interface for every single Concern
The
Inversion of Control
Pattern
The Inversion of Control Pattern
Inversion of Control (1/5)
A way of wiring components together
wiring = assembling, putting Collaborators together
You define
Interfaces and implementations
Dependencies between
interfaces/classes
(making them “Collaborators”)
the Inversion of Control container
assembles the Dependent and the Provider,
injects the Provider into the Dependent
gives you the possibility of selecting which Provider
implementation to inject into each Dependent
(by configuration, code or automatically (autowiring))
Inversion of Control (2/5)
WeatherPortlet
<<interface>>
WeatherService
YahooWeatherService WeatherComService
IoC
Container
MVC pattern
45
Model-View-Controller pattern goals
there are often many ways to present the same problem
requirements on how a problem is displayed tend to change
(i.e., “experimentation” goes on)
the MVC design tries to separate the code that represents
the problem from the code that presents the problem to the
user
this allows the “presentation” part to be change more
easily
this “pattern” arose because management has so often
demanded that programmers modify presentation
without the correct design, that’s “hard”
with this pattern, it becomes much “easier”
46
the three roles
the Model contains data that represents the problem
the Controller responds to user actions by telling the Model how to change
the View displays the current state of the Model to the user
Front Controller Pattern
User
A
B
C
access
users access multiple resources, but there isn’t a common entry point
Problem: Java code or jsps
Problem
How to code common code to all requests like:
Dispatching to a view
Authorization: the user can or cannot access
the resource ?
Session handling
Parsing parameters common to all requests
…..
Front Controller
User
A
B
C
Access...
The front Controller is the controller which handle a generic request
Front Controller
Solutions:
Application Controller
Front controller is a common entry point
But how each request is mapped to the specific code
handling the user request ?
How the right view to be shown after a controller is
being executed is selected ?
In general: how to hook user requests to the right
action or render logic ?
Problem:
Application Controller
Users
view. A
Access Front Controller
delegates
delegates
View Controller
Action Controller
Act. X
Act. Y
view. B
Application Controller
Solution:
Spring MVC Architecture
Portlet Container
Dis
patc
he
rPort
let (S
pri
ng
)
ProcessAction
Render()
Handler Mapping (Spring)
1. Lookup action handler
4. Dispatch to a render controller
5. Return ModelAndView
Controllers (implemented by you)
View Resolver (Spring)
6. Looks up view resolver
Views (JSPs,… implemented by you)
7.Delegates rendering
Action Controller (implemented by you)
2. Dispatch to the action Controller
Handler Mapping (Spring)
3. Lookup render handler
Object-intensive app
Database
Other apps
ORM
Object-Relational Mapping (ORM)
• A software system that shuttles data back and forth between database rows and objects • Appears as a normal database user to the database • Can share the database and tables with other apps
53
pizza_order
topping
pizza_size
id sizeid (FK) room status
order_topping
id name
orderid (FK) toppingid (FK)
id name
PizzaOrder Topping
PizzaSize
0..* 0..*
0..*
Classic Relationships
Schema mapping, entities to tables and vice versa
Needed database schema: has one table for each entity, plus a link table for N-N relationship
1
54
Inheritance Hierarchies
Both Hibernate and EDM can handle inheritance hierarchies and polymorphic associations to them
Both Hibernate and EDM provide single-table and multiple-tables per hierarchy solutions
Single-table: columns for all subtypes, null values if not appropriate to row’s subtype
Multiple-table: table for common (superclass) properties, table for each subclass for its specific properties, foreign key to top table
Also hybrid: common table plus separate tables for some subclasses
55
Option
Topping Shape
∙ color
∙ id
∙ name
∙ aspect
Aspect Oriented Programming (AOP)
Applications must be concerned with things like:
Transaction management
Logging
Security
Do these responsibilities belong to the
implementation classes?
Should a service class be responsible for
transaction management, logging, or security?
These concerns are often referred to as
“crosscutting” concerns
Transactions
A basic unit of consistent and reliable computing
in databases
One or multiple queries in one transaction
A sequence of databases reads and writes, and
computation
An execution of a program
Some reference:
http://static.springframework.org/spring/docs/1.
2.x/reference/transaction.html
Declarative Transactions
Declarative transactional support can be added
to any bean by using
TransactionProxyFactoryBean
Similar to EJB, transaction attributes may be
defined on a per-method basis
Also allows definition of pre- and post-
interceptors (e.g. for security)
59
Transaction Support (2)
Caller: are your controllers Proxy: ReservationService. acts like the target Target: ReservationServiceTarget real implementation
60 07/06/2013 60
What is Ajax?
Diagram from: http://www.codeproject.com/KB/showcase/FarPointAJAX.aspx
07/06/2013 61
Ajax Example
07/06/2013 61
<body>
<script type="text/javascript">
function ajaxFunction(myStr) {
var xmlHttp;
try {
...
} // end of try section
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById('myElem').innerHTML =
xmlHttp.responseText;
}
}
$path = "http://www.cs.kent.ac.uk/people/staff/amlf/";
xmlHttp.open("GET",
$path + "reverse.php?str=" + myStr, true);
xmlHttp.send(null);
}
</script>
<!–- form goes here -->
</body>