TAILIEUCHUNG - Developing Large Web Applications- P17

Developing Large Web Applications- P17: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 | Working with Pages As mentioned earlier a page from the point of view of this chapter is the canvas responsible for assembling a collection of modules so that they work well together within a single context. Because most pages perform a similar set of tasks it s useful to define a base class that provides a minimum set of capabilities for all pages. For example all pages fundamentally need a way to save and load data define content and assemble the page s components among other things. In this section we ll take a closer look at Page the base class that performs tasks that are common for all pages. Although it s not hard to imagine features beyond those presented here for such a class the example provides a good starting point for many large web applications. We ll explore the class by examining its public interface abstract interface and implementation details. Public Interface for the Page Class The public interface for Page consists of methods for which most pages can benefit from a default implementation. For example the public interface for Page provides methods for assembling a page as well as managing the CSS and JavaScript for the page overall. It s worthwhile to take a moment to observe carefully how the methods in this class are implemented because these provide a high-level definition of the steps that allow pages to be assembled in a modular fashion. Structure and assembly The methods for working with the structure and assembly of a page let you generate the body of the page assemble the final page and get some individual tags for the document type title and various metadata about the page create Creates the body for the page and returns the HTML markup for the body tag. The body is returned so that pages that would prefer to assemble themselves rather than calling get_page have that option. In the process create performs several important tasks. These include in order registering links see register_links saving and loading dynamic data setting various

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.