473,378 Members | 1,152 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

OOP Question

Can someone tell me the OOP way to code classes for small tables of data?

For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class (similar
to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())

Return bCategories
End Function

End Class
Nov 20 '05 #1
13 1085
The question comes to my mind, Why dont you simply use the ADO.NET classes,
or if you need more functionality, simply inherit them and add your own
custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?

For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class (similar to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())

Return bCategories
End Function

End Class

Nov 20 '05 #2
If you're talking about using datatables, then that is the way i'm used to
doing it, but i understood that datatables were not intended for the web
(less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
The question comes to my mind, Why dont you simply use the ADO.NET classes, or if you need more functionality, simply inherit them and add your own
custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class

(similar
to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())

Return bCategories
End Function

End Class


Nov 20 '05 #3
You should consider a Custom Control, this way you can have full control
over the rendered output for it and include whatever data storage you need

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
If you're talking about using datatables, then that is the way i'm used to
doing it, but i understood that datatables were not intended for the web
(less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:Oi**************@tk2msftngp13.phx.gbl...
The question comes to my mind, Why dont you simply use the ADO.NET

classes,
or if you need more functionality, simply inherit them and add your own
custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class

(similar
to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)), Category())

Return bCategories
End Function

End Class



Nov 20 '05 #4
Hey Terry,

Thanks for the response.

I'm not concerned with presentation at this point. I'm focusing on the data
and business layers. Some of these classes may not have a presentation
layer -- just used by other classes.

Thanks,

