Need Object Model advise for Order Entry App 
Author Message
 Need Object Model advise for Order Entry App

I am having problems understanding how to apply OOP techniques to a sales
order object. In considering the following classes.

Public Class SalesOrder
End Class
Public Class SalesOrderHeader
End Class
Public Class SalesOrderHeaders
End Class
Public Class SalesOrderLineItem
Public PartNumber As String
End Class
Public Class SalesOrderLineItems
End Class

1) Should I subclass as follows or leave as above?:

Public Class SalesOrder
    Public Class SalesOrderHeader
    End Class
    Public Class SalesOrderHeaders
    End Class
    Public Class SalesOrderLineItems
        Public Class SalesOrderLineItem
            Public PartNumber As String
        End Class
    End Class
End Class

2) Is it proper to put methods following a data structure class?  ie

Public Class SalesOrderLineItem
    Public LineItemNumber As String
    Public PartNumber As String
    Public PartDescription As String
    Public OrderQuantity As Integer
    Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
        Dim SOL as SalesOrderLineItem = New SalesOrderLineItem()
        ...
        ...
        Return SOL
    End Function
End Class

or should I separate the Data from the Methods.  I have tried calling both
via a WebService and either method returns the proper xml.  What is the
preferred method?

Public Class SalesOrderLineItem
    Public Class SalesOrderLineItemData
        Public LineItemNumber As String
        Public PartNumber As String
        Public PartDescription As String
        Public OrderQuantity As Integer
    End Class
    Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
        Dim SOL as SalesOrderLineItemData = New SalesOrderLineItemData()
        ...
        ...
        Return SOL
    End Function
End Class

3) Are there any good VB.Net class examples illustrating such examples?

TIA,
Brian Sabolik



Sun, 27 Jun 2004 05:56:28 GMT  
 Need Object Model advise for Order Entry App
Depending on the rest of the architecture, any of these is proper.

If you are just interested in orders, the data class will work very well. I
would make these properties instead of variables, but I am sure that is what
you have in mind. I have known quite a few OO developers that worked with
the data class paradigm.

I personally like objects that have a real world representation, which means
many of these properties would have the data type of the object they
represent. I am not as fond of subclassing inside a class, unless there is a
very good reason. I have not thought through your example, so I will not
offer too much on that.

If you have tried both, the questions are:

1. Which will be easier for your team to maintain if you were hit by a bus?
2. Which performs better?

In general, I would err towards number 1, although there are apps that need
such a high level of scalability that maintainability must take a back seat.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

*************************************************
Think Outside the Box!
*************************************************

Quote:
> I am having problems understanding how to apply OOP techniques to a sales
> order object. In considering the following classes.

> Public Class SalesOrder
> End Class
> Public Class SalesOrderHeader
> End Class
> Public Class SalesOrderHeaders
> End Class
> Public Class SalesOrderLineItem
> Public PartNumber As String
> End Class
> Public Class SalesOrderLineItems
> End Class

> 1) Should I subclass as follows or leave as above?:

> Public Class SalesOrder
>     Public Class SalesOrderHeader
>     End Class
>     Public Class SalesOrderHeaders
>     End Class
>     Public Class SalesOrderLineItems
>         Public Class SalesOrderLineItem
>             Public PartNumber As String
>         End Class
>     End Class
> End Class

> 2) Is it proper to put methods following a data structure class?  ie

> Public Class SalesOrderLineItem
>     Public LineItemNumber As String
>     Public PartNumber As String
>     Public PartDescription As String
>     Public OrderQuantity As Integer
>     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
>         Dim SOL as SalesOrderLineItem = New SalesOrderLineItem()
>         ...
>         ...
>         Return SOL
>     End Function
> End Class

> or should I separate the Data from the Methods.  I have tried calling both
> via a WebService and either method returns the proper xml.  What is the
> preferred method?

> Public Class SalesOrderLineItem
>     Public Class SalesOrderLineItemData
>         Public LineItemNumber As String
>         Public PartNumber As String
>         Public PartDescription As String
>         Public OrderQuantity As Integer
>     End Class
>     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
>         Dim SOL as SalesOrderLineItemData = New SalesOrderLineItemData()
>         ...
>         ...
>         Return SOL
>     End Function
> End Class

> 3) Are there any good VB.Net class examples illustrating such examples?

> TIA,
> Brian Sabolik



Sun, 27 Jun 2004 07:02:56 GMT  
 Need Object Model advise for Order Entry App
hi brian

greg's advice is right on the money... you'll find that there are always
many ways to get an object structure up and running, so you'll always be
evaluating based on your situation.

my preference is to think in terms of a developer who is getting your
structure to build a ui... make it simple and intuitive, mimicking real
world structures.

btw... i'd not create a separate lineitemdata class... the line item object
IS the line item, so it should be aware of line item data, how to manipulate
it and present it.

dushan bilbija


Quote:
> I am having problems understanding how to apply OOP techniques to a sales
> order object. In considering the following classes.

> Public Class SalesOrder
> End Class
> Public Class SalesOrderHeader
> End Class
> Public Class SalesOrderHeaders
> End Class
> Public Class SalesOrderLineItem
> Public PartNumber As String
> End Class
> Public Class SalesOrderLineItems
> End Class

> 1) Should I subclass as follows or leave as above?:

> Public Class SalesOrder
>     Public Class SalesOrderHeader
>     End Class
>     Public Class SalesOrderHeaders
>     End Class
>     Public Class SalesOrderLineItems
>         Public Class SalesOrderLineItem
>             Public PartNumber As String
>         End Class
>     End Class
> End Class

