newbie: is this the appropriate use of a class?

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

VB.Net2003, Win XP

I plan to build an interface to view video clips, and associate any of a
number of "flags" with each clip (videos are research data, with flags for
any of a number of participants, behaviors, etc. who are in each clip).

I was originally thinking that I'd need to learn more about databases and
just track all my flags in a database, but now I'm wondering if I should
build a "videoclip"class and associate each flag as a property. I'll end up
with a lot of unused properties on each instance of the class (each clip has
less than half the participants, and a random number of behaviors), but it
seems conceptually simpler- then I'd just need to figure out how to save,
load, and unload the data from class instances each time the program is
loaded or exited, for persistence of the data (maybe as an XML file?)

Class VideoClip, an instance might contain properties such as:
.Filename = "c:\SubjectData\Videos\060206_17.avi"
.VideoCaptureDate = "06/02/2006"
.VideoCaptureLocation = "West"
.Participant1Present = False
.Participant2Present = True
(etc)
.Behavior1 = True
.Behavior2 = False
.Behavior3=True
(etc)

or maybe I should use arrays?
.AllParticipants(False,True,True,False,False,False,False)
.AllBehaviors(True,False,True,False,False,True)
(of course, if my base list changes, then I might have a problem with
backward compatibility)

This would make it extra easy to find the clips since I have the filename
property embedded, and I'd just have to learn how to cycle through instances
of the class using an array and associate that instance with the player
window, so I could play the clip while showing (or editing) the properties

Is this an appropriate use of a class, or should I stick with a database
approach? I've done some VBA programming, and some very basic VB.net CF
stuff, but I'm very much a newbie at this- especially design issues, since I
haven't used the full framework before.

Thank you,
Keith
 
Keith said:
VB.Net2003, Win XP

I plan to build an interface to view video clips, and associate any of a
number of "flags" with each clip (videos are research data, with flags for
any of a number of participants, behaviors, etc. who are in each clip).

I was originally thinking that I'd need to learn more about databases and
just track all my flags in a database, but now I'm wondering if I should
build a "videoclip"class and associate each flag as a property. I'll end up
with a lot of unused properties on each instance of the class (each clip has
less than half the participants, and a random number of behaviors), but it
seems conceptually simpler- then I'd just need to figure out how to save,
load, and unload the data from class instances each time the program is
loaded or exited, for persistence of the data (maybe as an XML file?)

Class VideoClip, an instance might contain properties such as:
.Filename = "c:\SubjectData\Videos\060206_17.avi"
.VideoCaptureDate = "06/02/2006"
.VideoCaptureLocation = "West"
.Participant1Present = False
.Participant2Present = True
(etc)
.Behavior1 = True
.Behavior2 = False
.Behavior3=True
(etc)

or maybe I should use arrays?
.AllParticipants(False,True,True,False,False,False,False)
.AllBehaviors(True,False,True,False,False,True)
(of course, if my base list changes, then I might have a problem with
backward compatibility)

This would make it extra easy to find the clips since I have the filename
property embedded, and I'd just have to learn how to cycle through instances
of the class using an array and associate that instance with the player
window, so I could play the clip while showing (or editing) the properties

Is this an appropriate use of a class, or should I stick with a database
approach? I've done some VBA programming, and some very basic VB.net CF
stuff, but I'm very much a newbie at this- especially design issues, since I
haven't used the full framework before.

Thank you,
Keith
 
The typical scenario is a database with a well designed schema that is the
relational data store for the application data PLUS classes application side
that can create, retrieve, update, delete data and otherwise process
application data.
 
Keith,

If you are thinking about classes think than as well what parts should be
collections in that.

By instance your video has probable many or zero partipicipants.

An sample is the forms class, it has a collection with a lot of controls in
it, but that can as well one, have a look at the collections class or the
genericcollections.

http://msdn2.microsoft.com/en-gb/library/ms132397.aspx

I hope this helps,

Cor

Cor
 
Keith said:
VB.Net2003, Win XP

I plan to build an interface to view video clips, and associate any of a
number of "flags" with each clip (videos are research data, with flags for
any of a number of participants, behaviors, etc. who are in each clip).

I was originally thinking that I'd need to learn more about databases and
just track all my flags in a database, but now I'm wondering if I should
build a "videoclip"class and associate each flag as a property. I'll end up
with a lot of unused properties on each instance of the class (each clip has
less than half the participants, and a random number of behaviors), but it
seems conceptually simpler- then I'd just need to figure out how to save,
load, and unload the data from class instances each time the program is
loaded or exited, for persistence of the data (maybe as an XML file?)

Class VideoClip, an instance might contain properties such as:
.Filename = "c:\SubjectData\Videos\060206_17.avi"
.VideoCaptureDate = "06/02/2006"
.VideoCaptureLocation = "West"
.Participant1Present = False
.Participant2Present = True
(etc)
.Behavior1 = True
.Behavior2 = False
.Behavior3=True
(etc)

or maybe I should use arrays?
.AllParticipants(False,True,True,False,False,False,False)
.AllBehaviors(True,False,True,False,False,True)
(of course, if my base list changes, then I might have a problem with
backward compatibility)

This would make it extra easy to find the clips since I have the filename
property embedded, and I'd just have to learn how to cycle through instances
of the class using an array and associate that instance with the player
window, so I could play the clip while showing (or editing) the properties

Is this an appropriate use of a class, or should I stick with a database
approach? I've done some VBA programming, and some very basic VB.net CF
stuff, but I'm very much a newbie at this- especially design issues, since I
haven't used the full framework before.

Thank you,
Keith

One possible way would be to have a class for your VideoClips that has
a collection for participants and a collection for behaviors. You
would then need classes for Participant and Behavior

Class Participant
End Class

Class Behavior
End Class

Class ParticipantCollection
End Class

Class BehaviorCollection
End Class

Class VideoClip
Property Participants As ParticipantCollection
Property Behaviors As BehaviorCollection
End Class

Then, each VideoClip can have zero or more Participants and Behaviors.

Hope this helps
 
Back
Top