Chris
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
You should consider a Custom Control, this way you can have full control
over the rendered output for it and include whatever data storage you need

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
If you're talking about using datatables, then that is the way i'm used to
doing it, but i understood that datatables were not intended for the web
(less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:Oi**************@tk2msftngp13.phx.gbl...
The question comes to my mind, Why dont you simply use the ADO.NET

classes,
or if you need more functionality, simply inherit them and add your own custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
> Can someone tell me the OOP way to code classes for small tables of

data?
>
> For example, i'm loading several tables that will be stored in the
> current.cache of an asp.net app. One table is credit cards; another is > countries.
>
> Do i need two classes for each of these? A parent and a child class
(similar
> to tables and table in ado.net) or is there a better way to do it?
>
> See code below...
>
> Thanks,
>
> Chris
> BugMonitor.com
>
> Public Class Category
> Public Attrib1 As Integer
> Public Attrib2 As String
> End Class
>
> Public Class Categories
> Public Shared Category As Category()
> Public Shared Count As Int16
>
> Public Shared Function GetAll() As Categories
> Dim bCategory As Category
> While dr.Read
> bCategory = New Category
> With bCategory
> .Attrib1 = val1
> .Attrib2 = val2
> End With
> al.Add(bCategory)
> Count += 1S
> End While
>
> Dim bCategories As New Categories
> bCategories.Category =

DirectCast(al.ToArray(GetType(Category)), > Category())
>
> Return bCategories
> End Function
>
> End Class
>
>



Nov 20 '05 #5
OK, back to your original question
> > For example, i'm loading several tables that will be stored in the
> > current.cache of an asp.net app. One table is credit cards; another
is
> > countries.
> >
> > Do i need two classes for each of these? A parent and a child
class > (similar
> > to tables and table in ado.net) or is there a better way to do it?
Tables and Tables are closely related. It is natural to contain a Table in
Tables. As far as DataTables not being suitable for the web from an
efficiency point of view, do you have impirical evidence to support this.?

I personally 'have' used DataTables as the base for display, and of course
DataGrid's to display, I have not noticed any particular issues with speed.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ap********************@speedfactory.net...
Hey Terry,

Thanks for the response.

I'm not concerned with presentation at this point. I'm focusing on the data and business layers. Some of these classes may not have a presentation
layer -- just used by other classes.

Thanks,

Chris
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:ec**************@TK2MSFTNGP11.phx.gbl...
You should consider a Custom Control, this way you can have full control
over the rendered output for it and include whatever data storage you need
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
If you're talking about using datatables, then that is the way i'm
used to doing it, but i understood that datatables were not intended for the
web (less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
> The question comes to my mind, Why dont you simply use the ADO.NET
classes,
> or if you need more functionality, simply inherit them and add your

own > custom bits.
>
> Or have I missed something ?
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Chris" <ce****@bugmonitor.com> wrote in message
> news:B2*****************@bignews5.bellsouth.net...
> > Can someone tell me the OOP way to code classes for small tables of data?
> >
> > For example, i'm loading several tables that will be stored in the
> > current.cache of an asp.net app. One table is credit cards; another is
> > countries.
> >
> > Do i need two classes for each of these? A parent and a child

class > (similar
> > to tables and table in ado.net) or is there a better way to do it?
> >
> > See code below...
> >
> > Thanks,
> >
> > Chris
> > BugMonitor.com
> >
> > Public Class Category
> > Public Attrib1 As Integer
> > Public Attrib2 As String
> > End Class
> >
> > Public Class Categories
> > Public Shared Category As Category()
> > Public Shared Count As Int16
> >
> > Public Shared Function GetAll() As Categories
> > Dim bCategory As Category
> > While dr.Read
> > bCategory = New Category
> > With bCategory
> > .Attrib1 = val1
> > .Attrib2 = val2
> > End With
> > al.Add(bCategory)
> > Count += 1S
> > End While
> >
> > Dim bCategories As New Categories
> > bCategories.Category =

DirectCast(al.ToArray(GetType(Category)),
> > Category())
> >
> > Return bCategories
> > End Function
> >
> > End Class
> >
> >
>
>



Nov 20 '05 #6
Chris,
Curious, where did you get that idea?

I understand that datatables were explicitly designed for both the Web &
Windows!

Remember DataTables (only) support XML, which is a web friendly format!

Hope this helps
Jay

"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
If you're talking about using datatables, then that is the way i'm used to
doing it, but i understood that datatables were not intended for the web
(less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:Oi**************@tk2msftngp13.phx.gbl...
The question comes to my mind, Why dont you simply use the ADO.NET

classes,
or if you need more functionality, simply inherit them and add your own
custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class

(similar
to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)), Category())

Return bCategories
End Function

End Class



Nov 20 '05 #7
Chris,
As OHM suggested, the OOP way to code classes for small tables of data is
System.Data.DataTable, I would consider keeping both of your DataTables in a
System.Data.DataSet, specifically a Typed DataSet.

Martin Fowler's book "Patterns of Enterprise Application Architecture" from
Addison Wesley http://www.martinfowler.com/books.html#eaa explains when you
may want to use a traditional Domain Model & Data Mapper pattern:
http://www.martinfowler.com/eaaCatalog/domainModel.html
http://www.martinfowler.com/eaaCatalog/dataMapper.html

verses a Table Module & Data Gateway patterns:
http://www.martinfowler.com/eaaCatalog/tableModule.html
http://www.martinfowler.com/eaaCatal...taGateway.html

Martin also offers a couple of other useful patterns that can be used
instead of or in conjunction with the above patterns.

FWIW: The System.Data.DataTable is an implementation of a Record Set
pattern:
http://www.martinfowler.com/eaaCatalog/recordSet.html

Rockford Lhotka's book "Expert One-on-One Visual Basic .NET Business
Objects" from A! Press provides a pre-implemented variation of Fowler's
Domain Model & Data Mapper patterns.
http://www.lhotka.net/

Generally if there is no real logic behind my domain objects, I would use
the DataSet OOM coupled with a Table Module & Data Gateway patterns. As the
classes themselves are not really living up to their potential! :-) The
Table Module & Data Gateway patterns may be implemented in a single class or
two classes. Again I would consider using a Typed DataSet.

However if there is significant logic behind my domain objects, I would then
favor the Domain Model & Data Mapper patterns.

Depending on the needs of the project I would consider Fowler's other
patterns...

Hope this helps
Jay
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?

For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class (similar to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())

Return bCategories
End Function

End Class

Nov 20 '05 #8
Jay,

I heard the idea from a former extremelogic MCT. He seemed pretty emphatic
that datatables are overused on the web and that they were designed for
winform apps and are heavy for web apps.

Thanks,

Chris
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Chris,
Curious, where did you get that idea?