> 2) Is it proper to put methods following a data structure class?  ie

> Public Class SalesOrderLineItem
>     Public LineItemNumber As String
>     Public PartNumber As String
>     Public PartDescription As String
>     Public OrderQuantity As Integer
>     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
>         Dim SOL as SalesOrderLineItem = New SalesOrderLineItem()
>         ...
>         ...
>         Return SOL
>     End Function
> End Class

> or should I separate the Data from the Methods.  I have tried calling both
> via a WebService and either method returns the proper xml.  What is the
> preferred method?

> Public Class SalesOrderLineItem
>     Public Class SalesOrderLineItemData
>         Public LineItemNumber As String
>         Public PartNumber As String
>         Public PartDescription As String
>         Public OrderQuantity As Integer
>     End Class
>     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
>         Dim SOL as SalesOrderLineItemData = New SalesOrderLineItemData()
>         ...
>         ...
>         Return SOL
>     End Function
> End Class

> 3) Are there any good VB.Net class examples illustrating such examples?

> TIA,
> Brian Sabolik



Sun, 27 Jun 2004 09:56:42 GMT  
 Need Object Model advise for Order Entry App
Brian,

I agree with Greg, too. You should choose a model based on your particular
situation.

Thanks,

Peter Wu
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.



Sun, 27 Jun 2004 10:14:35 GMT  
 Need Object Model advise for Order Entry App
Thanks Dushan but regarding your statement..." i'd not create a separate
lineitemdata class"... and I agree but...
Since I am going to call these classes from DHTML thru a WebService, will
the WebService return the entire object(including methods) to my web client?
(rslt.raw.xml - using the Webservice.htc behavior) or does the WebService
prume off the methods before the serialization to xml and then send only the
data to the client?  I noticed the IBuySpy sample site was doing it this
way(data encapsulated in a class by itself).
http://www.ibuyspy.com/storevb/docs/docs.htm

My main goal here is to return the following xml as automatically as
possible.
<SalesOrder>
    <SalesOrderHeader>
    </SalesOrderHeader>
    <SalesOrderLineItems>
        <SalesOrderLineItem>
        </SalesOrderLineItem>
        <SalesOrderLineItem>
        </SalesOrderLineItem>
           ...
    </SalesOrderLineItems>
</SalesOrder>
My web page calls the webservice via the webservice.htc which in turn calls
the class' method and returns only the data object which the webservice then
returns to the result object of the webservice.htc.  I then load the
result.raw.xml into the MS XML parser.

Just trying to consider performance!
Brian


Quote:
> hi brian

> greg's advice is right on the money... you'll find that there are always
> many ways to get an object structure up and running, so you'll always be
> evaluating based on your situation.

> my preference is to think in terms of a developer who is getting your
> structure to build a ui... make it simple and intuitive, mimicking real
> world structures.

> btw... i'd not create a separate lineitemdata class... the line item
object
> IS the line item, so it should be aware of line item data, how to
manipulate
> it and present it.

> dushan bilbija



> > I am having problems understanding how to apply OOP techniques to a
sales
> > order object. In considering the following classes.

> > Public Class SalesOrder
> > End Class
> > Public Class SalesOrderHeader
> > End Class
> > Public Class SalesOrderHeaders
> > End Class
> > Public Class SalesOrderLineItem
> > Public PartNumber As String
> > End Class
> > Public Class SalesOrderLineItems
> > End Class

> > 1) Should I subclass as follows or leave as above?:

> > Public Class SalesOrder
> >     Public Class SalesOrderHeader
> >     End Class
> >     Public Class SalesOrderHeaders
> >     End Class
> >     Public Class SalesOrderLineItems
> >         Public Class SalesOrderLineItem
> >             Public PartNumber As String
> >         End Class
> >     End Class
> > End Class

> > 2) Is it proper to put methods following a data structure class?  ie

> > Public Class SalesOrderLineItem
> >     Public LineItemNumber As String
> >     Public PartNumber As String
> >     Public PartDescription As String
> >     Public OrderQuantity As Integer
> >     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
> >         Dim SOL as SalesOrderLineItem = New SalesOrderLineItem()
> >         ...
> >         ...
> >         Return SOL
> >     End Function
> > End Class

> > or should I separate the Data from the Methods.  I have tried calling
both
> > via a WebService and either method returns the proper xml.  What is the
> > preferred method?

> > Public Class SalesOrderLineItem
> >     Public Class SalesOrderLineItemData
> >         Public LineItemNumber As String
> >         Public PartNumber As String
> >         Public PartDescription As String
> >         Public OrderQuantity As Integer
> >     End Class
> >     Public Function GetSalesOrderLineItem(params) as SalesOrderLineItem
> >         Dim SOL as SalesOrderLineItemData = New SalesOrderLineItemData()
> >         ...
> >         ...
> >         Return SOL
> >     End Function
> > End Class

> > 3) Are there any good VB.Net class examples illustrating such examples?

> > TIA,
> > Brian Sabolik



Mon, 28 Jun 2004 01:02:36 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Report Object Model/Viewer Object Model

2. Collection Object that maintains order of entry?

3. Order Entry -VB4 & Access code needed

4. Order Entry System Needed

5. Order Entry System Needed

6. Advise Needed: Multi-Threaded App

7. Need advise on ADO and Connection object.

8. Need a Pro in Database Modeling (Geographical boundaries Modeling)

9. Needing some help slugging thru Outlook object model

10. Need help with Outlook Object Model

11. Outlook Object Model... Need Version of Outlook

12. object model - need help referencing specific cells

 

 
Powered by phpBB® Forum Software