CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Most Costly Method [C#]

    Consider the following:

    Code:
    public class SomeClass()
    {
       protected virtual void SpecialWorkerMethod()
       {
           throw new Exception("Derived Class must Implement this Method");
       }
    }
    Can you see why the above just cause a client of mine SIGIFICANT money?

    hint: The direct cause is directly related to C#, but the ROOT cause can happen in any language.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Most Costly Method [C#]

    I'm guessing that this issue didn't show up until run time.

    Restructuring the code using interfaces (and maybe constraints) probably would have allowed catching the problem during compile time.

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Most Costly Method [C#]

    Quote Originally Posted by Arjay
    I'm guessing that this issue didn't show up until run time.

    Restructuring the code using interfaces (and maybe constraints) probably would have allowed catching the problem during compile time.
    1) Yup, right hile rinning for the client.

    2) in C# abstract ould have been appropriate. In C++ making the method "pure" would have solved the problem at BUILD time.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4

    Re: Most Costly Method [C#]

    Quote Originally Posted by TheCPUWizard
    1) Yup, right hile rinning for the client.

    2) in C# abstract ould have been appropriate. In C++ making the method "pure" would have solved the problem at BUILD time.
    I'm afraid I don't know, but I'd like to find out. What was the problem?

  5. #5
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Most Costly Method [C#]

    Quote Originally Posted by goatslayer
    I'm afraid I don't know, but I'd like to find out. What was the problem?
    Simple. Somebody (no longer employeed by the client company because he also wrote the faulty base class) forgot to override a method in a derived class, that the base class was not setup to catch this at compile time.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  6. #6
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Most Costly Method [C#]

    It seems a bit rough to sack someone over this : after all testing should have shown this up.

    We all make mistakes occasionally... don't we ?

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  7. #7
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Most Costly Method [C#]

    Quote Originally Posted by darwen
    It seems a bit rough to sack someone over this : after all testing should have shown this up.

    We all make mistakes occasionally... don't we ?

    Darwen.
    If a mistake costs $3 million dollars (yes, actual amount), then SOMEONE is going to lose their job.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Most Costly Method [C#]

    Well, it was probably justified, but with some 'background' which would qualify it. I'm glad it wasn't me... Isn't there still death for 'treason' for gov't workers?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Most Costly Method [C#]

    Quote Originally Posted by TheCPUWizard
    If a mistake costs $3 million dollars (yes, actual amount), then SOMEONE is going to lose their job.
    No kidding ? How did it sum up to $3 million ?? I mean did they loose future sale or they lost agreement or something ?
    Regards,
    Ramkrishna Pawar

  10. #10
    Join Date
    May 2002
    Posts
    10,943

    Re: Most Costly Method [C#]

    Quote Originally Posted by TheCPUWizard
    If a mistake costs $3 million dollars...
    A wise business man once took on a trainee that blew a huge deal costing $11M. The young many went to turn in his resignation and the older business man said, "Boy, I just spent $11M training you. I don't want you to go."
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  11. #11
    Join Date
    Dec 2006
    Posts
    86

    Re: Most Costly Method [C#]

    That's one mistake they'll NEVER make again!

  12. #12
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Most Costly Method [C#]

    Quote Originally Posted by Krishnaa
    No kidding ? How did it sum up to $3 million ?? I mean did they loose future sale or they lost agreement or something ?
    My client had a delivery commitment. A missed milestone invoked a thirty day penality (they met with their client one per month). When the program was being demonstrated, and blew up, it was deemed "not ready for user acceptance", and the commitment was declared "not met".
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  13. #13
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Most Costly Method [C#]

    What process changes do you plan to make to prevent this sort of thing from happening in the future?

  14. #14
    Join Date
    Jul 2007
    Location
    Illinois
    Posts
    517

    Re: Most Costly Method [C#]

    Yikes, I wouldn't wanna have had that guys job... I use C# all the time and I thought it was a hefty method simply because of the exception being thrown and bubbling up the call stack. Also, if it had to be implemented, why didn't he use an interface?

    I work for a small company doing all their software, I love my job, but when software development starts to become like boot camp thats when I pack my bags, lol.
    R.I.P. 3.5" Floppy Drives
    "I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein

  15. #15
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Most Costly Method [C#]

    I work for a small company doing all their software, I love my job, but when software development starts to become like boot camp thats when I pack my bags, lol.
    You'll never earn very much then... the toughest jobs I've had have also the highest paid.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured