Download Slides on Team Design | Introduction to Software Engineering | CSCI 0320 and more Study notes Software Engineering in PDF only on Docsity! CSCI0320 Introduction to Software Engineering Lecture 9 Team Design July 6, 2009 Lecture 8 Page 1 Page 2 Web Browsing • Web architecture – It all works using sockets and messages – Server listens on port 80 – Browser connects socket to that port • Sends a message requesting a page • Using HTTP format July 6, 2009 Lecture 8 Web Browser Web Server Page 5 Java HTTP • Java provides classes that do all the work – URL: represents a URL – URLConnection: handles the connection to the web browser – HttpURLConnection • Create a URL – Call url.openConnection to get connection – Then set request properties – Can access output stream to add data • Then get input stream to read the result – Can read header properties and status – These cause the connection to be established – Use character set ISO-8859-1 for a Reader July 6, 2009 Lecture 8 Page 6 Team Design • The split between the browser and server – Well-defined interface (175 pages) – Allows separate implementations • This is an example of team design • Why is this needed? July 6, 2009 Lecture 8 Page 7 Mythical Man Month Lab July 6, 2009 Lecture 8 Page 10 Communication Problems • It takes time – Meetings – Waiting for people (finding people) – Non-productive time • It is error-prone – Miscommunication is likely – Missing assumptions – Different vocabularies • Want to minimize it – Maximize “real” programming July 6, 2009 Lecture 8 Page 11 Principles of Team Design • Separation of concerns • Abstraction • Simplicity • Well-defined interfaces • Minimize connections • Minimize risk July 6, 2009 Lecture 8 Page 12 Separation of Concerns • Divide the project into independent parts • Implementation independence – How each part is implemented • Shouldn’t affect other parts – Design implementations independently • Typically matches separation of people – One person might have multiple concerns • Examples July 6, 2009 Lecture 8 Page 15 Simplicity • Interface simplicity – Minimize exposed information – Keep interfaces small • Small number of methods • Only what is needed, no more • No fields should be exposed • Code simplicity – Minimize number of arguments – Minimize number of auxiliary types – Restrict to basic types where possible July 6, 2009 Lecture 8 Page 16 Interfaces • Work in terms of interfaces – Not data structures – Not algorithms • Keep the interfaces simple & abstract – Interfaces represent the design • For each piece of the program – Minimize info it needs to have – Minimize info it needs to provide – Then define the interfaces (Java or UML) • Ensure the interface is understood – By all team members (including implementer) – Well documented July 6, 2009 Lecture 8 Page 17 Minimize Communication • Between system components – By using minimal interfaces • Between classes and interfaces – Minimize number of methods in interfaces – Minimize communications paths • Coupling & cohesion – Minimize dependencies between classes – Maximize unity of each class July 6, 2009 Lecture 8 Page 20 Client-Server Design • This is one we’ve seen – Client and server are independent – What are their interfaces? • Messages that go back and forth • These need to be simple and well-defined • Problems – Only provides 2 components – Each of these can be complex – We need other architectures as well July 6, 2009 Lecture 8 Page 21 Core + Extensions Core ExtensionA ExtensionB ExtensionD ExtensionC ExtensionE ExtensionF July 6, 2009 Lecture 8 Example: GARDEN Example: S6 Page 22 Core + Extensions • Identify a minimal system core – Essential elements used by all of system – The heart of the application • Everything else is a separate extension – Extensions only talk to the core – Extensions don’t talk to each other • Core gets written first – Tested the most • Extensions can be added as needed – Independently • Implementation strategy (people) July 6, 2009 Lecture 8 Page 25 Publish-Subscribe • Each module defines extension points – Where it needs information from outside • Tooltips – Where it might provide information • Mouse events • Other Modules subscribe to these points – If they need the information – If they want to provide input • Original module publishes response – Calls subscribed modules July 6, 2009 Lecture 8 Page 26 Publish-Subscribe Frameworks • Callbacks (Swing, HTML parser) – Publisher defines an interface class – Subscriber provides implementation • Passed to the publisher • Subclassing – Publisher provides inheritable class • With abstract/dummy methods for messages – Subscriber provides subclass • Providing proper method implementations July 6, 2009 Lecture 8 Page 27 External Frameworks • Publisher provides a register interface – Subscribers tells publisher their interests – Publisher then sends out messages to those who have subscribed for particular data – Can work across network • Messages stating interest • Messages with information • Central message service – Handles subscription requests – Handles all outgoing messages – Resends messages to proper targets July 6, 2009 Lecture 8 Page 30 Final Projects • Think about creating independent parts – Each person takes on one or more parts • Each part defines a minimal interface – Defined as java interfaces – Defined as messages – Defined as callbacks • Determine interaction between parts – Core + extensions – Façade patterns July 6, 2009 Lecture 8 Page 31 Final Projects • All your projects interact with users – User interface design is a critical part – Want to provide a good user interface • User-friendly • Easy to use • Easy to learn • User efficient • Something people want to use • Is this easy to do? – How do you achieve it? July 6, 2009 Lecture 8 Page 32 Law of Demeter • Each unit should have limited knowledge of other units – Each unit should only talk to its friends – Don’t talk to strangers • Friends of a method – Methods of this – Methods of argument classes – Methods of computed types of values – Methods of fields of this • Between programmers – Don’t rely too much on others July 6, 2009 Lecture 8