shiv chawla
shiv chawla

Reputation: 608

Debugging large programs in C#

I have a big program written in C# which takes ~20 minutes to complete. The program is divided into multiple stages and flow of information is sequential. If my program fails after say step 2, I have to re-run it from the beginning. Is there any smarter way of saving information after each step in some in-memory object/service etc, which can be directly used to run the 3rd step. This is not a very good description but I need to debug the program at the end but for it I have to rerun it from the start every time. Is there any industrial practice for such cases?

Thanks Shiv

Upvotes: 1

Views: 245

Answers (4)

idanzalz
idanzalz

Reputation: 1760

How is data flowing between steps? If the flow of data is well defined (preferably one channel). you can implement a "record" and "play" module. This will know to receive to record to file (by serializing) the data it gets on one end and play it on the other. If it is not connected from the input, it will play the file or something like that. Then you connect the player to the output of stage 2 one time. and when debugging play it directly to the 3rd step

Upvotes: 6

TomTom
TomTom

Reputation: 62127

Learn modern programming practices. Especially:

  • Automated testing
  • Unit testing.

The later allows you to test the individual parts and should be done in concert with something called "continuous integration". The first allows you to have those tests run automatically.

Upvotes: 2

CSharpened
CSharpened

Reputation: 12574

http://en.wikipedia.org/wiki/Unit_testing would be my approach to a large debugging situation. Write down a number of test cases and values etc and off you go. Would take a while but would prevent running through over and over again.

Upvotes: 0

Victor Parmar
Victor Parmar

Reputation: 5789

  1. Unit testing
  2. Mock Objects
  3. In-memory db

Upvotes: 2

Related Questions