TIM 50 - Business Information Systems - University of ... 50 - Business Information Systems Lecture...
Transcript of TIM 50 - Business Information Systems - University of ... 50 - Business Information Systems Lecture...
TIM 50 - Business Information Systems
Lecture 10
Instructor: Ram Akella
UC Santa Cruz
February 20, 2017
Architecture
n How do you begin to architect a solution for a problem like this?
n Break it into modules!
n New in-flight seatback systemn Sell upgrades and seat swaps
n (People who want to get away from sick people …)q More legroom q Offer to exchange seats
Seatback Architecture
When a module is composed of sub-modules, the architecture is hierarchical.
Seatback Application
Linux OS
Networking Infrastructure
User InterfaceCoordination
With On Plane Server
Data Management
HHC Architecture
Seatback Application
Linux OS
Networking Infrastructure
User InterfaceCoordination
With On Plane Server
Data Management
• We also make use of layers
Granularity tradeoff.
n How big should we make the modulesq Many simple small onesq Or a few complicated big ones…
n This aspect of modularity is called granularity.
n Which is better?
In-plane Server
n Again, we see layering and hierarchy.n Between each module we specify an interface
Networking Infrastructure
LinuxOS
Server Application
Communicationwith airlinedatabase
Computationof key statistics
CommunicationWith seat backs
Standard Database “queries” (SQL) relayed to DBMS via OS and infrastructure
Data server
Database
DBMS
Standard Database “queries” (SQL) from HHC Server
Our architecture makes use of theExisting interface of the airline database,so we don’t need to redesign it!
A simple interface: from within Architecure
HHC Application
Linux
Networking Infrastructure
Computationof key statistics
Communicationwith HHC
Communicationwith airlinedatabase
Computationof key statistics
Compute Mean andVariance
Mean,Variance
List of numbers
Interfaces
Interface specifications are often made precise by using data types.
n Example type: floatq A number with a decimal placeq Has a certain allowable range, and precision.
Computationof key statistics
N numbers ofFloat type
2 Numbers of float type that signify:Mean, Variance
Compute Mean andVariance
More on Data types
n Data passing an interface is often specified in terms of a limited number of standard data types
n Data type = range of values and allowable manipulation
n Data type does not presume a specific representation, to allow heterogeneous platformsq Representation must be known when data passes a
specific module interface
Example data types
Integerq “natural number between -32,767 and +32,768”q Could be represented (in many ways) by 16 bits
n since 2n = 65,536
Floatq “number of the form m*10n/32768, where m is in the
range -32,767 to +32,768 and n is in the range -255 to +256”
q Could be represented by 16+8 = 24 bits
More data types
Characterq “values assuming a-z and A-Z plus space and
punctuation marks”n could be represented by 7 or 8 bits
Character stringq “collection of n characters, where n is
customizable”n could be represented by 7*n bits
Compound data types
Programmer-defined composition of basic data types
Example:Employee {
String name;String address;Integer year_of birth;etc.}
Interfaces
Computationof key statistics
N numbers ofFloat type
2 Numbers of float type that signify:Mean, Variance
Compute Mean andVariance
INTERFACE
PARAMETERS
RETURNS
Implementation
Computationof key statistics
Compute Mean andVariance
Implementation 1:
n One module should not be concerned with other module’s implementationq à “Separation of concerns.”
n One module should see the other only through its interface –implementation details hidden.q à Abstraction
Module A
Module B
HIDDEN From Module A!!
Implementation
Computationof key statistics
Compute Mean andVariance
Implementation 2:
n Though different, this implementation is ok too.
n We can choose the implementation details however we want, as long as we comply with the agreed interface.
Module A
Module B
Implementation
Computationof key statistics
Compute Mean andVariance
Implementation 1:
n Should he use it?q NO!!!! Why??
n Either A should compute “SUM” himself, or sit down with B and redesign the interface
Module A
Module B
“I need to get the sum,I’ll just take it from B”
Encapsulation
n The designer of B might take measures to hide “SUM” from A so that A is not able to violate the agreed interface.
q Example: B does not declare “SUM” as a global variable.
n Making a modules implementation details inaccessible to other modules is called encapsulation.
Interfaces
Computationof key statistics
N numbers ofFloat type
2 Numbers of float type that signify:Mean, Variance
Compute Mean andVariance
INTERFACE
PARAMETERS
RETURNS
n This simple interface example allows for only one action of module B. q Action is “Compute mean and variance.”
n Other examples are possible.
Module B
Module A
Possible software interface
action-1
action-2
action-3...
Menu of actions
Action 1: Compute meanAction 2: Compute varianceAction 3: Compute mode
Etc..
Example:
Protocol
In addition to atomic actions, an interface may define protocolsq Protocol == finite sequence of actions required
to achieve a higher level function
q One action can be shared by multiple protocols
q Multiple modules may participate in a protocol
Protocol Example
HHC ServerHHC
Hello: I’m the gate 32 server
Hello: I’m the HHC of Airplane#1234
Tell me about the passengers of my next flight
Return WeatherData
(Might be passedAs an array of a compound data type “passenger,” which in turn is composed of standard types like integer, and string)
Tell me about the weatherat my next destination.
Return PassengerData
“Passengers noted”
These were the unrulypassengers on last flight
Another Interface Example: Automatic teller machine (ATM)
What is the interface between this machine and the customer?
Steps
Define available actionsDefine, for each higher level function, a
protocolq Single action or a finite sequence of actions
Interface building blocks
Message on screen or printedq Menu of actions or returns from an actionq Touch selection of action
Keypadq Input parameters to an action
Card readerq Authentication, input parameters
Money output slotq Returns money
Action: authentication
Parametersq Identity (card in slot)q Institution (card in slot)q PIN (typed on keypad)
Internally, it contacts institution and matches against its database, institution noted for all subsequent actions (example of state)
Returnsq Screen message (“Invalid PIN” or menu of available
actions)
Action: specify_account
Parametersq Account (touch screen from menu of choices)
Internally, choice noted for all subsequent actions (another example of state)
Returnsq None
Action: amount
Parametersq Dollars_and_cents (typed on keypad)
Internally, amount noted (another example of state)
Returnsq Success or failure (state dependent, for
example for a withdraw failure when dollars_and_cents exceeds balance)
Protocol: cash_withdrawal
authentication
choose objective
account
amount
failure
other objectives
no accounts
balance exceeded!
Goals
Understand better q how layering is used in the infrastructureq how it contains complexityq how it coordinates suppliersq how it allows new capabilities to be added
incrementally
Layer above is a client of thelayer below
Layer below as as a serverto the layer above
….by utilizing the services of the layer below and adding capability
Each layer provides services to the layer above….
Interaction of layers
Application module Application module
Host A Host B
Middleware
Operating system Operating system
Network
Middleware
Layering
Existing layers
Elaboration or specialization➴ ➴➴
Layering builds capability incrementally by adding to what exists
Three types of software
Application
•Infrastructure:
Basic services (communication, storage, concurrency, presentation, etc.)
•Components and frameworks:
What is in common among applications
Part of Microsoft vs. DOJ dispute
Application
Infrastructure
Components and frameworks
Microsoftposition
DOJposition
Data and information
ApplicationDeals with information
InfrastructureDeals with data
Assumes structure and interpretation
Ignores structure and interpretation
Data and information in layers
n The infrastructure should deal with data,q or at most minimal structure and interpretation
n The application adds additional structure and interpretation
n This yields a separation of concerns
Package = file, message
In the simplest case, the infrastructure deals with a package of data (non-standard terminology)q collection of bitsq specified number and ordering
The objective of the infrastructure is to store and communicate packages while maintaining data integrity
File for storage, message for communication
Example 1
Bob Alice
Bob sends a letter to Alice
US Postal Service UK Royal Mail
ABC Airlines
Envelope
Shipping ContainerShipping Container
Envelope
Web browser
File systemOperatingsystem
File
Network
Message
Collection of packetsFragmentation Assembly
Message
HTML
Screen
Application
Web server
Example 2
Web page
Example 3
HHCHHC Server
HHC Server Application HHC Client ApplicationPassenger Information
Windows OS
message
Networking Infrastructure(Contains: TCP/IP, WiFi)
Collection of Packets Networking Infrastructure(Contains: TCP/IP, WiFi)
Palm OSmessage
Example 3: Network Infrastructure Expanded
HHC Server Application HHC Client ApplicationPassenger Information
Windows OS
message
TCP transport layer
Palm OS
message
WiFi Link Layer
Packets
WiFi Physical Layer
Networking Infrastructure
TCP transport layer
WiFi Link Layer
Packets
WiFi Physical Layer
Networking Infrastructure
Radio Signals
Example 4
HHC Server
HHC Server Application DBMS
Windows OS
message
Networking InfrastructureLayers within TCP/IP, WiFi
Collection of Packets Networking InfrastructureLayers within: TCP/IP, WiFi
Unix OSmessage
Airline Dataserver
HEADQUARTERS
“Send me today’sflight information”
Information in the infrastructureSometimes it is appropriate for the
infrastructure to assume structure and interpretation for dataq to add capabilities widely useful to applicationsq to help applications deal with heterogeneous
platforms, where representations differ
At most, data types