Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-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
 
Old March 8th, 2007, 12:51 PM
Authorized User
 
Join Date: Mar 2007
Posts: 39
Thanks: 0
Thanked 1 Time in 1 Post
Default Why is Cache Property used in BizObject ?

What is the purpose of the Cache property in the BizObject? Why not just reference the 'Cache' object directly in the BLL modules? I assume this is just another design consideration that provides a single point to alter/enhance the caching scheme if desired, but I'm not sure...

Also, why couldn't a simple variable declaration be used instead of a property? The following variable declaration seems more concise than the property declaration used in the code.
Code:
Protected Shared ReadOnly Cache As Cache = HttpContext.Current.Cache
Property declaration used in BizObject.vb code:
Code:
Protected Shared ReadOnly Property Cache() As Cache
   Get
      Return HttpContext.Current.Cache
   End Get
End Property
Is this a semantical preference or is there a difference in functionality I'm missing?


 
Old March 8th, 2007, 10:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Properties are used to allow hiding the implementation. This lets us change the getter later without breaking any of the other code.

In this particular case, you have to weigh the odds that you might want to replace the cache in the future. I probably wouldn't have wrapped this particular item, but I'm not sure if Marco had other ideas on what he might want to do with it.

Eric

 
Old March 8th, 2007, 10:47 PM
Authorized User
 
Join Date: Mar 2007
Posts: 39
Thanks: 0
Thanked 1 Time in 1 Post
Default

That's what I thought but just wanted confirmation.

Your support throughout the forum is excellent!

Thanks Eric!






Similar Threads
Thread Thread Starter Forum Replies Last Post
can't set CommandText property if cache has >1 rpt ashortxl Excel VBA 10 May 16th, 2014 10:53 AM
BizObject class - Intellisense? ViagraFalls BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 September 19th, 2007 02:24 PM
Thoughts on BizObject hpox BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 June 9th, 2007 07:47 AM
Can you give me an example of BizObject content ? dwfresh BOOK: ASP.NET Website Programming Problem-Design-Solution 0 December 19th, 2003 04:10 AM
Purpose of BizObject in Core? SBurton BOOK: ASP.NET Website Programming Problem-Design-Solution 1 August 6th, 2003 07:36 PM





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