Re: Bussines objects

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Joanna Carter \(TeamB\) (joannac_at_nospamforme.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 10:03:47 -0000


"Patrick B" <newsgroup@devzoo.com> a écrit dans le message de news:
#RYsCttGFHA.3156@TK2MSFTNGP10.phx.gbl...

> A "business object" is just a class that represents a real entity with
> which you work. For example, if you work with customers and orders, then
> you might have a Customer class and an Order class.
>
> Check out the following link:
>
> http://www.mygenerationsoftware.com/dOOdads/dOOdads.aspx
>
> The tool from MyGeneration can create C# code for business objects
> automatically from tables in a database. Then you can bind controls in
> your gui to that.

As useful as you might think such a tool is, I would seriously advise
against using database design as the foundation for class design. There are
several patterns, like foreign keys, that are not necessarily correct in OO
world.

e.g.

Database
========
SalesOrder
  ID
  Date
  CustomerID (FK)
  Tax
  Total

OrderLine
  ID
  OrderID (FK)
  Quantity
  ProductID (FK)
  LineValue

Classes
=======
SalesOrder
  ID (unique ID held internally, not used in client code, just by storage)
  Date
  Customer (object not ID)
  Lines (composite list only accessed through AddItem method on this class)
  Tax
  Total

OrderLine
  ID (unique ID held internally, not used in client code, just by storage)
  Quantity
  Product (object not ID)
  LineValue

It is usually the job of a mapping layer to maintain the solution to this
apparent mismatch between the Object Layer and the Database.

Joanna

--
Joanna Carter
Consultant Software Engineer


Relevant Pages

  • Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... > UDQ Services has years of experience with MS Excel and VBA (Visual Basic ... > templates, spreadsheet applications, and database applications. ... > P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.worksheet.functions)
  • Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.programming)
  • Spreadsheet/VBA Consulting - 50% Off or Even Free
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.misc)
  • Spreadsheet/VBA Consulting - 50% Off or Even Free
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.newusers)