tailieunhanh - Tạo mạng xã hội với PHP - part 5
Tham khảo tài liệu 'tạo mạng xã hội với php - part 5', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 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 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 which is easier
đang nạp các trang xem trước