I understand that datatables were explicitly designed for both the Web &
Windows!

Remember DataTables (only) support XML, which is a web friendly format!

Hope this helps
Jay

"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
If you're talking about using datatables, then that is the way i'm used to
doing it, but i understood that datatables were not intended for the web
(less efficient), so i was trying to learn the OO way of doing it.

Thanks,

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:Oi**************@tk2msftngp13.phx.gbl...
The question comes to my mind, Why dont you simply use the ADO.NET

classes,
or if you need more functionality, simply inherit them and add your own custom bits.

Or have I missed something ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
> Can someone tell me the OOP way to code classes for small tables of

data?
>
> For example, i'm loading several tables that will be stored in the
> current.cache of an asp.net app. One table is credit cards; another is > countries.
>
> Do i need two classes for each of these? A parent and a child class
(similar
> to tables and table in ado.net) or is there a better way to do it?
>
> See code below...
>
> Thanks,
>
> Chris
> BugMonitor.com
>
> Public Class Category
> Public Attrib1 As Integer
> Public Attrib2 As String
> End Class
>
> Public Class Categories
> Public Shared Category As Category()
> Public Shared Count As Int16
>
> Public Shared Function GetAll() As Categories
> Dim bCategory As Category
> While dr.Read
> bCategory = New Category
> With bCategory
> .Attrib1 = val1
> .Attrib2 = val2
> End With
> al.Add(bCategory)
> Count += 1S
> End While
>
> Dim bCategories As New Categories
> bCategories.Category =

DirectCast(al.ToArray(GetType(Category)), > Category())
>
> Return bCategories
> End Function
>
> End Class
>
>



Nov 20 '05 #9
Thanks Jay. I'll take a look at these authors and their recommended
patterns.

Regards,

Chris
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Chris,
As OHM suggested, the OOP way to code classes for small tables of data is
System.Data.DataTable, I would consider keeping both of your DataTables in a System.Data.DataSet, specifically a Typed DataSet.

Martin Fowler's book "Patterns of Enterprise Application Architecture" from Addison Wesley http://www.martinfowler.com/books.html#eaa explains when you may want to use a traditional Domain Model & Data Mapper pattern:
http://www.martinfowler.com/eaaCatalog/domainModel.html
http://www.martinfowler.com/eaaCatalog/dataMapper.html

verses a Table Module & Data Gateway patterns:
http://www.martinfowler.com/eaaCatalog/tableModule.html
http://www.martinfowler.com/eaaCatal...taGateway.html

Martin also offers a couple of other useful patterns that can be used
instead of or in conjunction with the above patterns.

FWIW: The System.Data.DataTable is an implementation of a Record Set
pattern:
http://www.martinfowler.com/eaaCatalog/recordSet.html

Rockford Lhotka's book "Expert One-on-One Visual Basic .NET Business
Objects" from A! Press provides a pre-implemented variation of Fowler's
Domain Model & Data Mapper patterns.
http://www.lhotka.net/

Generally if there is no real logic behind my domain objects, I would use
the DataSet OOM coupled with a Table Module & Data Gateway patterns. As the classes themselves are not really living up to their potential! :-) The
Table Module & Data Gateway patterns may be implemented in a single class or two classes. Again I would consider using a Typed DataSet.

However if there is significant logic behind my domain objects, I would then favor the Domain Model & Data Mapper patterns.

Depending on the needs of the project I would consider Fowler's other
patterns...

Hope this helps
Jay
"Chris" <ce****@bugmonitor.com> wrote in message
news:B2*****************@bignews5.bellsouth.net...
Can someone tell me the OOP way to code classes for small tables of data?
For example, i'm loading several tables that will be stored in the
current.cache of an asp.net app. One table is credit cards; another is
countries.

Do i need two classes for each of these? A parent and a child class

(similar
to tables and table in ado.net) or is there a better way to do it?

See code below...

Thanks,

Chris
BugMonitor.com

Public Class Category
Public Attrib1 As Integer
Public Attrib2 As String
End Class

Public Class Categories
Public Shared Category As Category()
Public Shared Count As Int16

Public Shared Function GetAll() As Categories
Dim bCategory As Category
While dr.Read
bCategory = New Category
With bCategory
.Attrib1 = val1
.Attrib2 = val2
End With
al.Add(bCategory)
Count += 1S
End While

Dim bCategories As New Categories
bCategories.Category = DirectCast(al.ToArray(GetType(Category)),
Category())

Return bCategories
End Function

End Class


Nov 20 '05 #10
> Tables and Tables are closely related. It is natural to contain a Table in
Tables. As far as DataTables not being suitable for the web from an
efficiency point of view, do you have impirical evidence to support this.?

I personally 'have' used DataTables as the base for display, and of course
DataGrid's to display, I have not noticed any particular issues with speed.

No. As i said before, using datatables is what i'm used to doing. I heard
the idea from a former extremelogic MCT. He seemed pretty emphatic that
datatables are overused on the web and that they were designed for winform
apps and are heavy for web apps.

So i was trying to do it the OO way, but you guys are saying that my
original methods (datatables) are preferred over parent/child classes.

Thanks for your input!

Chris


"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u3**************@TK2MSFTNGP11.phx.gbl... OK, back to your original question
> > > For example, i'm loading several tables that will be stored in the > > > current.cache of an asp.net app. One table is credit cards; another
is
> > > countries.
> > >
> > > Do i need two classes for each of these? A parent and a child class > > (similar
> > > to tables and table in ado.net) or is there a better way to do it?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ap********************@speedfactory.net...
Hey Terry,

Thanks for the response.

I'm not concerned with presentation at this point. I'm focusing on the

data
and business layers. Some of these classes may not have a presentation
layer -- just used by other classes.

Thanks,

Chris
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:ec**************@TK2MSFTNGP11.phx.gbl...
You should consider a Custom Control, this way you can have full
control over the rendered output for it and include whatever data storage you

need
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ys********************@speedfactory.net...
> If you're talking about using datatables, then that is the way i'm used
to
> doing it, but i understood that datatables were not intended for the

web > (less efficient), so i was trying to learn the OO way of doing it.
>
> Thanks,
>
> Chris
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:Oi**************@tk2msftngp13.phx.gbl...
> > The question comes to my mind, Why dont you simply use the ADO.NET
> classes,
> > or if you need more functionality, simply inherit them and add your own
> > custom bits.
> >
> > Or have I missed something ?
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Chris" <ce****@bugmonitor.com> wrote in message
> > news:B2*****************@bignews5.bellsouth.net...
> > > Can someone tell me the OOP way to code classes for small tables of > data?
> > >
> > > For example, i'm loading several tables that will be stored in
the > > > current.cache of an asp.net app. One table is credit cards;

another
is
> > > countries.
> > >
> > > Do i need two classes for each of these? A parent and a child

class > > (similar
> > > to tables and table in ado.net) or is there a better way to do it? > > >
> > > See code below...
> > >
> > > Thanks,
> > >
> > > Chris
> > > BugMonitor.com
> > >
> > > Public Class Category
> > > Public Attrib1 As Integer
> > > Public Attrib2 As String
> > > End Class
> > >
> > > Public Class Categories
> > > Public Shared Category As Category()
> > > Public Shared Count As Int16
> > >
> > > Public Shared Function GetAll() As Categories
> > > Dim bCategory As Category
> > > While dr.Read
> > > bCategory = New Category
> > > With bCategory
> > > .Attrib1 = val1
> > > .Attrib2 = val2
> > > End With
> > > al.Add(bCategory)
> > > Count += 1S
> > > End While
> > >
> > > Dim bCategories As New Categories
> > > bCategories.Category =
DirectCast(al.ToArray(GetType(Category)),
> > > Category())
> > >
> > > Return bCategories
> > > End Function
> > >
> > > End Class
> > >
> > >
> >
> >
>
>



Nov 20 '05 #11
No worries, good luck with it, and please do come back and tell us how you
got on.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:nP********************@speedfactory.net...
Tables and Tables are closely related. It is natural to contain a Table in
Tables. As far as DataTables not being suitable for the web from an
efficiency point of view, do you have impirical evidence to support this.?
I personally 'have' used DataTables as the base for display, and of course DataGrid's to display, I have not noticed any particular issues with speed.

No. As i said before, using datatables is what i'm used to doing. I heard
the idea from a former extremelogic MCT. He seemed pretty emphatic that
datatables are overused on the web and that they were designed for winform
apps and are heavy for web apps.

So i was trying to do it the OO way, but you guys are saying that my
original methods (datatables) are preferred over parent/child classes.

Thanks for your input!

Chris


"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message news:u3**************@TK2MSFTNGP11.phx.gbl...
OK, back to your original question
> > > > For example, i'm loading several tables that will be stored in the > > > > current.cache of an asp.net app. One table is credit cards;

another
is
> > > > countries.
> > > >
> > > > Do i need two classes for each of these? A parent and a child

class
> > > (similar
> > > > to tables and table in ado.net) or is there a better way to do it?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ap********************@speedfactory.net...
Hey Terry,

Thanks for the response.

I'm not concerned with presentation at this point. I'm focusing on the

data
and business layers. Some of these classes may not have a presentation
layer -- just used by other classes.

Thanks,

Chris
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:ec**************@TK2MSFTNGP11.phx.gbl...
> You should consider a Custom Control, this way you can have full

control > over the rendered output for it and include whatever data storage you need
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Chris" <ce****@bugmonitor.com> wrote in message
> news:Ys********************@speedfactory.net...
> > If you're talking about using datatables, then that is the way i'm

used
to
> > doing it, but i understood that datatables were not intended for
the
web
> > (less efficient), so i was trying to learn the OO way of doing it.
> >
> > Thanks,
> >
> > Chris
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in > message
> > news:Oi**************@tk2msftngp13.phx.gbl...
> > > The question comes to my mind, Why dont you simply use the ADO.NET > > classes,
> > > or if you need more functionality, simply inherit them and add

your own
> > > custom bits.
> > >
> > > Or have I missed something ?
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > > "Chris" <ce****@bugmonitor.com> wrote in message
> > > news:B2*****************@bignews5.bellsouth.net...
> > > > Can someone tell me the OOP way to code classes for small
tables of
> > data?
> > > >
> > > > For example, i'm loading several tables that will be stored in

the > > > > current.cache of an asp.net app. One table is credit cards;

another
is
> > > > countries.
> > > >
> > > > Do i need two classes for each of these? A parent and a child

class
> > > (similar
> > > > to tables and table in ado.net) or is there a better way to do it? > > > >
> > > > See code below...
> > > >
> > > > Thanks,
> > > >
> > > > Chris
> > > > BugMonitor.com
> > > >
> > > > Public Class Category
> > > > Public Attrib1 As Integer
> > > > Public Attrib2 As String
> > > > End Class
> > > >
> > > > Public Class Categories
> > > > Public Shared Category As Category()
> > > > Public Shared Count As Int16
> > > >
> > > > Public Shared Function GetAll() As Categories
> > > > Dim bCategory As Category
> > > > While dr.Read
> > > > bCategory = New Category
> > > > With bCategory
> > > > .Attrib1 = val1
> > > > .Attrib2 = val2
> > > > End With
> > > > al.Add(bCategory)
> > > > Count += 1S
> > > > End While
> > > >
> > > > Dim bCategories As New Categories
> > > > bCategories.Category =
> DirectCast(al.ToArray(GetType(Category)),
> > > > Category())
> > > >
> > > > Return bCategories
> > > > End Function
> > > >
> > > > End Class
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 20 '05 #12
Thanks, I will.

Chris

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:ui****************@TK2MSFTNGP09.phx.gbl...
No worries, good luck with it, and please do come back and tell us how you
got on.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:nP********************@speedfactory.net...
Tables and Tables are closely related. It is natural to contain a Table
in
Tables. As far as DataTables not being suitable for the web from an
efficiency point of view, do you have impirical evidence to support this.?
I personally 'have' used DataTables as the base for display, and of course DataGrid's to display, I have not noticed any particular issues with speed.

No. As i said before, using datatables is what i'm used to doing. I heard
the idea from a former extremelogic MCT. He seemed pretty emphatic that
datatables are overused on the web and that they were designed for winform apps and are heavy for web apps.

So i was trying to do it the OO way, but you guys are saying that my
original methods (datatables) are preferred over parent/child classes.

Thanks for your input!

Chris


"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:u3**************@TK2MSFTNGP11.phx.gbl...
OK, back to your original question
> > > > > For example, i'm loading several tables that will be stored
in the
> > > > > current.cache of an asp.net app. One table is credit cards;
another
> is
> > > > > countries.
> > > > >
> > > > > Do i need two classes for each of these? A parent and a
child class
> > > > (similar
> > > > > to tables and table in ado.net) or is there a better way to do it?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Chris" <ce****@bugmonitor.com> wrote in message
news:Ap********************@speedfactory.net...
> Hey Terry,
>
> Thanks for the response.
>
> I'm not concerned with presentation at this point. I'm focusing on
the data
> and business layers. Some of these classes may not have a presentation > layer -- just used by other classes.
>
> Thanks,
>
> Chris
>
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:ec**************@TK2MSFTNGP11.phx.gbl...
> > You should consider a Custom Control, this way you can have full

control
> > over the rendered output for it and include whatever data storage

you need
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Chris" <ce****@bugmonitor.com> wrote in message
> > news:Ys********************@speedfactory.net...
> > > If you're talking about using datatables, then that is the way i'm used
> to
> > > doing it, but i understood that datatables were not intended for the web
> > > (less efficient), so i was trying to learn the OO way of doing it. > > >
> > > Thanks,
> > >
> > > Chris
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
> > message
> > > news:Oi**************@tk2msftngp13.phx.gbl...
> > > > The question comes to my mind, Why dont you simply use the ADO.NET > > > classes,
> > > > or if you need more functionality, simply inherit them and add

your
> own
> > > > custom bits.
> > > >
> > > > Or have I missed something ?
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > > "Chris" <ce****@bugmonitor.com> wrote in message
> > > > news:B2*****************@bignews5.bellsouth.net...
> > > > > Can someone tell me the OOP way to code classes for small tables of
> > > data?
> > > > >
> > > > > For example, i'm loading several tables that will be stored

in the
> > > > > current.cache of an asp.net app. One table is credit cards;
another
> is
> > > > > countries.
> > > > >
> > > > > Do i need two classes for each of these? A parent and a
child class
> > > > (similar
> > > > > to tables and table in ado.net) or is there a better way to

do it?
> > > > >
> > > > > See code below...
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Chris
> > > > > BugMonitor.com
> > > > >
> > > > > Public Class Category
> > > > > Public Attrib1 As Integer
> > > > > Public Attrib2 As String
> > > > > End Class
> > > > >
> > > > > Public Class Categories
> > > > > Public Shared Category As Category()
> > > > > Public Shared Count As Int16
> > > > >
> > > > > Public Shared Function GetAll() As Categories
> > > > > Dim bCategory As Category
> > > > > While dr.Read
> > > > > bCategory = New Category
> > > > > With bCategory
> > > > > .Attrib1 = val1
> > > > > .Attrib2 = val2
> > > > > End With
> > > > > al.Add(bCategory)
> > > > > Count += 1S
> > > > > End While
> > > > >
> > > > > Dim bCategories As New Categories
> > > > > bCategories.Category =
> > DirectCast(al.ToArray(GetType(Category)),
> > > > > Category())
> > > > >
> > > > > Return bCategories
> > > > > End Function
> > > > >
> > > > > End Class
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 20 '05 #13
Chris,
I normally write programs that are "correct" first, then optimize for
performance later. Only when a specific routine is proven to be a
performance problem via profiling tools.

As I indicated in my other post I would choose DataSet or Domain model based
on the needs of the Domain objects.

If DataSet was shown to be a performance problem based on profiling, I would
then review the specific cases where the performance is an issue and change
them...
Of course I try to be well read on OOP Patterns to help choose the "correct"
plan for the current solution...

Hope this helps
Jay

"Chris" <ce****@bugmonitor.com> wrote in message
news:1O********************@speedfactory.net...
Jay,

I heard the idea from a former extremelogic MCT. He seemed pretty emphatic
that datatables are overused on the web and that they were designed for
winform apps and are heavy for web apps.

Thanks,

Chris

<<snip>>
Nov 20 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
3
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.