The Finale of CS448
Learning how to write tests for code has been what really made my education feel like it has come full circle. It has really provided a deeper understanding and a boost to my confidence while writing code. There has been countless times where during this course i would be kicking myself. Just wishing i had learned some things sooner, before all of the other big projects and homework assignments.
Every new computer science student comes in and starts cranking out code and programs. Over the years you are also introduced to a variety of things, one example that comes to mind is truth tables.
![](https://i0.wp.com/mikestg4.wordpress.com/wp-content/uploads/2024/05/screenshot-2024-05-30-at-01-22-55-truth-table-google-search.png?resize=617%2C426&ssl=1)
Before ever diving into the world of software testing, those tables, while logically making sense. Never really seemed to be fully applicable to what i was doing. For instance a program you are writing might have branches or loops with certain conditions, and you will notice the similarities regarding the true and false conditions and there outcomes.
However, this type of logic directly relates to being able to map out test cases. The following example is from a homework assignment that helps really illustrate the connection.
![](https://i0.wp.com/mikestg4.wordpress.com/wp-content/uploads/2024/05/screenshot_30-5-2024_13242_.jpeg?resize=625%2C227&ssl=1)
Once we began writing out our test cases in this fashion is where everything “clicked” in regards to past classes based on logic that i didn’t fully appreciate the value of.
With this connection also came the experiences regarding test driven development (see past blogs). While writing your first hello world program, it is quite obvious how simple it can be. It would be possible to expand upon to have testing make sense, but once someone has been exposed to creating multiple methods and classes. It is my belief that learning how to test them, even if it seems simple and silly, would go a long way.
Mocks and stubs could be slightly tricky for a new student of course, but learning how to just make a stub could go a long way.
Another portion i wish i had picked up sooner is called a define-use path. Being able to have a diagram directly depict the flow of a program can help so much while working through the thought process while developing and testing.
![](https://i0.wp.com/mikestg4.wordpress.com/wp-content/uploads/2024/05/screenshot-2024-05-30-at-01-51-28-copy-of-activity-8-path-testing.png?resize=625%2C201&ssl=1)
In conclusion learning and understanding how software testing works boosted my confidence in programming exponentially. Even while learning JavaScript on the fly having zero experience i found myself needing to use the same principals i had been taught through testing. In fact, i would jokingly argue, TDD felt backwards because we were taught how to program backwards! Or maybe that is the point?
From the blog Mikes CS Journey by Michael St. Germain and used with permission of the author. All other rights reserved by the author.