tailieunhanh - Interface-Oriented Design phần 8
Nội dung của ReserveOneWayAirfare có thể ngắn hơn, nếu máy chủ được trạng thái. Các máy chủ sẽ cần phải nhớ những gì Các lựa chọn đã được truyền. Sau đó ReserveOneWayAirfare có thể chỉ chứa một chỉ số vào vùng lựa chọn của tài liệu QuotationForOneWayAirfare. | Analysis 142 Figure Web browser results Analysis Let s create some IRI cards for potential interfaces. We stated that we are going to display the information in a web browser. However the display of information should not be coupled to how we obtain the information. Otherwise changing a provider for a piece of information can have ramifications throughout the system. So we create data gatherer interfaces as well as data formatter interfaces. Instead of showing the actual cards we save a little paper and just list the proposed interfaces IndividualDataGatherer - Retrieves one type of information . weather from an information provider IndividualDataFormatter - Formats information of a single information type WebConglomerator - Formats information from IndividualDataFormatters Analysis 143 These interfaces may seem a bit too abstract to help us really understand the system. So using the prototype page in the previous section let s examine the data we need to gather in a concrete instance. The only caveat is that we do not want to limit ourselves to a particular type of information. Generalization of these interfaces can be deferred to a later time. We just want to keep in mind that if interfaces may be generalized we do not make any decisions that would obviously make that generalization harder. A Concrete Gatherer We do a little checking of potential sources for weather information for a DataGatherer. It turns out that if you do not have a recognizable city some sources return either an error message or a multiple-choice selection. However all the sources can use a ZIP code to uniquely identify a location. So the first step in obtaining weather information is to find the ZIP code for a location. So we start with a LocationFinder to obtain the ZIP code or the city state if a ZIP code is entered. This initial interface looks like this data interface Location City State Zip interface LocationFinder Location find_by_city_state City State signals .
đang nạp các trang xem trước