Thread: Looking for C# best practices/coding guidelines

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by nvoigt View Post
    As a note for Sleep: Don't. Simple as that. Don't. All threading features in C# have a way to call you back when they are finished. Sleeping is an error, plain and simple. Even sleeping in a loop waiting for a condition is bad programming.

    You might want to look into static code analasys in Visual Studio (former FxCop) and the StyleCop Plugin for R#.
    Can you explain why something like this is bad?

    Code:
    // psudo-code
    proc = Process( "some_test.exe" );
    
    while ( proc.IsRunning() )
    {
        Sleep( 100 );
    }
    
    // Collect test result...
    Oh, and maybe I should clarify what kind of code my team writes. We do QA Automation, so we write automated tests for production software. Maybe that would have an effect on some of the coding guidelines I should be recommending?
    Last edited by cpjust; 03-24-2013 at 01:06 PM.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best practices when coding
    By c_weed in forum Tech Board
    Replies: 8
    Last Post: 04-23-2012, 10:06 PM
  2. Replies: 18
    Last Post: 05-06-2011, 07:22 PM
  3. coding practices
    By pobri19 in forum C++ Programming
    Replies: 2
    Last Post: 07-17-2008, 04:56 PM
  4. Trying to get some guidelines
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-30-2007, 11:15 AM