Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
| Search | Today's Posts | Mark Forums Read
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 6th, 2009, 10:00 AM
Registered User
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about Class Design

I am working on a class library, a sort of framework I guess, and am looking for some advice. Right now I am working with just my objects that represent database tables. Every single object in my class library has a series of fields that are part of each database table (ID, Created Date, etc) so, for this, I have created a base class that all of my objects inherit from similar to:

   public abstract class BaseObject
      public int ID {get; set;}
      public DateTime CreatedDate {get; set;}
This isn't a problem. The question that I have is related to interfaces and, i suppose a "best practice". Initially I was just going to add all of the other members for my object directly into the class, however, I toyed around with the thought of using an interface for the implementation of the members to tie everything together. Furthermore I am putting the CRUD methods directly on the object and was thinking about putting these inside of the interface as well but I am torn since a method defined in an interface can not be implemented as static in the inheriting class.

I suppose it is a matter of opinion whether one prefers to do:

  FooClass f = new FooClass();

   FooClass f = FooClass.LoadById(1);
Does anyone have any thoughts on this? Thanks
  #2 (permalink)  
Old January 22nd, 2009, 11:22 AM
Registered User
Join Date: Aug 2007
Location: , , India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

A nice article by Imar about passing Business Entities across layers in N-Tier architecture. He has also briefly touched upon the choice of smart or dumb classes while designing Business Entities.

Hope this helps.


Similar Threads
Thread Thread Starter Forum Replies Last Post
class design jay.net General .NET 3 April 13th, 2007 07:59 AM
C# Class Design Handbook dchernin All Other Wrox Books 9 December 20th, 2004 09:02 AM
design question androoo Classic ASP Databases 1 November 13th, 2004 09:41 AM
Design decision on class library projects? tkubaska BOOK: ASP.NET Website Programming Problem-Design-Solution 2 May 19th, 2004 11:43 AM
Class Design Info... kaizer BOOK: Beginning Java 2 1 December 27th, 2003 06:49 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.