Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Someone is sure that availability check is performed no matter what

Someone is sure that availability check is performed no matter what

Scheduled Pinned Locked Moved The Weird and The Wonderful
questionlearning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krumia
    wrote on last edited by
    #1

    Of course, variables changed, methods renamed, and parameters omitted to protect the (not so) innocent.

    // some code here

    if (condition_a)
    {
    if (condition_b)
    {
    // do something here
    if (AlertBox("Something wrong here. You wanna continue?"))
    {
    CheckAvailability();
    }
    }
    else if (condition_c)
    {
    // do something else here
    if (AlertBox("Some other thing wrong here. You wanna continue?"))
    {
    CheckAvailability();
    }
    }
    else
    {
    CheckAvailability();
    }

    CheckAvailability();
    

    }
    else
    {
    CheckAvailability();
    }

    // more code here

    K B L 3 Replies Last reply
    0
    • K krumia

      Of course, variables changed, methods renamed, and parameters omitted to protect the (not so) innocent.

      // some code here

      if (condition_a)
      {
      if (condition_b)
      {
      // do something here
      if (AlertBox("Something wrong here. You wanna continue?"))
      {
      CheckAvailability();
      }
      }
      else if (condition_c)
      {
      // do something else here
      if (AlertBox("Some other thing wrong here. You wanna continue?"))
      {
      CheckAvailability();
      }
      }
      else
      {
      CheckAvailability();
      }

      CheckAvailability();
      

      }
      else
      {
      CheckAvailability();
      }

      // more code here

      K Offline
      K Offline
      Kevin Drzycimski
      wrote on last edited by
      #2

      i like the path in which the availability gets checked twice

      1 Reply Last reply
      0
      • K krumia

        Of course, variables changed, methods renamed, and parameters omitted to protect the (not so) innocent.

        // some code here

        if (condition_a)
        {
        if (condition_b)
        {
        // do something here
        if (AlertBox("Something wrong here. You wanna continue?"))
        {
        CheckAvailability();
        }
        }
        else if (condition_c)
        {
        // do something else here
        if (AlertBox("Some other thing wrong here. You wanna continue?"))
        {
        CheckAvailability();
        }
        }
        else
        {
        CheckAvailability();
        }

        CheckAvailability();
        

        }
        else
        {
        CheckAvailability();
        }

        // more code here

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        Looks like CheckAvailabilty() is void, and has to throw an Exception in case of non-availability. Consequently, that call has to be wrapped:

        try
        {
        CheckAvailability();
        }
        catch(Exception ex)
        {
        if (AlertBox("Some other thing wrong here. You wanna continue?"))
        {
        CheckAvailability();
        }
        }

        You are right, that guy does not know how to do things correctly!

        1 Reply Last reply
        0
        • K krumia

          Of course, variables changed, methods renamed, and parameters omitted to protect the (not so) innocent.

          // some code here

          if (condition_a)
          {
          if (condition_b)
          {
          // do something here
          if (AlertBox("Something wrong here. You wanna continue?"))
          {
          CheckAvailability();
          }
          }
          else if (condition_c)
          {
          // do something else here
          if (AlertBox("Some other thing wrong here. You wanna continue?"))
          {
          CheckAvailability();
          }
          }
          else
          {
          CheckAvailability();
          }

          CheckAvailability();
          

          }
          else
          {
          CheckAvailability();
          }

          // more code here

          L Offline
          L Offline
          Lee Venkatsamy
          wrote on last edited by
          #4

          That just makes me angry.. :mad:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups