Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 22 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
22
Dung lượng
324,2 KB
Nội dung
[...]...W HO S HOULD R EAD T HIS B OOK interfaces, see why document-style interfaces are becoming more common, and learn how to best organize one Chapter 7, A Little Process Interface-oriented design is but one part of the overall development process We’ll see how it fits in, and we’ll get ready for the three design examples in the following chapters Chapter 8, Link Checker In this chapter,... interface cohesiveness and interface generalization as we create this program Chapter 10 , Service Registry Remote services use directories to help you locate a service provider In this project, we’ll develop a service registry to explore how directory services work and see an example of a document-style interface Chapter 11 , Patterns The well-known “Gang of Four” book divides patterns into two camps: class-based... exposed to object-oriented design Even if you are heavy into object orientation, you might find the interfaceoriented approach helps you gain some insight into different ways of approaching a design Understanding interfaces will help you transition to designing Service-Oriented Architectures xi A BOUT THE About the Cover Concentrating on interfaces is key to decoupling your modules .1 You probably learned... Class-Responsibility-Colla1 As Clemens Szyperski puts it, “The more abstract the class, the stronger the decoupling achieved.” See http://www.sdmagazine.com/documents/sdm0 010 k/ 2 See http://www.microsoft.com/enable/products/dvlayout.aspx 3 See http://www.ctrl-c.liu.se/~ingvar/jargon/q.html C OVER xii A CKNOWLEDGMENTS boration (CRC) cards, as the primary method for creating an interfaceoriented designs You’ll... time_till_delivered Figure 1. 1 shows the PizzaOrdering interface in a UML sequence diagram The diagram captures the sequence of interaction between a customer and an implementation of the PizzaOrdering interface (i.e., a pizza shop) For those less familiar with sequence diagrams, I’ll explain the details in Chapter 2 .1 Here’s a more formal description for how you might find a pizza shop: 1 You may look at this... example, some of the common commands are as follows: AT (attention, commands follow) D (dial a number) T (dial a number using tones, rather than pulses) To dial a number, you send the modem the “ATDT 919 55 512 12” sequence The replies from the modem are also textual If the connection was successful, the modem returns the “CONNECT” string If the connection was not successful, it returns a string denoting... such as polymorphism and implementation hiding, without getting bogged down in technology Then we’ll switch to real systems to show code and textual interfaces as background for topics in later chapters 1. 1 Pizza-Ordering Interface If you’re a real programmer, or a serious pizza eater, you’ve probably performed the following scenario hundreds of time The Pizza Order You’re hungry so you call your favorite... enumeration Size {SMALL, MEDIUM, LARGE} 3 P IZZA -O RDERING I NTERFACE :PizzaOrdering customer set_size(a_size) set_toppings(toppings) set_address(address) get_time_till_delivered() time_till_delivered Figure 1. 1: PizzaOrdering sequence diagram enumeration Toppings {PEPPERONI, MUSHROOMS, PEPPERS, SAUSAGE} set_size(Size) set_toppings(Toppings []) set_address(String street_address) TimePeriod get_time_till_delivered()... are produced by the regular keyboard The QWERTY keyboard layout was derived from concern about implementation According to one web site,3 “It is sometimes said that it was designed to slow down the typist, but this is wrong; it was designed to allow faster typing—under a constraint now long obsolete In early typewriters, fast typing using nearby type-bars jammed the mechanism So Sholes fiddled the layout... For example: interface SampleInterface { double findAverage(double [] numbers); } 2 In particular, the Factory Method pattern See Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (Addison-Wesley, 19 95) 5 R EAL -L IFE I NTERFACES class SampleImplementation implements SampleInterface { double findAverage(double [] numbers) { . Remember 17 5 11 Patterns 17 7 11 .1 Introduction 17 7 11 .2 Factory Method 17 7 11 .3 Proxy 17 9 11 .4 Decorator 18 1 11 .5 Adapter 18 3 11 .6 Façade 18 4 11 .7 Composite 18 5 11 .8 Things to Remember 18 6 CONTENTS. Remember 15 2 10 Service Registry 15 4 10 .1 Vision 15 4 10 .2 Conceptualization 15 6 10 .3 Analysis 15 7 10 .4 Design 16 4 10 .5 Implementation 16 5 10 .6 Published Interface 16 9 10 .7 The Next Iterations 17 2 10 .8. Interfaces 10 2 7 A Little Process 10 3 7 .1 The Agile Model 10 3 7.2 Vision 10 4 7.3 Conceptualization 10 4 7.4 Analysis and Design 11 0 7.5 Interface-Oriented Design 11 0 7.6 Design 11 6 7.7 Implementation 12 0 7.8