0 Replies Latest reply on Mar 9, 2009 8:52 PM by mapoitras

    Architecture question

    mapoitras

      I have an architecture question.  We are building a framework to support many different type of user forms, where users fill out application forms.  Most of thes forms are very similar and we plan on using a bit of a wizard type  interface that guides the users along as they fill out the form.


      We were thinking of creating a generic baseline which would contain the most common functionality and then override and extend for specific forms.


      So for example we could have a genericPage1 back end bean with a genericPage1.xhtml. And then we repeat that for page 2 to 5.  Now if we need another page for Form type B then, we could add a back end bean just for that type formTypeBPage1 with its own xhtml. 


      Where I'm having some issues is what if we want to add some specific validations or extra business rules to a generic page for a specific Form type.  For example, Form type A doesn't have many validations but form type B which uses the same front end GUI has many validations.  We are hoping not to have to put in the if (Form Type A) do this... if (form Type B) do this....  It would be nice to put the Form type A functionality as generic and for Form Type B, we inherit the component A and override the validations methods as needed.At first we thought of simply overriding the generic page and the validations methods but that doesn't work in seam if the ancestor objects has a factory.  Maybe we shouldn't use factories?  Are there other Seam annotations that could cause problems?


      Another option would be to have the validations in a separate object called from the generic back end bean.  We could have a factory that loads the correct validations on creation based on the form type.  This could be a bit messy with lots of delegation methods if there are many validations and business rules.


      We could create Seam components for each form types and then create more Seam components for all the business rules and inject them as needed but I'm unsure how well that would work to inherit, override and/or extend some of the rules as needed.


      Overall, I need a way to create a baseline and then also have specific form applications lines, pages that we can override and/or extend and/or rules that we can override and/or extend.  We are also looking at breaking the xhtml into parts that we can load base on needs.  the goal is to be able to re-use as much code as possible to simplify maintenance without going overboard and making something too complex.  I was wondering if anyone has tips, patterns or recommendations on the best way to proceed.


      thanks