25 Haz

Murphy’s Laws About Programming

  1. If a program is useful, it will have to be changed.
  2. If a program is useless, it will have to be documented.
  3. The value of a program is inversely proportional to the weight of its output.
  4. Any given program will expand to fill all the available memory.
  5. Program complexity grows until it exceeds the capability of the programmer who must maintain it.
  6. Any given program, when running, is obsolete.
  7. Any given program costs more and takes longer each time it is run.
  8. murphys law about programming

  9. Every non- trivial program has at least one bug
    • Corollary 1 – A sufficient condition for program triviality is that it have no bugs.
    • Corollary 2 – At least one bug will be observed after the author leaves the organization.
  10. Bugs will appear in one part of a working program when another ‘unrelated’ part is modified.
  11. The subtlest bugs cause the greatest damage and problems.
    • Corollary – A subtle bug will modify storage thereby masquerading as some other problem.
  12. A ‘debugged’ program that crashes will wipe out source files on storage devices when there is the least available backup.
  13. A hardware failure will cause system software to crash, and the customer engineer will blame the programmer.
  14. A system software crash will cause hardware to act strangely and the programmers will blame the customer engineer.
  15. Undetectable errors are infinite in variety, in contrast to detectable errors, which by definition are limited.
  16. Adding manpower to a late software project makes it later.
  17. Make it possible for programmers to write programs in English, and you will find that programmers can not write in English.
13 Haz

C# Create A New Thread With/Without Parameter

This example shows how to create a new thread in .NET Framework.
First, create a new ThreadStart delegate.
The delegate points to a method that will be executed by the new thread.
Then, call Start method. If you want to pass a parameter to the thread,

Sample Code:


            //start without parameters
            Thread threadWithoutParameter = new Thread(new ThreadStart(delegate()
            {
                //do anything on background
            }));
            threadWithoutParameter.Start();

            //start with parameters
            Thread threadWithParameter = new Thread(new ParameterizedThreadStart(delegate(object obj)
            {
                //do anything on background
            }));
            object param = "Thread parameter";
            threadWithParameter.Start(param);