I have to build a form builder for work. A form builder is a tool like Wufoo where you can build forms without writing code.
I’m having trouble coming up with a good OO design. The form builder should have a rather ajaxy interface, the forms should of course be persisted in a relational database, and should allow the user to build both simple and complex forms.
Right now I have come up with the following designs:
Do as little backend stuff as possible. Manipulate and build the forms client side and then just save the raw html in the database as text. This puts as much form building logic into the front end and makes persistence very simple.
Use the composite pattern to represent the form in the backend and have a way of converting those objects to HTML. The client side would then communicate with the server over ajax whenever the user wants to manipulate it somehow. This puts most of the form building logic into the backend, makes persistence more tricky, and would require a lot of ajax calls.