Package diagrams Architectural styles Software design (Cont.) Design modelling technique: Package Diagrams Package: A module containing any number of classes Packages can be nested arbitrarily E.g.: Java packages, C++ namespaces Order Capture UI AWT Mailing List UI Order Capture Application Mailing List Application Oracle Interface Common {global} Quantity Money Domain Dependency 1 CE202 & CE654 Software Engineering, Spring term 2010 11 Dr Amnon H. Eden, School of Computer Science and Electronic Engineering, University of Essex Sybase Interface Database Interface Orders 2 Customers Software architecture: definition [Garlan & Shaw 93]: 3 a level of design concerned with issues... beyond the algorithms and data structures of the computation; designing and specifying the overall system structure emerges as a new kind of problem. Structural issues include gross organization and global control structure; protocols for communication, synchronization, and data access; assignment of functionality to design elements; physical distribution; composition of design elements; scaling and performance; and selection among design alternatives. Architectural design decisions Answer global questions, such as: Will the system be distributed? How? What are the main components of the system? How will these components communicate? How aspects of security, exception handling and resource allocation will be handled? How these questions are answered? How is the result ( the architecture ) modelled? 4 1
CE202 + CE654 Software Engineering, Spring term 2010 11 Dr Amnon H. Eden, School of Computer Science and Electronic Engineering, University of Essex Components and connectors Garlan & Shaw s catalogue Architectural Styles What is an Architectural Style? An architectural style defines a family of systems in terms of a pattern of structural organization. [Shaw & Garlan 93] Architectural style: describe Types of components Types of connectors Topology (constraints on possible compositions) 5 6 Shared Repository A central database is shared by different subsystems Shared Repository: Example CASE Toolset Applicability: Large, complex body of information Inter-related records Sophisticated data processing and management Selection queries, recovery, locking, security Distributed systems with shared data Source: Sommerville 2004 7 8 2
Shared Repository: Discussion Pros: Efficient use of resources Consistency maintained Uniform data format (!!) Centralized control Security is simple Cons: Evolution is difficult Dependence on data traffic Client-Server A distributes system with -- Server(s): Stand-alone, powerful machines Clients: Subsystem which employ the services simultaneously Network: Communicating clients with serves Processing model: Client initiates request Request passes through network Server responds Response returned via network 9 10 Client Server: Example 1 Windows 95 WS Linux Mac OS X Client-Server: Example 2 X-Windows Communication network File Server (Sun SPARC) Print and Web Server (Windows NT) 11 12 3
Client-Server: Example 3 Email Server: MS Exchange Server on exchange3.essex.ac.uk The domain resolves to more than one machine Clients: Outlook, Thunderbird, Outlook Express, Eudora, Protocols Post Office Protocol Ver. 3 (POP3) Internet Message Access Protocol (IMAP) Exchange Server Client-Server: Example 4 Automated teller machine 13 14 Client-Server: Example 5 Three-tier client-server architecture Customary in Web configurations such as Java Server Pages (JSP) Client-Server: Properties Transparency Possible distribution of server on different machines without clients dependency Clients know servers, not vice versa Heterogeneity Allowing for different machines, operating systems Redundancy 15 16 4
Layered Architecture A.k.a. Abstract Machine Model Principles: Each module belongs to a layer And either: 1. Each layer may access only lower layers or: 2. Each layer may access only the lower layer Layered Architecture: examples ISO Communication Protocols Application Layer Presentation Layer Session Layer Transport Layer Network Layer Link Layer UNIX Operating System Shells, commands, Compilers, Interpreters System Libraries Kernel File system, Signals, Disk + Tape drivers Virtual Memory, CPU Scheduling, Terminal Controllers Disks, Tapes Device Controllers Memory Controllers, Physical Memory Physical Layer 17 18 Layered Architecture: examples II Operating system access User interface Application logic Database access a) Typical layers in an application program Network communication Application programs Screen display facilities User account management File system Kernel (handling processes and swapping) b) Typical layers in an operating system Dealing with application protocols Dealing with connections Dealing with packets Transmitting and receiving c) Simplified view of layers in a communication system Centralized Control Model Call Return Model: Synchronous, top-down procedure invocation Initialize() Routine2() Main() Loop() {Execute()} Execute() {... } Routine1() Conclude() Manager Model: Asynchronous, concurrent threads/processes, with one manager which is responsible to execute, stop, and coordinate 19 Chapter 9: Architecting and designing software Lethbridge/Laganière 2001 20 5
Event-Driven Models The flow of control is driven by external events Broadcast Control Model: Example Windowing systems: Windows 3.1, Motif Event : A signal which triggers a particular functionality Two conforming models: Broadcast model (a.k.a. Implicit Invocation) Events are broadcasted to all subsystems Any subsystem that can handle it may respond Interrupt-driven model Events trigger interrupts and a specific handler Subsystem 1 Subsystem 2 Subsystem 3 Dispatcher (Event Handler) 21 22 Interrupt-Driven Model Common with real time systems Applicability: Broadcasting is too time consuming Response must be immediate Drivers directly related to the CPU Flaws Inflexible model Coordination can be difficult Interrupt-Driven Model: Example Interrupts Interrupt Vector Handler 1 Process 1 Handler 2 Process 2 Handler 3 Process 3 Handler 4 Process 4 23 24 6
Peer-to-Peer (P2P) System composed of any number of peers Peer: client & server Computations may be performed by any peer Peers popping in and out of existence :P :P :P :P :D :P :P :P :P Pure P2P P2P with a discovery server P2P: Examples I File sharing Napster, Gnuttela, Kazaa, torrent applications Messenger Skype, ICQ, Yahoo Messenger, MSN Messenger JXTA XML encoding of messages Resources found via advertisement Requires a discovery server http://www.jxta.org 25 26 P2P: Examples II Portable Weather Forecast unit Satellite P2P: Advertisement and Discovery Advertisement & discovery in JXTA2 Satellite phone Barometer GPS Thermometer PWF Computer PWF 27 28 7
P2P: Discovery models Q. How peers are found? A. Discovery models Some peers offer a directory service super peers rendezvous peers Relay peers Multicast peers announce their presence on some communication channel Neighbour model via other peers P2P: Discussion Pros: Very flexible Evolution is with minimal effort Efficient resource utilization is close to optimal Heterogeneous Cons: Security: authentication is close to impossible Duplication Data corruption 29 30 Exercises Observe the differences between apparently-similar styles: What are the differences between Client-Server vs. Broker? Rendezvous peer vs. broker? Peer-to-Peer vs. Grid? 31 8