Open SourceAdd Refactoring to Your PHP Development with MySQL Stored Procedures and Views

Add Refactoring to Your PHP Development with MySQL Stored Procedures and Views content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

A common programming mistake is heavily intermingling the application logic and the domain model. In particular, it’s so easy to interact with a MySQL database via a PHP-driven website that developers fall prey to less-than-optimal coding strategies. For example, PHP developers who have MySQL on their backends tend to cram an inordinate amount of SQL into their website logic, resulting in undecipherable code that’s impossible to maintainable. A number of products have emerged to help developers avoid this practice, most notably MVC frameworks such as the Zend Framework.

However, whether you use an MVC framework or write custom code, you can further separate your application logic from the domain model by taking advantage of MySQL’s views and stored procedures. Both features enable you to bundle more of the domain model’s logic within the database server itself, thereby minimizing the number of changes you’ll need to make later due to code refactoring — not to mention assigning more control over domain model-related matters to a database administrator when working in larger team environments.

In his article, Jason Gilmore introduces MySQL stored procedures and views, and shows you how to use them for refactoring within your PHP development.

Read the full story at PHPBuilder:
Refactor Your PHP Site Using MySQL Stored Procedures and Views

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories