Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

is it wise to create tables/sets in a generic, object-oriented fashion?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    is it wise to create tables/sets in a generic, object-oriented fashion?

    I have the opportunity to start a database from scratch. I'm a software developer but not a database programmer.

    It seems like a general scenario: I have customers and vendors - both with business and contact information. Some customers may also be vendors. Contacts have address and telephone information. Instead of repeating the same information for customers and vendors, I want to create tables and sets properly to avoid duplication of fields. So here's what I was thinking:

    address.dbf
    - id(FK)
    - street
    - city
    - state
    - zip

    person.dbf
    - id(FK)
    - first_name
    - last_name
    - middle_initial
    - phone_number
    - address_id(FK)

    person.set
    - address_id(FK) one-to-one link to address.id

    business.dbf
    - id(FK)
    - shipping_address_id(FK)
    - billing_address_id(FK)
    - contact_id(FK)

    business.set
    - shipping_address_id(FK) one-to-one link to address.id
    - billing_address_id(FK) one-to-one link to address.id
    - contact_id(FK) one-to-one link to person.id

    customer.dbf
    - id(FK)
    - business_id(FK)

    customer.set
    - business_id(FK) one-to-one link to business.id

    vendor.dbf
    - id(FK)
    - business_id(FK)

    vendor.set
    - business_id(FK) one-to-one link to business.id

    ---

    Am I on track?

    #2
    Re: is it wise to create tables/sets in a generic, object-oriented fashion?

    I am not sure that there is only one "right way".
    For example, customers in some businesses may be people or businesses.
    In some cases businesses may be a subsidiary and so there is a "head-office" that all invoices go to for payment.
    Addresses can also be a problem - there may be several delivery addresses as well as an invoice address.
    In short, you need to think about what suits your application and go with that. Fortunately if you make a mistake, Alpha has lots of functionality to enable you to re-shape the data if you make a bad decision that must be corrected.
    Without knowing more about your application, if anything, you may have taken normalization too far.
    But there is an argument that you may not have taken it far enough - some vendors are customers in many businesses.

    Comment


      #3
      Re: is it wise to create tables/sets in a generic, object-oriented fashion?

      Originally posted by cayennetc View Post
      Am I on track?
      I would not separate the tables as you have done. Not even sure you need a separate address table - unless more than one person shares the same address. You can differentiate contacts with logical fields such as "customer", "vendor", "etc". You could have an address type field = "business", "personal", "home", "whatever". Your structure seems to me to be not normalized. You can always take normalization too far, but I think you might consider consolidating.
      Peter
      AlphaBase Solutions, LLC

      [email protected]
      https://www.alphabasesolutions.com


      Comment


        #4
        Re: is it wise to create tables/sets in a generic, object-oriented fashion?

        You are right or you could do it different depending on what you want to accomplish in the end. If you can visualize what you need in the end and work backwards on paper what you need, it will probably work well.

        If the customer/client is what is the most important. I would and do put a customer/client in one table and as much as I can keep up with. If there may be 2 addresses for the same person(eg. address and PO BOX), I make fields to accommodate, not tables.

        If the address is what is the most important, then the address in a table and one to many connect names, etc.

        Does that make sense? keep it simple and go with what is most often important? try not to make sets with a lot of tables. They perform better?

        I have a hard time keeping up with tables with over a hundred fields, so I do make more tables when like that even if I could keep all the fields in one table. It also helps with the file sizes if a bunch of records are put in.
        Dave Mason
        [email protected]
        Skype is dave.mason46

        Comment


          #5
          Re: is it wise to create tables/sets in a generic, object-oriented fashion?

          I don't yet have a lot of database programming, but I've got a ton of O/S systems programming background, and the one thing I've learned is that disk I/O is almost always the bottleneck. If you can reduce disk seeks, you can dramatically speed up the application. I've seem some designs literally become 100 times faster (or more) by intelligently reducing disk seeks through redesigning disk-access algorithms and strategies.

          To do this you may need to store duplicate information in other files that can be accessed and assembled when creating a customer record in the first place (speed may not be so crucial when creating a new customer since you do this only once for that customer). But then when the customer record is accessed, everything is available with one fetch (and the record is likely to be accessed many times).

          But... everything depends on what you want, what you need, the expected size and growth of the database, and other issues.

          AlphaFive lets you design things any way you wish - it's unlimited. But, think through the disk I/O issues. Using the key idea from Dave and Peter, accessing a customer's address, phone, etc. requires one disk seek (ignoring index-file issues for a moment). Separating the addresses from the personal info from the business info, Jeffrey, as you are considering, could require three or more disk seeks, and disk seeks are the most expensive things to deal with (in terms of speed). And tripling the number of disk seeks can, and usually does, slow things down FAR MORE than triple.

          So what do you do? It depends.

          I'm actually looking at a design very similar to your thinking for a family-directory project. It makes sense to me to separate addresses from people since members of a family can have multiple and/or different addresses - they go to school, move out, get married -- but they still belong to the family, but with a different address.

          And sometimes siblings live together at one address that is different from Mom and Dad's. So in my application, I've decided the address is important and needs to be in its own table, separate from the people. It makes it MUCH easier to handle moving to another home, or changing the main home phone number - I just change it in one place and those living together "move" with the single address change.

          I know this could slow things down as the database grows, but then I'm dealing with only hundreds of records at the most, so the speed issues should be liveable.

          So, intelligently follow all the advice here and do what you think is best. And be ready to test things, and if speed (or complexity) is an issue, consolidate the data.

          I hope this makes sense and helps - good luck!
          There are three kinds of people in the world: those who can count, and those who can't.

          Comment


            #6
            Re: is it wise to create tables/sets in a generic, object-oriented fashion?

            You have some very knowledgeable people chiming in here.

            I deal with a contact management adb. It is for car sales, so is a little different from some others.

            It has a table for the customer 125 fields, the money 118 fields, applications, 80 fields and still connects to a vehicle 70 fields, trades, 60 fields 1 to many, sales person 30 fields, company 80 fields, insurances, finance companies, and more.

            a customer may wind up inserted many times as time goes on as they buy more cars. The newest I am working on now will retain the customer seperately so they are only entered one time and periodically updated. addresses will be updated and not re-entered. The customer will be a ttached to a deal number rather than all connected to a user number.

            This is more in line with what you are thinking, but saving disk reads by including all I can in single tables.

            Most of my programs will never go over 500,000 records, so I should never have issues with speed as it is written now.


            .
            Dave Mason
            [email protected]
            Skype is dave.mason46

            Comment

            Working...
            X