Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Relationship 'OOP' (A2K, SR3)

    Here's an interesting question I had while trying to design an activity scheduler/recorder: Can tables be "typed" as variables can in object oriented programming? (Forgive me, please, if I get wordy; I know exactly what I want, but I'm having trouble putting it into words).

    We have several different groups who perform their duties, then pass the responsibility for the overall project to the next group who have their own set of activities and pass responsibility to the next group, etc. My goal is to put together a database that will consolidate these activities, providing an "umbrella" that will show where delays in one group affect the rest and also where activities can overlap. To make this work more easily, it would be useful if a group can log into the database and create a new "activity object" that contains a template of their standard activities, timing, costs, etc.

    For example: if I were to try to schedule my family's daily activities, each of us would have a different set of sctivities we perform daily, and it would become rapidly tedious to put each of these into a database to help the rest of the family see where the schedule stands. However, my activities would be something like Parent.Shower, Parent.Breakfast, Parent.Commute, etc. My daughter would have Child.Wake, Child.GroanAboutWakeup, Child.Breaksfast, Child.CallFriends, etc.

    As I write, I'm getting a fuzzy picture how this might be modeled, but I am no expert, and I would appreciate feedback from the wiser and better trained among you.

    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    As far as I can tell, your actual question is about data design, not about object-oriented programming. You could design a series of tables to model the activities of various types of person - see picture below.

  3. #3
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    Might there be something here or here which helps?
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  4. #4
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    Thanks, Hans and Steve, for your quick replies.

    As you observed, Hans, my question is a design question, and I don't think I adequately phrased the conundrum.

    Your model (it appears to me) looks like everyone does the same activities in approximately over approximately the same duration. I have in mind the idea that although the parents have similar activities, some are unique to them. The same with the children. And the children have activities very different from the parents.

    I'm pondering a data model assumes the "children" have a set schedule type: Get up, perform morning hygiene, get to school, attend school, after school activities, homework, free time, bed. Parents get up, hygiene, get kids to school, go to work, come home, pay the bills, pick the kids up from school, help with homework, mow the lawn, put kids to bed, go to bed. Grandparents wake, eat breakfast, call the grandkids, send spoil money, go parasailing, eat dinner, got to bed. For each person to put in each of these activities every day would be tedious, and eventually, they'd stop. But if they could tell the database what "type" they are when they schedule themselves every day, the database could automatically add their default activities to the family schedule.

    Am I making sense?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    The table with ActivityID and PersonTypeID describes which activities each type of person has. You could add a field that specifies the order in which activities are performed.
    You can use this table to create a set of records for a specific person - copy the records for the appropriate PersonTypeID into the actual activities table, with the PersonID for that person.

  6. #6
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    So perhaps when they select who they are on a form, the form could open a new for based on the table defining that person's templated activities. They would then complete the form, and when they click "submit", append the data via VBA?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    Yes, that's the idea, more or less.

  8. #8
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    Thanks, Hans. And congratulations, by the way!

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Relationship 'OOP' (A2K, SR3)

    You are describing a class implement situation, which isn't available in Access 2000 and is only rudimentary in AXP. You can, of course, write classes in those versions to wrap the individual family members, together with their methods and properties, and hide all the ugly details within the privacy of the class, it's only the Implement keyword that is lame. The class isn't directly reflected in the table structure, since the class is made to handle the table structure and the properties, methods and events associated with an instance of the class.

    You could start with a person class, which would have basic functionality like get up, go to bed, eat and properties like name and gender. Subclasses of person might be parent, child or grandparent, each with different kinds of additional functionality. Is that what you are thinking of?
    Charlotte

  10. #10
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    That's it exactly, Charlotte!

    Now, I have to admit: I'm entirely self-taught. But I've used classes, object, inheritance, etc. in Pascal and VBA, so I have a decent (not great!) grasp of them. I was just wondering if there was a way to set something up similar in a relational database. Can I make a table that defines a class? If so, how do I go about doing it? How would I set up the relationships?

    I understand Hans's idea, and it has merit, but will require a decent amount of coding, a lot of error control, and if another family member--say, the dog--gets added, would require more programming to implement. It just seems an "object-oriented" table approach--though perhaps more difficult to set up--would be easier to maintain and update.

    Am I in outer space with this idea? <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15>

  11. #11
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Relationship 'OOP' (A2K, SR3)

    You're making a very common mistake in thinking when it comes to databases and object-oriented interfaces. The table is nothing but a datastore, a lot of buckets in which you place different types of data. A class object is an abstract wrapper written in code to provide an interface for handling the data in the table or even in multiple tables and to hide all the machinery from public view. The class describes and provides tools for handling the table, not the other way around.

    Tables in Access just lay there and accumulate data, much as a hole in the ground accumulates trash. The table is a passive object and it knows nothing about the world around it. It only knows what kind and shape of data it can hold. The class is an active and aware object that knows its scope and knows how to talk to and manipulate one or more tables (which includes queries, since they behave like tables) and to perform sometimes complex actions in response to simplified user instructions. Classes can respond to events, so if you want to add a record to a table, you could use a class that has an addrecord method, which knows how to talk to the table and validate the data. If you want to know how many widgets are described in the table, you can ask the class. What it does behind the scenes is for the programmer to know and for you to use. Most of us can drive an automobile, but few of us could build an engine and drive train, we just know how to put in the gas and turn on the key.
    Charlotte

  12. #12
    Star Lounger
    Join Date
    Jan 2001
    Location
    Littleton, Colorado, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relationship 'OOP' (A2K, SR3)

    OK, then...I am in outer space!

    I can conceive of a way to do this, though, using Hans's model above (I think).

    The more I think about it, Hans, your model would work well. I was thinking in terms of relationships. Relationships, however, are static. But if I was to use a query joining two table through a FamilyMemberType table, I get a dynamic relationship. If I then based the form on the query, once the user clicks "Submit" I simply append the data.

    There still remains the problem of individual forms unless I use a data grid....

    Thanks, Charlotte and Hans, for talking me through this!

Posting Permissions

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