Monday, 23 March 2015

Week # 10 and the strike continues

This week we learned about unitesting and assertions. Unitesting is really helpful because instead of writing your tests in the doc string and making extra lines you can just put all your tests in a separate file and test your program all at once. This saves so much space in your main program file and makes your program look much cleaner than having all testing in the doc sting. I am pretty sure I will use this concept in the near future to help me make sure my program runs correctly.

The second thing we learned in class in the past week was assertion statements. Assertion statements only stop your code while it is running and the assertion line gets something that is not expected. Like a False statement when it expects a True statement. Once it receives this unexpected bool it will stop the program and give an exception statement to tell you where it stopped. This concept is also very useful in programming because I used to do this exact same thing manually with printing statements. When using printing statements the output of the code becomes very messy and hard to deal with after everything is working good. Also after competing the code you have to make sure that all the print statements have been deleted otherwise the print statement will come up while a user is running the code. In the end assertion statements will save a lot of time and effort to make the code writing more efficient and productive.

Thanks for reading my blog.

1 comment:

  1. I have enjoyed reading your post. It was also interesting to see how your opinion and my opinion on the course materials were similar in some way.

    ReplyDelete