Connectors Style: Main program and subroutines INF 123 – Software architecture 1.

Slides:



Advertisements
Similar presentations
Remote Procedure Call (RPC)
Advertisements

Software Connectors Software Architecture. Importance of Connectors Complex, distributed, multilingual, modern software system functionality and managing.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
Seminarium on Component-based Software Engineering Jan Willem Klinkenberg CORBA.
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Application Layer – Lecture.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors.
CS335 Networking & Network Administration Tuesday, May 25, 2010.
Socket Programming.
Software Connectors. Attach adapter to A Maintain multiple versions of A or B Make B multilingual Role and Challenge of Software Connectors Change A’s.
1 Java Networking – Part I CS , Spring 2008/9.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors Software Architecture Lecture 7.
1 Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write)
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
Objectives The key roles an architecture description plays in a software project. The key roles an architecture description plays in a software project.
The Architecture of Transaction Processing Systems
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
Visualizing Architectures INF 123 – Software architecture 1.
Client Server Model and Software Design TCP/IP allows a programmer to establish communication between two application and to pass data back and forth.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors Software Architecture Lecture 7.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Introduction to Network Programming Asst. Prof. Chaiporn Jaikaeo, Ph.D. Computer Engineering Department.
Lecture 15 Introduction to Web Services Web Service Applications.
Distributed Processing and Client/Server
April 2000Dr Milan Simic1 Network Operating Systems Windows NT.
Inter-process communication: Socket. socket Internet socket From Wikipedia, the free encyclopedia Jump to: navigation,
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Processes Introduction to Operating Systems: Module 3.
Distributed Computing A Programmer’s Perspective.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
AMQP, Message Broker Babu Ram Dawadi. overview Why MOM architecture? Messaging broker like RabbitMQ in brief RabbitMQ AMQP – What is it ?
Remote Procedure Call and Serialization BY: AARON MCKAY.
Seminar on Service Oriented Architecture Distributed Systems Architectural Models From Coulouris, 5 th Ed. SOA Seminar Coulouris 5Ed.1.
Berkeley Socket Abstraction
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science.
Software Connectors Acknowledgement: slides mostly from Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic,
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors in Practice Software Architecture.
1 Network Communications A Brief Introduction. 2 Network Communications.
Software Connectors. What is a Software Connector? 2 What is Connector? – Architectural element that models Interactions among components Rules that govern.
Client-server communication Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
System Architecture CS 560. Project Design The requirements describe the function of a system as seen by the client. The software team must design a system.
Internet and Distributed Application Services
Software Connectors.
#01 Client/Server Computing
Client-Server Interaction
Interacting With Protocol Software
WEB API.
Chapter 40 Remote Method Invocation
Software Connectors.
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Software Architecture Lecture 7
Software Architecture Lecture 7
Software Architecture Lecture 7
Message Passing Systems Version 2
#01 Client/Server Computing
Software Architecture Lecture 6
Presentation transcript:

Connectors Style: Main program and subroutines INF 123 – Software architecture 1

Outline Some theory Connector 1: Procedure call Style: Main program and subroutines Connector 2: Socket 2

SOME THEORY 3

Connector Architectural element in charge of the interactions among components Connector in implementations – No dedicated code – Scattered across modules Connector in architectures – Its own spec – To distinguish computations from interactions 4

Connectors Allow components to transfer control and data with each other Aka facilitating control flow and data flow 5 What is control?

Connectors “The guards at the gate of separation of concerns” Often domain-agnostic: the how, not the what 6 I protect that which matters most

Connectors Can be super smart and complex E.g. order, filter, combine, or discard messages 7 I am a trafficker of information

4 interaction roles Communication – Transfer of data – Message passing Coordination – Transfer of control – Function calls Conversion – Translation – Wrapping Facilitation – Load-balancing – Locks 8

Connector examples vs concerns Procedure call Method call Event broker Pubsub Interrupts Socket Load balancer DB driver SSH Tunnel … Best effort vs exactly once vs reliable Encrypted vs cleartext Uni/multi/broadcast Static vs dynamic linkage Serialization (JSON, XML, binary) Stateless vs stateful Sync vs asynchronous … 9

PROCEDURE CALL 10

Procedure call Communication role – Arguments, return values Coordination role – Control flow The most basic connector – “The Assembly language of sw interaction” 11

Examples Subroutines – Architectural style: Main program and subroutine Object-oriented methods UNIX fork and exec OS calls (open, read, write, poll, …) Callbacks Basis for Remote Procedure Call 12

STYLE: MAIN PROGRAM AND SUBROUTINES 13

Style: Main program and subroutines Break down a long program into 1 main and N subroutines Subroutines – Self-contained No side-effects Independent of each other – Functionally meaningful and substantial Good: detect_and_execute_collisions(me, enemies, walls) returns True if the game is over Bad: add_one_to_score(score) returns score+1 14

Style: Main program and subroutines 15 main Subroutine 1Subroutine 2Subroutine N … Function calls

Easy to follow the control flow 16 main Subroutine 1Subroutine 2Subroutine N …

Style: Main program and subroutines while keep_going: keep_going, direction = process_input(direction) mybox = move(mybox, direction) if collide(mybox, borders): mybox, direction = create_box(dims) mybox, pellets = eat_colliding_pellet(mybox, pellets, dims) draw_everything(screen, mybox, pellets, borders) clock.tick(50) 17

Style: Main program and subroutines 18 game loop process_inputmovedraw_everything … Function calls Only these functions involve Pygame

Same loop, but replace Pygame display 19

IP SOCKETS 20

Socket Endpoint of inter-process communication across the network Most follow Internet Protocol (IP) BSD standard IP socket API – Constructor, bind, listen, connect, accept, send, recv, close, setsockopt, … – poll, select, epoll, or kqueue to know the socket state (is there data to recv? The other end hung up?) Client-server paradigm 21

Client-server paradigm Server socket bind() and listen() Server poll() its sockets periodically Client socket connect() Client poll() its socket periodically Server socket accept() – Creates a new socket for that client connection Both sockets send() and recv() One socket close() The other’s poll() will notify the closure 22

Client-server The client contacts the server The server can’t pull a client in! – Neo must sit to connect 23

Sequence diagram 24

IP sockets in Python