TT284 Tutorial 4 B2P1P2
TT284 Tutorial 4 B2P1P2
Tutorial 4
Part 1: Architectures
• Design at this level is often termed the ‘architecture’ of a system.
• Architecture specifies the components that make up a system, their
functionality and how they interact or communicate.
• architecture can relate to the products and components used to implement
a specific architecture
• This would not work well in the above example because the catalogue of
books will change regularly. An improvement might be to split the
application into two parts.
• One part, the client, can provide the interface for users and be distributed to them.
• The other part can be kept and run on the company’s own server machine
• The client application can display information and be used to pass
information to the server for searching, such as the title of a book.
• The client application, or software, that displays information is quite commonly
called the ‘presentation’ layer or tier.
Multi-tier architecture
• Both the client and the server parts can be further subdivided if this is
appropriate to the application.
• The client, for example, may be responsible both for some processing of data
(such as totalling) and for the presentation of information. These two functions
might be separated into two tiers at the client end.
• Meanwhile the server software might include one or more data stores (for
instance, in the form of a database system).
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 9
• In the following Figure, two more tiers on the server side: a data tier and
another tier that handles interactions with the data tier, such as retrieving
requested information or validating data that is put into the data stores.
• This tier, between the data tier and the web server application, is
sometimes termed the ‘middle tier’ or middleware. An application that
uses middleware to handle data requests between a user and a database
is said to employ multi-tier architecture.
• more tiers can be used and so the term ‘N-tier architecture’ is used
generally to mean any architecture that has more than two tiers.
• Advantages:
• Each tier can be changed more easily as it is less dependent
• the tiers or components are truly loosely coupled
SOA is based around the idea of breaking down an application into a set of
much smaller tasks that can be performed by small independent pieces of
software, each performing a discrete task commonly called a service.
Examples of services
• Currency conversion. A service that converts a sum of money from one
currency to another might be used in a wide range of circumstances. It
might be used, for example, to convert all the prices on a website store to a
customer’s local currency when they select this.
• Data storage. A service that allows data to be stored and later retrieved,
perhaps with a range of capacities, costs and timescales on offer.
• To find a service on the Web, a requester must know the location (a URL
for example) of a directory service and then search the directory for the
type of service required. The directory provides a description of the
service, where it is located on a network (often the internet) and how to use
the service. The requester can then make a connection, or ‘bind’ to the
service. This allows the requester to put a request to the service, which the
service processes before returning any response required.
• Commonly the protocols used in SOA include HTTP, FTP and SMTP
• These four layers are termed the web services protocol stack.
• The upper layers build on the lower levels so, for example, service
descriptions are expressed using XML, and SOAP messages are
usually exchanged using HTTP.
Web services
protocol stack
Note: there are special ‘business process’ languages for organizing (or ‘orchestrating’) web services, such as
WS-BPEL, which is a standard maintained by OASIS, and Business Process Model and Notation (BPMN),
which is currently maintained by the Object Management Group.
SOA properties
• The SOA model (with its ‘publish’, ‘find’ and ‘bind’ operations), together with
the small size of operations embodied by services, leads to a very flexible
solution.
• Not all the services used in a process may be provided by the organization.
Third-party services can be included in a process.
• Ex: an organization taking orders in foreign currencies might use a currency exchange
service provided by a bank to convert the cost of an order from sterling to the customer’s
local currency.
• Another important property of the SOA model is that services are called
only at the point in time when they are needed. This is often termed ‘Just-
in-time’ use of services.
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 24
Cloud architecture
• SOA is well placed to take advantage of a recent development known as
‘cloud technology’ based on what is often termed ‘the Cloud’. Cloud
technology is an emerging advance at this time and there is a lack of clarity
as to what the term will really come to mean. Some definitions restrict the
Cloud to mean that virtual servers are made available and used over the
internet, but more generally the Cloud is seen as consisting of a wide range
of different resources.
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 25
Realizing an architecture
A few products
There is an enormous range of products available. Examples:
• Client tier
open source option that is fully HTML- and HTTP-compliant as well as quite popular such as
FireFox which is freely available. Most of the features of FireFox are based on the open
HTML, XML standards
• Server tier
Microsoft’s Internet Information Services (IIS) or Zeus. Apache is freely available as open
source software. IBM HTTP Server
• Middle tier
‘Apache’ can run languages such as PHP, code in PHP and run the business logic programs
on the same server as HTML web pages. Tomcat. This application server is also an ‘Apache’
project and can communicate with the Apache web server.
• Data tier
MySQL as this is another freely available product. This database management system
(DBMS) allows any number of actual databases to be created for holding and managing data
and can easily have both the sales records and stock levels databases.
Contents
• A thin client has little internal logic so it will not do very much work and will
perform only quite simple functions. The thinnest client will simply present
information. An HTML browser that simply renders HTML, images, etc., as
pages is a good example of this.
• So a thin client typically results in frequent exchanges with the server, with
the user waiting for the server to respond between each update on the
client side see Figure:
Thick clients
• the thick client may download data as if directly from the data layer, In
some cases, establish their own private connections to a data layer outside
of the HTTP.
• it will be quite a complex piece of software that may be difficult to install,
run and manage across a large number of different client machines and
their (usually) different environments. By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 33
Domenig’s
architecture
options
• Activity:
• Discuss the ‘clients’ and consider the following software that
you can run on your own machine and consider how ‘thick’ or
‘thin’ you would consider it to be:
• Google Earth
• Street Map
• Skype
Browser-based clients
• The most common client, of course, is simply a browser. Most
browsers also support the use of extensions, commonly
known as ‘plug-ins’, which provide some additional
functionality. A number of browser extensions exist, including:
• Flash
• Java
• VBScript
• ECMAScript
Back to forms
• Both HTML and CSS are very frequently used in combination with
JavaScript, a client-side programming language that allows much greater
functionality and interactivity to be supported within web pages on the client.
• A web page can be seen as composed of a set of layers
JavaScript
• is a programming language and often called a scripting language.
• just one client-side scripting language
• JavaScript can be embedded in any XHTML page
• JavaScript can be natively interpreted by most modern browsers, without
the use of plug-ins
• Computations and actions are executed on the client side, and there are
situations in which this is preferred, for example to add responsiveness to a
web page
• JavaScript is ‘mainstream’, meaning that it is recognized as a useful
language, a standard and as having some longevity.
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 40
In line 20 the area that the user has typed into the form is retrieved from the
form and converted to a number. This is done by using a reference into the
form: document.floorOrderForm.msquared.value
This reference is based on what is termed the ‘Document Object Model’
(DOM) of the web page. When the page is loaded in a browser, it is parsed
and a set of objects are created that correspond to the different items found
in the page (forms, headings, etc.).
• If the value cannot be used to generate a number then the value ‘Not-a-
Number’ (‘NaN’) is returned.
• The ‘onClick’ feature of a button is an event that is called when the user
clicks on the button.
• Do Activity 3 and 4.
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 44
• The DOM provides a very sophisticated set of functions for accessing and
manipulating documents and forms. These ‘functions’ are more correctly
termed ‘methods’ as they are part of the objects making up the DOM (see
w3schools.com (n.d.(c)) on ‘HTML DOM properties and methods’).
• The first of these DOM functions searches for an element with the specified value of
a parameter called ‘id’. So to use this approach, you first need to change or add an
‘id’ to the form element:
<input type="text" id="msquared" size="3" maxlength="4" />
Then you can access the value of the form field using:
document.getElementByID(‘msquared’).value
• Names are used as the names of the parameters, and may be non-unique (which
allows for checkbox groups, radio button groups, etc). IDs are used to refer to the
element within the document from JavaScript, and must be unique to the document.
If the ID is not unique, then the first element with the specified ID is used, which
makes it difficult to access subsequent elements.
• The other two functions, ‘getElementsByName’ and ‘getElementsByTagName’,
return a number of results as an array.
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 46
• The JavaScript below gets all the elements in the document that are of
HTML tag type ‘input’. It then uses a loop to write the names of all of these
elements out as part of the page being loaded.
<script type="text/javascript">
/* <![CDATA [ */
document.write("<p/>");
elements = document.getElementsByTagName('input')
for (elementNum=0; elementNum<elements.length; elementNum++)
{
document.write(elements[elementNum].name);
document.write("<br/>");
}
/* ]]> */
</script> Do Activity 5 and 6
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 47
• The upper levels of the model consist of a few fixed objects that are always
accessible to JavaScript
Do Activity 7
By: Dr. Monif Jazzar. AOU-KW
3/5/2015 TT284: Web Technologies 50
End of Tutorial 4
Have a nice day