WIBWO 8: OOP and TDD

December 16, 2019

OOP

I finally finished outlining the LinkedIn Course and the results are here on Github! There are a lot of good principles about OOP in general that can be learned from this course. If your company offers LinkedIn Learning and you are trying to improve your OOP skills, I recommend the course.

My senses for understanding how to use OOP are most definitely improving. It’s obvious at work where I’m seeing better ways to handle certain problems in my head. I’m constantly working the muscle when trying to think about how to solve problems using it instead of in a procedural way.

I’ve been seeing a lot of examples around me lately where diving right into writing the code has ended up with lackluster results. When thinking about how we want our object-oriented code to function it many times makes sense to begin with the end in mind, and write the code you want to use first, then build the code so that it works. Interestingly, this ties directly into the concept of TDD.

Using TDD to write better object-oriented code (and code in general)

With TDD, we write our tests first, thus forcing us to use the nonexistent code in a way that is most pleasant to us. This allows us to write much more nicely designed code first, which we can then build afterwards. There is actually a great example of this I found that offers a way to follow along through the thought process of TDD.

I believe the saying is “red, green, refactor”. In other words, write your test which will fail because the code isn’t there yet. Make the test pass. Then refactor your code to clean it up. Repeat this process forever and ever until your project is a beautiful work of art.

My Secret Project

My Secret Project™ is coming along just fine. I want to do it right and use TDD from the beginning, so I’ve been learning about that as I begin working on it. I spent a good amount of time utilizing what I learned in the LinkedIn course to design the project, and I’m feeling confident in beginning development. The goal is to do extensive documentation on the project as I build it, and share it here in the blog. Hopefully it doesn’t slow me down too much, but I want to share my learning experience with you so that we can learn together.

I will be expanding upon some of the ideas within this post in their own posts outside of the What I’ve Been Working On series, so keep your eye out for them!

See you next week!