- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I don't see anything wrong with this. Generic event handlers such as this aren't specific, hence it being generic.
Admin
It's not really generic though. It's just specific in its case statements. So instead of abstracting your functionality, you've supressed it a level and missed it together. So if you want to try and find the functionality of "event a" you have to remember there's no function "EventAOnFire" there's a "EverythingIsFired" and it's in there somewhere. This buys you nothing (unless headaches and confusion are something you want). Of course that's just my opinion.
Admin
missed=mixed
Admin
Reminds me of the service method of a good old Java servlet (or ASP page for that matter) -
Admin
This great sample of coding wisdom also showcases another gem: the use of the Saving Disk Space pattern. Observe how the author masterfully named the method "Srch..", no "Search..". The immense savings of disk space and final size of the executable more than make up for any potential inconvenience this could possibly bring to someone else reading the code.
Admin
I HadThisPattern once. Instead of having lots of small batch files to do different unrelated tasks, I would stick them all as sections in one large file which had at its heading a checked “goto %1”. I also used a 4DOS feature to map all unknown commands to this all-in-one batch.
Seriously, of course it is a maintenance nightmare, and I got rid of it once I moved to a better file system.
Admin
Given the title, I thought I'd see code litered with
throw new Party("ErrorMessage");
Admin
That "Saving Disk Space pattern" is hilarious. Thank Ilya, I'll have to remember that one.
Admin
One event handler to run them all, and in the darkness bind them.
Admin
When I was in college, that's how I saw everybody do it, and it's how they kept on catching exceptions even after being pointed out how and why it was wrong.
Some people never learn.
Admin
First, I'm a C# coder, but there is one "usefull" fearure in VB.NET (caugh) that's not in C#, and that's exception filters. So, this is a workaround in C#.