Đang chuẩn bị liên kết để tải về tài liệu:
Developing Large Web Applications- P4

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Developing Large Web Applications- P4:This book presents a number of techniques for applying established practices of good software engineering to web development—that is, development primarily using the disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages. Whereas there are many books on how to use languages, how to use libraries, and how to approach software engineering, this is the first book to codify many of the techniques it presents. These techniques will make the components of your own web applications more reusable, maintainable, and reliable | Figure 2-2. Classes related by association Modeling a Web Page Now let s turn to the class diagram for a web page shown in Figure 2-3. This diagram captures the way we re going to think about web pages when we write some PHP code to build them in a modular fashion in Chapter 7. It doesn t capture all the details of the implementation in Chapter 7 but it shows enough to illustrate the resemblance between this type of model and its object-oriented code in Example 2-3. Our diagram has two fundamental entities pages and modules. Defining Page Types The most general form of a page is represented by a class called Page which represents the data and operations for web pages across all types of web applications. We also recognize the need for more specialized classes of pages on a specific website e.g. SitePage pages on certain sections of the site e.g. NewCarsPage and pages for very specific purposes e.g. NewCarSearchResultsPage . The diagram further conveys the fundamental use of modules in pages. Every page is composed of modules and a module conversely has an association with the page on which it resides. This way it can add what it needs to the page. To keep things simple for now the diagram shows just one data member for Page js_module and one operation add_to_js. In Chapter 7 you ll see that modules need a way to add their JavaScript to a page and add_to_js provides a way to do this. Pages need someplace to collect the JavaScript and the diagram shows the data member js_module for just this purpose. Defining Module Types The most general class of module is Module which represents the data and operations common to all modules. We also recognize the need for more specialized classes of modules to implement modules for very specific purposes e.g. NavBar as well as layouts and containers which are themselves more specific forms of Layout. Modeling a Web Page 11 Figure 2-3. A class diagram for modeling a web page Writing the Code Once we have this model for a web page it