tailieunhanh - Interface-Oriented Design phần 7

Các tài liệu trên truyền đạt thông tin giữa các trình duyệt web của bạn và máy chủ web. Về phía máy chủ web, xử lý các tài liệu này có thể tạo ra các tài liệu khác, chẳng hạn Trong bước tiếp theo bạn phải trả cho các đặt phòng với các tài liệu sau đây: | Implementation 120 Developer testing would be stifled if it took 20 minutes for a response to occur. Implementation As we get into implementing a particular interface more interfaces may be created. For example to determine how long till an order is complete the PizzaMaker will need to keep some queue of Orders in process. The PizzaMaker uses the number of Orders in the queue to determine the amount of time before an order can be started. So in a lower level we may have an OrderQueue interface. We will create tests for that interface that check that it performs according to its contract. Things to Remember In interface-oriented design the emphasis is on designing a solution with interfaces. When using IoD here are some tips Use IRI cards to assign responsibilities to interfaces. Keep service interface definitions in code separate from the code for classes that implement it. Write tests first to determine the usability of an interface. Write tests against the contract for the interface. Part III Interfaces in the Real World Chapter 8 _Link Checker This chapter and the next two present three interface-oriented designs. Each design emphasizes different aspects of interfaces The Link Checker demonstrates using an interface to hide multiple implementations that parse a web page. The Web Conglomerator shows how to delegate work among multiple implementations. The Service Registry presents a document-style interface and demonstrates some issues with documents. Having broken links on your web site can annoy your visitors. I m sure I have had several broken links on mine the Net is an ever-changing place. A link checker that ensures all links are working is a valuable tool to keep your visitors happy. In this chapter we ll create a link checker and along the way we ll see how designing with interfaces allows for a variety of easily testable implementations. Vision The vision for this system is short and sweet. The link checker