My journey with Connect Four Terminal Game

My latest project was Connect Four Terminal Game. You can check it here if you want. This project had to improve my TDD (test -oriented development) skills because I had to write tests for each step.
This was a Looog project and I will tell you why in this article.
TDD lessons before the project
Before I was thrown into Connect Four, I had to do a few lessons and exercise about TDD.
These lessons were actually quite interesting. They explained:
One thing I really love is that the Odin project does not force us to use TDD, but instead only teaches how it works, so we can decide whether we want to use it.
TDD’s principles, Odin project was quite clear for me because the project explained them very clearly, and I was actually eager to try it.
But behind my mind, I was a little worried that he could extend the time spent for each project… And I wasn’t exactly wrong.
Starting the project (and why did it feel hard at first)
So I finished all the necessary lessons and started to work on Connect Four.
At this stage in the Ruby course, it was not difficult to apply the game itself.
The problem was:
Even now, while writing this article while working on chess game, it is still a bit difficult to remember all RSPEC syntax.
Anyway! I quickly realized that the most important part of the process took place while thinking about the test names.
It was a very important moment I had to understand:
-
What will this test check?
-
What will the corresponding method actually do?
After understanding this, of course I wrote the basic test, I fought RSPEC for a long time.
But then… Blinking eyes – Green!
Perfect. Now, I can go to the next test and method.
I’m telling you about 3 weeks? Something like this.
But I have to admit that at the end of this project, I understood this TDD “magic” much better.
The moment he clicked (why TDD is worth it)
I noticed that my project was better thought.
-
Less spaghetti code
-
Shorter, well structured methods
-
Everything is called properly
Furthermore, I noticed that I was not wasted for another week to fix the mistakes or reorganize half of my code, because I haven’t planned properly from the beginning.
Do you know that a small error has broken half of your code and you have to go back and rewrite a lot of things?
Yeah, this time it was almost at all.
Will I continue to use TDD?
Yes.
I like this project. I love TDD. And for my future projects, I will definitely depend on it.
Less troubleshooting. Then it is easier to understand the code on the way back. Just write straight English tests and you instantly know what your program should do.
It’s that simple.
The hardest part of all this is definitely RSPEC – it takes time to get used to it:
- Cynical
- What monca is done
- When is sarcastic
But to be honest? The only way to be better in this regard is to continue practice until it becomes the second nature.