Professional Documents
Culture Documents
It 12 Integrative Programming and Technologies Learnerx27s Module Unit Final Period
It 12 Integrative Programming and Technologies Learnerx27s Module Unit Final Period
IT 12
INTEGRATIVE
PROGRAMMING AND
TECHNOLOGIES
LEARNER'S MODULE
UNIT-FINAL PERIOD
Student's
Name
Contact
Number
1
UNIT COVERAGE
PRELIM COVERAGE
MIDTERM COVERAGE
PRE-FINAL COVERAGE
FINAL COVERAGE
2
Teacher: Earl Von V. Deiparine
Contact #: 09364181623
CHAPTER Facebook Account: Earl von Deiparine
1
Email Add.: deiparineefreak@gmail.com
Unit Period
Introduction to Integrative
Programming &
Technologies
3
Definition:
Integration of software refers to techniques for combining existing software components to form
a complete system. However, the software integration includes at least one existing software
system, developed in the past with no plan for its symmetric integration with another component
in the future.
Integrative programming deals with an integration approaches and techniques that connect
different components of IT infrastructure- people, applications, platforms and databases to
enable a secure, intra and inter application collaboration. Integrative solutions enable an
organization to integrate business processes internally and externally with business partners to
create dynamic environments that supports current and evolving business requirements, thereby
creating a global organization.
Application integration assists in unlimited sharing of data and business processes among
any connected applications or data sources in without making major changes to the applications
or data structures. Hence, integration is the process of connecting multiple, independently
developed applications using incompatible technologies into a single organization wide system
with information flowing seamlessly among the integrated systems or components.
Most of the applications that run in organizations’ hardly live in isolation. Whether the
registrar application must interface with the finance application, the human resource
management application must connect to each other, it seems like any application can be
made better by integrating it with other applications.
System integration
Given two or more systems, subsystems or components, each of which function properly
(satisfying their requirement within their environment). The problem is to integrate them into one
larger system satisfying the combined requirements within the newly formed environment.
Functional integration or technology integration
Given a software system, this may have been functioning properly in the field for 4a
significant period. The problem is to integrate a new function or a new technology
within the system. The integrated
system should provide the new functionality or use the new technology, while preserving the
original system functionality.
Incremental engineering
A software system can be developed and delivered using available technologies and with
less functionality than it is intended to finally provide. New technologies and or more functions
then can be integrated within the system. The problem is to design the system with such future
integration in mind.
Modification
Sometimes an existing and properly functioning software system must be decomposed and
integrated to carry out modification.
Technology change affects all layers; legacy does not go away so easily.
The architecture of the organization information system depends on constraints related to
the technology but also to the organization.
Within an enterprise, each department may have its own IT infrastructure, systems
and databases which are maintained independently. Integrating them may bring additional
value to the company.
Integration assists in formation of Zero Latency organization - when all functions within
the organization work with the same up-to-date information, latency between
applications is eliminated/ reduced.
Updating and integrating of applications is possible whenever required. New applications
can be created by integrating real time data from different parts of the enterprise
5
Integration models
Integration model defines how applications will be integrated by defining the nature of and
mechanisms for integration. Some of the methods used for application integration are discussed
in the following section. These models include;
Presentation integration
Data integration and
Function integration
1. Presentation integration model allows the integration of new software through the
existing presentations of the legacy software. This is typically used to create a new user
interface but may be used to integrate with other applications.
2. Data integration model allows the integration of software through access to the data
that is created, managed and stored by the software typically for the purposes of
reusing or synchronizing data across applications.
3. Functional integration model allows the integration of software for the purpose of
invoking existing functionality from other new or existing applications. The integration is
done through interfaces to the software.
4. Any two applications are different. Integration solutions need to transmit information
between systems that use different programming languages, operating platforms, and data
formats. An integration solution needs to be able to interface with all these different
technologies. Heterogeneous– each application implements its own data model. Concepts
may be shared, but representation mismatches are to be expected. Mappings and
transformations are required.
5. Change is inevitable. Applications change over time. An integration solution has to keep
pace with changes in the applications it connects. Integration solutions can easily get
caught in an avalanche effect of changes – if one system changes, all other systems
may be affected. An integration solution needs to minimize the dependencies from one
system to another by using loose coupling between applications. Autonomous –
applications update their state independently without coordinating with each other.
The systems to be integrated are maintained independently and upgraded at different
times.
7
Integrative Technologies/methods for integration
Application integration is an integration framework composed of a collection of technologies
and services which form a middleware or "middleware framework" to enable integration of
systems and applications across organizations. There are four methods used in application
integration, which are discussed in the section below:
1. File Transfer- one application writes a file that another later reads. The applications
need to agree on the filename and location, the format of the file, the timing of when it will
be written and read, and who will delete the file.
2. Shared Database- multiple applications share the same database schema, located
in a single physical database. Because there is no duplicate data storage, no
data has to be transferred from one application to the other.
File transfer
An organization naturally, runs multiple applications that are being built independently, with
different languages and platforms. How can we integrate multiple applications so that they work
together and can exchange information and interact with each other? The answer for this
question is given below;
One of the possible solutions to allow these applications to be integrated is allowing each
application produce files containing information that other applications need to consume.
Integrators take the responsibility of transforming files into different formats. Produce the files at
regular intervals according to the nature of the business, which can be consumed or read by
another file.
An important decision with files is what format to use. Very rarely will the output of one
application be exactly what's needed for another, so you'll have to do a fair bit of
processing of files along the way. Not just do all the applications that use a file
have to read it, you also have to be able to use processing tools on it.
8
Shared Database
A common data base can be used for integrating applications. A single physical data base can
be shared by different applications running on different platforms. This method integrates
applications by having them store their data in a single shared database.
If a family of integrated applications all rely on the same database, then we can be pretty
sure that they are always consistent all of the time. If we do get simultaneous updates to
a single piece of data from different sources, then we have transaction management
systems that handle that about as gracefully as it ever can be managed.
9
Remote procedure calls
This method develops each application which is required to be integrated as a large-scale
object or component with encapsulated data. And it provides an interface to allow other
applications to interact with the running application.
10
Messaging
Messaging allows interaction between applications possible. Message passing can be used to
transfer packets of data frequently, immediately, reliably, and asynchronously, or
synchronously using customizable formats.
The reason a messaging system is needed to move messages from one computer to
another is that computers and the networks that connect them are inherently unreliable.
Just because one application is ready to send a communication does not mean that the
other application is ready to receive it. Even if both applications are ready, the
network may not be working, or may fail to transmit the data properly. A
messaging system overcomes these limitations by repeatedly trying to transmit the
message until it succeeds. Under ideal circumstances, the message is transmitted
successfully on the first try, but circumstances are often not ideal.
1. Create - the sender creates the message and populates it with data.
2. Send - the sender adds the message to a channel.
3. Deliver - the messaging system moves the message from the sender’s computer to
the receiver’s computer, making it available to the receiver.
4. Receive - the receiver reads the message from the channel.
5. Process - the receiver extracts the data from the message.
11
This diagram illustrates these five transmission steps, which computer performs each, and which
steps involve the messaging system:
1. Send and forget - in step 2, the sending application sends the message to the
message channel. Once that send is complete, the sender can go on to other work while
the messaging system transmits the message in the background. The sender can be
confident that the receiver will eventually receive the message and does not have to wait
until that happens.
2. Store and forward - in step 2, when the sending application sends the message to
the message channel, the messaging system stores the message on the
sender’s computer, either in memory or on disk. In step 3, the messaging system
delivers the message by forwarding it from the sender’s computer to the receiver’s
computer, and then stores the message once again on the receiver’s computer.
This store-and-forward process may be repeated many times, as the message is
moved from one computer to another, until it reaches the receiver’s computer.
12
Middleware and Integrative architectures
Middleware is a software programming running at the top of operating system and below
the applications. It connects applications or software components. Middleware provides a
standard high level interface to the application developers and integrators, so that application can
easily interoperate. Interoperability is the ability of two or more components or systems to
exchange information.
There are three types of middleware. These are, transaction-oriented, object-oriented and
message oriented middleware.
13
Integrative architectures
Integrative architectures are the standard methodologies for application integration.
These architectures include, CORBA, DCOM and RPC. The architectures act as a middleware,
a software application that mediates between different applications.
CORBA is a software standard that is defined and maintained by the Object Management
Group (OMG). The Common Object Request Broker Architecture (CORBA) is a standard
architecture for a distributed objects system. CORBA is designed to allow distributed objects
to interoperate in a heterogeneous environment, where objects can be implemented in different
programming language and/or deployed on different platforms.
DCOM
Distributed component object model- extends the COM to support communication between
objects. DCOM is a software architecture or remote protocol that defines a binary standard for
component interoperability.
DCOM is a software architecture that allows applications to be built from binary software
components. Is binary interface standard for software components, that allows inter-
process communication. Binary interface is a program interface between binary program
modules often one of the module is library or operating system and the other is user
program module. Defines how computational routines are called in machine code or low-
level which is hardware independent.
14
Review Questions
3. Describe interoperability?
4. What are the challenges in application integration describe the solutions to overcome
the challenges?
5. Describe the difference between CORBA and RMI or remote method invocation?
7. What is the difference between data level and function level integration model? Which
model is more complex and why?
8. What is heterogeneity?
9. Describe different types of middleware and describe how the middleware solves problem
of heterogeneity?
15
Teacher: Earl Von V. Deiparine
Contact #: 09364181623
CHAPTER Facebook Account: Earl von Deiparine
2
Email Add.: deiparineefreak@gmail.com
Prelim Period
16
Web Services and Middleware
application integration technology
Allows applications to be integrated more rapidly, easily and less
expensively
program-to- program interactions whereas web for program-to-
user
interactions
allow companies to reduce the cost of doing e-business, to
deploy
solutions faster and to open up new opportunities
Web services model built on emerging standards such as
HTTP
XML
Simple Object Access Protocol (SOAP)
Web Services Description Language (WSDL)
Universal Description, Discovery and Integration (UDDI)
developed in order to distribute an object and serve it to various
users
in the web environments
used in the server situations while solving the web-scalability
problem
of the other distributed object technologies
WSDL, and SOAP exploit XML.
WSDL is an XML describing the web service.
SOAP is an XML describing the called method, its parameters,
and its
return value, can be delivered over the HTTP
17
Web Services and
Middleware
1. A client that wants to be serviced should first find the supported services from the pre-
existing
registry before compiling a code.
2. After finding its services through searching, the client gains the WebService
Description Language (WSDL) that a server previously registers. From the WSDL, the
client knows the service provider location and the parameters to the found method.
3. After the client binds the described service during the compile time, it calls the
local agent whenever the client invokes a method call, and the local agent
delivers it to the server side agent through Simple ObjectAccess Protocol (SOAP)
over HTTP, FTP, SMTP, and TCP during the runtime.
4. The server side agent activates the appropriate object, and deliversthe calls to the
object.
18
Network Programming
Network:
A network is a collection of computers and other devices that can send data to and
receive data from each other.
A network is often connected by wires.
However, wireless networks transmit data through infrared light and microwaves.
Node:
Each machine on a network is called a node.
Most nodes are computers, but printers, routers, bridges, gateways etc..can also be
nodes.
Nodes that are fully functional computers are also called hosts.
Packet:
All modern computer networks are packet-switched networks: data traveling on the
network is
broken into chunks called packets and each packet is handled separately.
Each packet contains information about who sent it and where it's
going.
Protocol:
A protocol is a precise set of rules defining how computers
communicate: the format of
addresses, how data is split into packets.
IP:
IP was designed to allow multiple routes between any two points andto route packets
of data around damaged routers.
TCP:
Since there are multiple routes between two points, and the packetsthat make up
a particular data stream.
Furthermore, they may not arrive in the order they were sent, if theyeven arrive at all.
UDP:
UDP is an unreliable protocol that does not guarantee that packets willarrive at
their destination or that they will arrive in the same orderthey were sent.
Ports:
Each computer with an IP address has several thousand logical ports.
Each port is identified by a number between 1 and 65,535. Each port canbe allocated
to a particular service.
Port numbers 1 through 255 are reserved by IP for well-known servicesIf you
connect to
port 80 of a host, for instance, you may expect to findan HTTP server. 19
Internet:
largest IP-based network for connecting machines together.
Java: easy-to-use, cross-platform model for network communications.
What is a Socket?
Sockets are a means of using IP to communicate between machines, so
socketsallow Java to interoperate with legacy systems by simply talking to
existingservers using their pre-defined protocol.
Internet protocol: User Datagram Protocol (UDP) and Transmission
Control Protocol (TCP).
2. Allocate space to hold the incoming packet, and create an instance of DatagramPacket to
hold theincoming data.
byte[] buffer = new byte[1024];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
3. Block until a packet is received, then extract the information you need from the packet.
// Block on receive()
socket.receive(packet);
// Extract the packet data
byte[] data = packet.getData(); 20
// Find out where packet came from
// so we can reply to the same host/port
InetAddressremoteHost =
Creating UDP Clients
1. First allocate space to hold the data we are sending and create an instanceof
DatagramPacket to hold the data.
byte[] buffer = new byte[1024];
int port = 1234;
InetAddress host =
InetAddress.getByName("magelang.com"); DatagramPacket
packet = new DatagramPacket(buffer, buffer.length, host,
port);
22
IP Packet
Structure
23
Destination Address - Specifies the receiving node.
Options - Allows IP to support various options, such as
security.
Data - Contains upper-layer sent in packet.
Source Port and Destination Port - Identifies points at which upper layer source
and destination processes receive TCP services.
Sequence Number In the connection-establishment phase, this field also can be used
to identify an initial sequence number to be used in an upcoming transmission.
Acknowledgment Number - Contains the sequence number of the next byte of data
the sender of the packet expects to receive.
Data Offset - Indicates the number of 32-bit words in the TCP header.
Reserved - Remains reserved for future use.
Flags - Carries a variety of control information, including the SYN and ACK bits used
for connection establishment, and the FIN bit used for connection termination.
Window - Specifies the size of the sender’s receive window (that is, the buffer space
available
for incoming data).
24
Checksum - Indicates whether the header was damaged in
transit.
Urgent Pointer - Points to the first urgent data byte in the
packet.
Options - Specifies various TCP options.
Data - Contains upper-layer sent in packet.
25
Teacher: Earl Von V. Deiparine
Contact #: 09364181623
CHAPTER Facebook Account: Earl von Deiparine
3
Email Add.: deiparineefreak@gmail.com
Midterm Period
26
XML DTD and XML Schema
How does an XML processor check your xml document?
Why needXMLValidator
Use our XML validator to
syntax-check your XML.
Errors in XML documents will
stop your XML applications
unlike HTMLbrowser
XML DTD
An XML document with correct
syntax is called "Well
Formed".
An XML document validated
against a DTD is "Well
Formed" and "Valid".
The purpose of a DTD is to define the structure of an XML document anda list
of legal elements.
Note.dtd
<!DOCTYPE
note [
<!ELEMENT
note
(to,from,heading
,body)>
<!ELEMENT to
(#PCDATA)>
<!ELEMENT
from
(#PCDATA)>
<!ELEMENT
heading
(#PCDATA)>
<!ELEMENT
body
(#PCDATA)>
]>
!
DOCTYP
E note
defines
that the
root
element
of the
document
is note
!ELEMENT note defines that the note element contains four elements:"to, from, 28
heading, body"
!ELEMENT to defines the two element to be of type "#PCDATA"
XML Schema
Another way of validating XML documents: using XML schemas.
The XML Schema language is also referred to as XML Schema Definition(XSD),
describes the structure of an XML document.
defines the legal building blocks (elements and attributes) of an XML document like DTD.
defines which elements are child elements
defines the number and order of child elements
defines whether an element is empty or can include text
defines data types for elements and attributes
defines default and fixed values for elements and attributes
XSD Attributes
The syntax for defining an attribute
Default and Fixed Values for Attributes
Optional and Required Attributes
29
XSD Indicators
Order indicators are:
All
Choice
Sequence
30
XSD Attributes
Simple elements cannot have attributes.
If an element has attributes, it is considered to be of a complex type. But theattribute
itself is always declared as a simple type.
Example
<lastnamelang="EN">Smith</lastname>
<xs:attribute name="lang" type="xs:string"/>
Example:
1. A complex XML element, "product", which is empty: <product pid="1345"/>
2. A complex XML element, "employee", which contains only other elements:
<employee>
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>
3. A complex XML element, "food", which contains only text:
<food type="dessert">Ice cream</food>
4. A complex XML element, "description", which contains both elements and text:
<description>
It happened on <date lang=“EN">03.03.99</date>
</description>
31
How to Define a Complex Element using XML Scheme
All Indicator:
The <all> indicator specifies that the child elements can appear in any order, and that
each childelement must occur only once:
<xs:element name="person">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
32
Choice Indicator:
The <choice> indicator specifies that either one child element or another can occur:
<xs:element name="person">
<xs:complexType>
<xs:choice>
<xs:element name="employee" type="employee"/>
<xs:element name="member" type="member"/>
</xs:choice>
</xs:complexType>
</xs:element>
Sequence Indicator:
The <sequence> indicator specifies that the child elements must appear in a specific
order:
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
33
Example (shiporder.xml):
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporderorderid="889923">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
</shiporder>
Example "shiporder.xsd":
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
34
Parse an XML Document
The following code fragment parses an XML document into an XML
DOMobject: if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
XML DOM
The XML DOM defines a standard
way for accessing and
manipulatingXML documents.
The XML DOM views an XML
document as a tree-structure.
All elements can be accessed
through the DOM tree.
Their content (text and attributes) can be modified or deleted, andnew elements can
be created.
The elements, their text, and their attributes are all known as nodes.
Example
<html>
<body>
<span id="to"></span>
<span id="from"></span>
<span id="message"></span>
<script>
if (window.XMLHttpRequest)
{ // code for IE7+, Firefox, Chrome, Opera, 35
Safari xmlhttp=new XMLHttpRequest();
}
else
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","note.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("to").innerHTML=
xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;
document.getElementById("from").innerHTML=
xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
document.getElementById("message").innerHTML=
xmlDoc.getElementsByTagName("message")[0].childNodes[0].nodeValue;
</script>
</body>
</html>
36
Teacher: Earl Von V. Deiparine
Contact #: 09364181623
CHAPTER Facebook Account: Earl von Deiparine
4
Email Add.: deiparineefreak@gmail.com
Prefinal Period
37
XSL
XSL stands for EXtensibleStylesheet Language.
It is anXML-based Stylesheet Language.
XSL describes how the XML document should be displayed
XSL consists of three parts:
XSLT - a language for transformingXML documents
XPath - a language for navigating inXML documents
XSL-FO - a language for formatting XML documents
XSLT
XSLT stands for XSLTransformations,
XSLT transforms an XML source-tree into an XML result-tree.
XSLT transforms an XML document into another XML document, recognized by a browser,
like HTML and XHTML.
Add/remove elements and attributes to or from the output file.
Rearrange and sort elements, perform tests and make decisions about which elements to
hide and display, and a lot more.
XSLT uses XPath to find information in an XML document.
XPath is used to navigate through elements and attributes in XML documents.
39
The XML File
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
.
</catalog>
40
XSLT <xsl:if> Element
The <xsl:if> element is used to put a conditional test against the content ofthe XML file.
Syntax
<xsl:if test="expression">
...some output if the expression is true...
</xsl:if>
To add a conditional test, add the <xsl:if> element inside the <xsl:for-each> element in the
XSL file.
The value of the required test attribute contains the expression to be evaluated.
41
XSLT <xsl:choose> Element
The <xsl:choose> element is used in conjunction with <xsl:when> and<xsl:otherwise>
to express multiple conditional tests.
Syntax
<xsl:choose>
<xsl:when test="expression">
... some output ...
</xsl:when>
<xsl:otherwise>
... some output ....
</xsl:otherwise>
</xsl:choose>
To insert a multiple conditional test against the XML file, add the<xsl:choose>, <xsl:when>,
and
<xsl:otherwise> elements to the XSL file:
43
XML and XPath
44
Path Resul
Expression t
//book/title | //book/price document
Selects all the title AND price elements of /bookstore/book/title | //price
all book Selects all the title elements of the
elements book element of the
//title | //price bookstore element AND all the price
Selects all the title AND price elements in elements
the in the
documen
t
Path Resul
Expression t
/bookstore/* Selects all the child nodes of //* Selects all elements in the document
the bookstore element //title[@*] Selects all title elements which
have
any attribute
Exampl Resul
e t
child::book Selects all book nodes that descendant::book Selects all book
are children of the current node descendants of the current node
attribute::lang Selects the lang attribute of ancestor::book Selects all book ancestors
the of
current node the current node
child::* Selects all element children of ancestor-or-
the current node self::book
attribute::* Selects all attributes of the Selects all book ancestors of the current
current node - and the current as
node well if it is a book node
child::text() Selects all text node children of child::*/child::price Selects all
the current node price
child::node() Selects all children of the grandchildren of the current node
current
node
45
XPath Axes
Node Sets
By collecting nodes into a set, XPath lets you work with multiple nodes at once.
Node set functions:
last() - Returns the number of nodes in the node set.
position() - Returns the position of the context node in thenode set. (The first
node is Node 1.)
count(node-set) - Returns the number of nodes in node-set.
id(ID) - Returns a node set that contains the elementwhose ID value matches ID.
local-name(node-set) - Returns the name of the first node in node-set.
namespace-uri (node-set) - Returns the URI of the namespace of the firstnode in
node set.
name(node-set) - Returns thequalified name of the first node innode-set.
46
Teacher: Earl Von V. Deiparine
Contact #: 09364181623
CHAPTER Facebook Account: Earl von Deiparine
5
Email Add.: deiparineefreak@gmail.com
Final Period
47
Design Patterns
Design pattern:
A Lower level framework for structuring an application than architectures
(Sometimes, called micro-architecture).
Reusable collaborations that solve sub problems within an application.
Why Design Patterns?
Design patterns support object-oriented reuse at a high level of abstraction
Design patterns provide a “framework” that guides and constrains object-
oriented implementation
48
Organizing Design Patterns
The Gang of Four (GoF) Design Patterns book describes twenty-threepatterns arranged into
three groups.
The groups help classify how the patterns are used.
2. Structural patterns are concerned with how classes and objects areorganized
and composed to build larger structures.
Structural Patterns
Decorator- add more responsibilities to an object
dynamically Eg:- adding scrolling to a text view
Facade- higher level unified interface to a set of objects
in a subsystem
Proxy- interface layer between objects
Behavioral Patterns
Iterator- a means to access all the elements of objects
sequentially
Momento- capture and save the current state of an
object
Observer- when any numbers of objects (the Observers)
need to benotified automatically
49
Interfaces
Application Programming Interfaces
Are sets of requirements that govern how one application can talk toanother
applications to share data and take actions on one another's behalfwithout requiring
developers to share all of their software's code
define exactly how a program will interact with the rest of the softwareworld—saving
time, resources
Eg:-System-level APIs- cut and paste LibreOffice document into anExcel spreadsheet
Eg:-FacebookAPIs - Facebook users sign into many apps and Web sitesusing their
Facebook ID
Eg:-Web APIs - games let players chat, post high scores and invitefriends to play via
Face book, right there in the middle of a game
Inheritance
Inheritance
derive a new class based on an existing class, with modifications orextensions
A subclass inherits all the variables and methods from its super classes,including its
immediate parent as well as all the ancestorsavoid duplication and reduce redundancy
Types of Inheritance
Simple , Multilevel, Multiple, hierarchical and Hybrid
Abstract Class
A class containing one or more abstract methods is called an abstractclass.
must be declared with a class-modifier abstract
provides a template for further development
50
Notes:
An abstract method cannot be declared final, as final method cannot be overridden.
An abstract method must be overridden in a descendent before it can be used.
An abstract method cannot be private (which generates a compilation error, because
private method is not visible to the subclass and thuscannot be overridden.
In Java, define a subclass using the keyword "extends", e.g.,
class MyAppletextends java.applet.Applet
{.....} class Cylinder extends Circle {......}
Example for Inheritance
51
Example for Abstract class and
Inheritance
Shape.java
abstract public class Shape
{
private String color; // Private member
variable public Shape (String color) //
Constructor
{ this.color = color;
}
public String toString()
{
return "Shape of color=\"" + color + "\"";
}
// All Shape subclasses must implement a
method called getArea()
abstract public double getArea();
}
52
53
54
Versioning and Version Control
55
REFERENCES
Websites:
https://www.scribd.com
https:////www.slideshare.com
Republic Act 8293, section 176 states that: No copyright shall subsist in any work of the
Government of the Philippines. However, prior approval of the government agency or
office wherein the work is created shall be necessary to exploitation of such work for
profit. Such agency or office may, among other things, impose as a condition the
payment of royalties. Borrowed materials (i.e., songs, stories, poems, pictures, photos,
brand names, trademarks, etc.) included in this book are owned by their respective
copyright holders. Every effort has been exerted to locate and seek permission to use
these materials from their respective copyright owners. The publisher and authors do not
represent nor claim ownership over them.
Prepared Attested
by: by:
Earl Von V.
Deiparine
Instructor
Noted
by:
56
SIBUGAY TECHNICAL INSTITUTE INC.
Lower Taway, Ipil, Zamboanga
Sibugay www.sibugaytech.edu.ph
sibugaytech07@gmail.com
Telefax: (062)222-2469, Mobile No.:
09171271826/0917127190
57
SIBUGAY TECHNICAL INSTITUTE INC.
Lower Taway, Ipil, Zamboanga
Sibugay www.sibugaytech.edu.ph
sibugaytech07@gmail.com
Telefax: (062)222-2469, Mobile No.:
09171271826/0917127190
58
SIBUGAY TECHNICAL INSTITUTE INC.
Lower Taway, Ipil, Zamboanga
Sibugay www.sibugaytech.edu.ph
sibugaytech07@gmail.com
Telefax: (062)222-2469, Mobile No.:
09171271826/0917127190
INDUSTRIAL ARTS
DRIVING NCII
SHIELDED METAL ARC WELDING NCII
AUTOMOTIVE SERVICING NCI
AUTOMOTIVE SERVICING
NCII HOME ECONOMICS
FRONT OFFICE SERVICES
NCII
HOUSEKEEPING NCII
FOOD AND BEVERAGES
SERVICES NCII
BREAD AND PASTRY PRODUCTION NC II
INFORMATION AND
COMMUNICATIONTECHNOLOGY
2D ANIMATION NCIII
COMPUTER SYSTEM SERVICING NCII
ELECTRONIC PRODUCTS ASSEMBLY SERVICES
NCII AGRICULTURAL TECHNOLOGY STRAND
ANIMAL PRODUCTION (POULTRY CHICKEN)
NCII
ANIMAL PRODUCTION (RUMINANTS) NCII
ANIMAL PRODUCTION (SWINE) NCII
RUBBER PRODUCTION NCII
ORGANIC AGRICULTURAL PRODUCTION NCII
ACADEMIC
TRACKHUMANITIES AND SOCIAL
SCIENCES
FRONT OFFICE SERVICES
NCII
EVENTS MANAGEMENT NC III
ACCOUNTANCY BUSINESS
ANDMANAGEMENT
BOOKKEEPING NCIII
SCIENCE, TECHNOLOGY,
ENGINEERING ANDMATHEMATICS
59
ELECTRONIC PRODUCTS
ASSEMBLY SERVICING NCII