PC Review


Reply
Thread Tools Rate Thread

And the moral of the story is....

 
 
Steve Walker
Guest
Posts: n/a
 
      16th May 2005

.... Read the documentation!

I've just very nearly shot myself in the foot with a
ConfigurationSectionHandler. I've got a DHTML menu which I generate
based on information in the web config file and some contextual
information. So, don't show a link to the current page, don't show a
link to anything the user hasn't rights to see, show some links only
when logged in, show some links only when not logged in. Fair enough.

I've just been writing another menu to use the same data, and decided to
factor out the logic to determine which links to show. The
ConfigurationSectionHandler constructs a tree(like) structure which the
menu classes navigate recursively using foreach. I'll just set some
instance variables to hold the contextual information and write an
enumerator which uses that to....

Sudden realisation that a breakpoint in the creation code wasn't being
hit. Suspicion that this structure was being created once at startup.
Checked the documentation. Stateless, thread safe and immutable. Ouch.

Easily fixed with the memento pattern, and actually much cleaner code
than the smart enumerator would have been, but still, very close to
introducing a horrendous bug. Easily done, isn't it?

--
Steve Walker
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moral Dilemma Rachelbaby General Discussion 12 3rd Jan 2009 06:12 PM
is using 'black pr' to moderate forums moral? dbahooker@hotmail.com Microsoft Excel Discussion 46 27th Aug 2006 05:39 PM
is using 'black pr' to moderate forums moral? dbahooker@hotmail.com Microsoft Access 45 27th Aug 2006 05:39 PM
Moral development question issue... VMI Microsoft C# .NET 2 22nd Mar 2006 12:52 AM
And the Moral of the story is … muckshifter Audio / Video / Home Theatre 4 11th Apr 2005 03:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:35 AM.