What are some good design patterns for CRUD?

Posted by Extrakun on Stack Overflow See other posts from Stack Overflow or by Extrakun
Published on 2010-04-03T07:33:20Z Indexed on 2010/04/03 7:43 UTC
Read the original article Hit count: 323

I am working with a number of data entities which can be created, read, updated and deleted, and I find myself writing more or less the same code for them. For example, I need to sometimes output data as JSON, and sometimes in a table format. I am finding myself writing 2 different types of view to export the data to. Also, the creation of those entities within DB usually differs just by the SQL statements and the input parameters.

I am thinking of creating a strategy pattern to represent different 'contexts'. For example, the read() method of an AJAX context will be to return the data as JSON. However, I wonder if others have deal with this problem beforehand and will like to know what design patterns are usually use for CRUD operations.

© Stack Overflow or respective owner

Related posts about software-engineering

Related posts about design-patterns