Đang chuẩn bị liên kết để tải về tài liệu:
Thiết kế mạng xã hội với PHP - 5
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Thiết kế và mô hình kiến trúc là những giải pháp cho các vấn đề lập trình phổ biến, và sử dụng thích hợp của họ có thể giúp đảm bảo rằng một hệ thống được thiết kế tốt, dễ dàng để xây dựng dựa trên, và dễ dàng cho những người khác để làm việc. | Planning and Developing the Core Framework Designing the framework Before we jump in and start programming it is important that we take some time to plan and properly design the framework. Patterns making life easier Design and architectural patterns are solutions to common programming problems and their appropriate use can help ensure that a system is well-designed easy to build upon and easy for others to work with. MVC Model-View-Controller The Model-View-Controller pattern is an architectural design pattern designed to separate the user interface from the business logic of an application. The user interface view uses the controller to interact with the logic and data of the application model . Let s think about our Dino Space social networking site to see how this will work. If a user adds another user as a friend they see the Add as a friend view. When they click the appropriate button to add the user as a friend the controller processes this request from the user and passes the request to the model which updates the user s friends list and where appropriate sends any notifications. The view then updates via instructions from the controller to inform the user of the outcome of their request. The following figure shows the components of the MVC architectural design pattern Our use of MVC won t be a religions implementation of the pattern. However it will be an MVC style there are numerous debates and discussions within the industry about exactly what MVC is within websites and web-frameworks and if it is even truly applicable to web-based applications. 22 Download from Wow eBook www.wowebook.com Chapter 2 Model Within our framework the models will be PHP classes that store manage and process data and business logic. Access to the underlying database of data will be handled by a database access layer which the model will make use of. The models will link closely with the database behind our social networking site representing the data in a more suitable way .