SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    object oriented forms

    I need to design about 20 forms for various business processes.
    We have to do this for about 10 countries and need some form of object prietnted approach because each country has different business rules and some different bits of data. However, there is also common data between some of these countries.

    For example, we have 5 bits of data, 4 are common to every country, 1 is specific for individual countries.
    eg common Name, Address, Telephone, Male/Female
    eg Bonus payment

    To avoid having to have 200 forms (20 forms x 10 countries), what is a good way to go about designing forms that can inherit from each other?

    It's more complicated than that but should we have a base form that all countries can inherit and then specific country forms or 1 form with a base and then country specific validation rules.

    It's a question of how do you manage all the code changes easily in an enterprise application without the code being too unwieldy?

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,314
    Mentioned
    19 Post(s)
    Tagged
    1 Thread(s)
    Perhaps peruse the Symfony Form component, and see if it's to your liking.
    "First make it work. Then make it better."

  3. #3
    SitePoint Member
    Join Date
    Apr 2013
    Location
    London
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can save your time and reduce no. of forms,by making common forms in multi-languags.Noow its possible to convert page content according to there country's language.Rest form that are specific for that country need not to make it in multilanguage. Once you consult your web designer company ,they will surely suggest about the technology.

  4. #4
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by VictorCulbre View Post
    Yes you can save your time and reduce no. of forms,by making common forms in multi-languags.Noow its possible to convert page content according to there country's language.Rest form that are specific for that country need not to make it in multilanguage. Once you consult your web designer company ,they will surely suggest about the technology.
    It's not just the languages, that would essentially be driven by a config code that lists the names for the lables.
    ...but also each form may have 60% of it's design from a gloabl form and then 70% from a local form, local to the specific country.
    It would seem better to me to instead of having 20 or 100 local forms that it should be just 1 global form that can have some config code written for each country. That config code would determine what to display on the form.

  5. #5
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by qwertyjjj View Post
    It's not just the languages, that would essentially be driven by a config code that lists the names for the lables.
    ...but also each form may have 60% of it's design from a global form and then 40% from a local form, local to the specific country.
    It would seem better to me to instead of having 20 or 100 local forms that it should be just 1 global form that can have some config code written for each country. That config code would determine what to display on the form.
    anyone?
    any ideas on forms inheritance or other?

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by qwertyjjj View Post
    It's more complicated than that but should we have a base form that all countries can inherit and then specific country forms or 1 form with a base and then country specific validation rules.
    I would opt for the first, because that keeps the objects leaner. That is to say, if you have an object with the standard rules and then a list of multiple exceptions (most likely ending up in an if/then/else galore) it's not very clear what's happening, whereas separate classes that just list the differences between them and the base object are easier to follow.

    In terms of front end I would make it so that PHP can read the form model and build input fields accordingly, so you don't have to code each any form yourself, and change it when the form changes, etc.

    My
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  7. #7
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    I would opt for the first, because that keeps the objects leaner. That is to say, if you have an object with the standard rules and then a list of multiple exceptions (most likely ending up in an if/then/else galore) it's not very clear what's happening, whereas separate classes that just list the differences between them and the base object are easier to follow.

    In terms of front end I would make it so that PHP can read the form model and build input fields accordingly, so you don't have to code each any form yourself, and change it when the form changes, etc.

    My
    If you do it that way then you 1 main form and then each country has it's own form, then you have another form for each country business process.
    So you might have:
    Mainform
    USA_SendLetter
    UK_SendLetter
    ARG_SendLetter
    USA_ProcessBonus
    UK_ProcessBonus
    ARG_ProcessBonus
    x another 100 counties
    x another 10 business processes

    Isn't there some way to build a dynamic form on the fly so that you have 1 form ProcessBonus for every country, that form inherits fields from MainForm, and then it checks configuration Class in the background to build the form dynamicaly for each country?

    I'm trying to avoid having 10 form types and then another 100 local forms for each country, that would be well over 1000 forms and would be unmanageable wouldn't it?

  8. #8
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by qwertyjjj View Post
    Isn't there some way to build a dynamic form on the fly so that you have 1 form ProcessBonus for every country, that form inherits fields from MainForm, and then it checks configuration Class in the background to build the form dynamicaly for each country?
    Sure can, but that would be an enormous config class. Not sure if that's workable.

    Quote Originally Posted by qwertyjjj View Post
    I'm trying to avoid having 10 form types and then another 100 local forms for each country, that would be well over 1000 forms and would be unmanageable wouldn't it?
    Probably, yes.

    Or, given the amount of data, maybe you could create a config file, like a JSON file or something that defines which fields every class should have, and then create classes that can load their config from that?

    Something like
    Code:
    {
        'ProcessBonus': {
            'fields': ['first_name', 'surname', 'bonus'],
            'businessrules': ['payment'],
            'per_country': {
                'USA': {
                    'additional_business_rules': ['payment2'],
                    'additional_fields': ['state']
                }
            }
        }
    }
    And then if the country is not in the per_country list assume it has no additional fields/business rules.

    Just thinking out loud here.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  9. #9
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I hear there is something called Java Interfaces as well although it sounds like another OOP, I'm not sure what's it's called in .NET.
    There could be some combination of forms inheriting using "Interfaces" and then configursation items for each form taken either from a DB or from JSON?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •