[Design] Class or DataTable

Results 1 to 2 of 2

Thread: [Design] Class or DataTable

  1. #1
    Join Date
    Dec 1969

    Default [Design] Class or DataTable

    This posting is about design issues.<BR><BR>I am a VB6 developer and i am new to .net. I wanted to ask something about design issues when we develop software under .net platform.<BR><BR>1)<BR>Let say, i have this scenario, i am creating an application for a bookstore.<BR><BR>So, i will have "Publications" collection, which contains "Publication" objects. For each "Publication" object, it will have a property returning "Books" collection (and some other publication propertise), which contains "Book" objects. So the model will be something like this:<BR><BR>+BookStore<BR>+--Publications (collection)<BR>+----Publication (object)<BR>+------Books (collection)<BR>+--------Book (object)<BR><BR>Is this the way we should design our application? Is this what we call OOP?<BR><BR>Because in our mind, we will probably come out with the following design (with VB6 component in our mind):<BR><BR>2)<BR>We have a "BookStore" component, which have a function call "Publications". This function will return us a datatable (or recordset) will all the publications and it related fields. And we will have another function, call "Books" that take a parameter for the publication id, and it will return us<BR>a datatable (or recordset) with all the books and related fields.<BR><BR>- Which is the proper way of designing the application? I know that the design issues is very subjective, and to learn that we can refer to tones of books. But what i hope to know is that, usually and practically, which is the proper way of doing this, as we know, sometime what we read from a book might not be practical.<BR><BR>- Let say, whether we should create the "Publication" (as well as the "Book") as a class with all the publication propertise (like PublicationNameProperty, PublicationCountryProperty...), or we just create a function to retrun a datatable with all the columns for related details (like PublicationNameColumn, PublicationCountryColumn...)?<BR><BR>- I guess if we return a datatable from a function, it will required some overhead to generate the datatable. But i am not sure whether that is the case?<BR><BR>- If we return a datatable from a function, we will be able to bind it to a data control directly (eg. DataGrid, DataList). But can we like bind a "Publications" collection to the data control directly? or we have to loop through each "Publication" object in the collection to add the object property one by one?<BR><BR>We can to this:<BR>MyDataGrid.DataSource = objBookStore.Publications();<BR>(Let say, objBookStore.Publications() will return a datatable)<BR><BR>But can we do this?<BR>MyDataGrid.DataSource = objBookStore.Publications;<BR>(Let say, Publications is a property (collection). It has Publication objects (objBookStore.Publications[0] is the first Publication object in the collection, and so on...))<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: [Design] Class or DataTable

    I&#039;m hopeless at design and architecture so I won&#039;t insult you by offering an opinion other than to say, have a dig around in hte MSDN Architecture center... that&#039;s where I go when I&#039;m feeling "high-brow" ;-)<BR><BR> http://msdn.microsoft.com/architecture/

Posting Permissions

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