Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Master / Detail Datasource design quesiton

Master / Detail Datasource design quesiton

Scheduled Pinned Locked Moved Design and Architecture
designtutorialquestion
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Mujica
    wrote on last edited by
    #1

    Given the example of an Invoice, where you have 2 distinct areas; a header and details. Can someone shed some light on how I should design my classes to support this ? Here is what I do now: 1) create a base class called, InvDetails 2) create a factory class call, InvDetailsFactory. (The factory will be responsible for reading and updating the Invoice details) 3) create a base class called, InvHeader 4) create a factory class called InvHeaderFactory (same idea as above) Should I create a single class, Invoice, which has 2 components: Header and a collection of Details ? Your input is welcome and appreciated. :rose:

    J N 2 Replies Last reply
    0
    • D David Mujica

      Given the example of an Invoice, where you have 2 distinct areas; a header and details. Can someone shed some light on how I should design my classes to support this ? Here is what I do now: 1) create a base class called, InvDetails 2) create a factory class call, InvDetailsFactory. (The factory will be responsible for reading and updating the Invoice details) 3) create a base class called, InvHeader 4) create a factory class called InvHeaderFactory (same idea as above) Should I create a single class, Invoice, which has 2 components: Header and a collection of Details ? Your input is welcome and appreciated. :rose:

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      To be specific an invoice is a 'report'. Where a report is a static presentation of existing data in a preset form. A better starting point is a order entry screen which would have a create customer screen and a order entry screen. The first lets the operator enter name, address, billing address, etc. From this you have a data model object called 'customer' The second lets an operator pick a customer (already created) and the add order items for the customer. From this you have data model objects for 'order' and 'item' (or call it 'order item' if you prefer.) For an invoice you would then start with a order number. That allows you to get the order and from that you get the items and customer. You also need a 'form'. The form describes the layout of the invoice itself. For example the name and address could be on the left with the order number on the right.

      D 1 Reply Last reply
      0
      • J jschell

        To be specific an invoice is a 'report'. Where a report is a static presentation of existing data in a preset form. A better starting point is a order entry screen which would have a create customer screen and a order entry screen. The first lets the operator enter name, address, billing address, etc. From this you have a data model object called 'customer' The second lets an operator pick a customer (already created) and the add order items for the customer. From this you have data model objects for 'order' and 'item' (or call it 'order item' if you prefer.) For an invoice you would then start with a order number. That allows you to get the order and from that you get the items and customer. You also need a 'form'. The form describes the layout of the invoice itself. For example the name and address could be on the left with the order number on the right.

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        My bad for using the term, Invoice. Maybe it was confusing. Let's go with the concept of an "Order Entry" screen (web page). My question still stands: "Should I create a single class, which has 2 components; Header and a collection of Details?" Or Should I just create 2 separate classes, one that stores and manipulates the Header data while the other represents the details ? Just looking for some suggestions / ideas.

        J M 2 Replies Last reply
        0
        • D David Mujica

          My bad for using the term, Invoice. Maybe it was confusing. Let's go with the concept of an "Order Entry" screen (web page). My question still stands: "Should I create a single class, which has 2 components; Header and a collection of Details?" Or Should I just create 2 separate classes, one that stores and manipulates the Header data while the other represents the details ? Just looking for some suggestions / ideas.

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          My previous example described it specifically in terms of an order entry screen. Precluding the orders themselves, other informatin on the screen would come from 'order', 'customer' and/or inventory (where the data model for that has not yet been defined.)

          1 Reply Last reply
          0
          • D David Mujica

            Given the example of an Invoice, where you have 2 distinct areas; a header and details. Can someone shed some light on how I should design my classes to support this ? Here is what I do now: 1) create a base class called, InvDetails 2) create a factory class call, InvDetailsFactory. (The factory will be responsible for reading and updating the Invoice details) 3) create a base class called, InvHeader 4) create a factory class called InvHeaderFactory (same idea as above) Should I create a single class, Invoice, which has 2 components: Header and a collection of Details ? Your input is welcome and appreciated. :rose:

            N Offline
            N Offline
            Nagy Vilmos
            wrote on last edited by
            #5

            Can the details exist outside of the master? If not then it is an internal class. I would design it having a Master with the overriding details and a list of Detail objects. I'm not convinced you'll need a specialised factory for creating these items, they have relatively simple creation interfaces. I would however consider how the Master will create Detail objects


            Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

            D 1 Reply Last reply
            0
            • N Nagy Vilmos

              Can the details exist outside of the master? If not then it is an internal class. I would design it having a Master with the overriding details and a list of Detail objects. I'm not convinced you'll need a specialised factory for creating these items, they have relatively simple creation interfaces. I would however consider how the Master will create Detail objects


              Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

              D Offline
              D Offline
              David Mujica
              wrote on last edited by
              #6

              You have answered my question. I'm still working on other aspects of the application, so I haven't implemented my Master / Detail business objects yet. Thanks again.

              1 Reply Last reply
              0
              • D David Mujica

                My bad for using the term, Invoice. Maybe it was confusing. Let's go with the concept of an "Order Entry" screen (web page). My question still stands: "Should I create a single class, which has 2 components; Header and a collection of Details?" Or Should I just create 2 separate classes, one that stores and manipulates the Header data while the other represents the details ? Just looking for some suggestions / ideas.

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                I build my classes to reflect the data structure Customer may have a collection of Order(s) Order may have a collection of OrderItem(s) An Invoice will have a Customer An invoice will have a collection of OrderItem(s) Each code block is a table and also a class

                Never underestimate the power of human stupidity RAH

                M 1 Reply Last reply
                0
                • M Mycroft Holmes

                  I build my classes to reflect the data structure Customer may have a collection of Order(s) Order may have a collection of OrderItem(s) An Invoice will have a Customer An invoice will have a collection of OrderItem(s) Each code block is a table and also a class

                  Never underestimate the power of human stupidity RAH

                  M Offline
                  M Offline
                  may esguerra
                  wrote on last edited by
                  #8

                  Oh no, stupidity sucks!!!! I know a top seo if by any chance you'll be looking for one just message me.thanks! Topseos and Topseos and Topseos and Topseos and Topseos and Topseos

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups