Make Money with TDD - 00

Make Money with TDD - 00

Welcome to ... whatever the fuck this'll turn into.

Preamble (post writing)

This turned into ... a lot. Both in the content for this series of doing MONEY! What I found while working through this is that I had a lot of tangents about a lot of things.

One of the big things I had the tangents of is how I do TDD in my ideal. I was not going to go through and re-write this... because I don't edit any of my posts; way too lazy.

Instead; I wrote my "TDD Like You Mean It" series. Which develops the very explicit flow of how I do TDD. This series follows is pretty well, but not as explicitly as I could have done otherwise.
Overall; that's fine though - I wasn't focused on TDD LIKE YOU MEAN IT, I was focused on Money via TDD. So that's what it is.

I've posted the TDD Like You Mean It series already. I figured it'd be a great pre-series to this one... as it was spawned by a "lack" in this series.

Also - I probably have some editorial notes in here... WHELP... I probably didn't edit them out. OH WELL... You're reading my blog... you know I ain't got the word writing good.

You can find the code for this entire exercise on github here https://github.com/Fyzxs/MoneyExampleFizz

I was going go try and add commit links through the writing... but no. I'm too lazy.

Back To The Main Show

I recently, today actually. As of the "writing this" timeline, not your "reading this" timeline. I wrote a review of a book on Learning TDD... actually that's the name, "Learning Test-Driven Development" by Saleem Siddiqui.

I don't like how this author progressed the example, or the tests... His TDD is different enough from my TDD and practices... I've gotta do the Money example.

That's what this'll be - TDD MONEY!

The money example used from Kent Beck's Test Driven Development By Example and I'll kinda co-op both of them into whatever I end up using here.

One thing that stands out to me... both books talk about "Shares". They have value in a currency, but we want to translate the currency... The share aspect is bullshit. The books NEVER ADDRESS SHARES. Ever. In either book.
So I'm not gonna either; and I'm not gonna bullshit the scenario about shares and prices and conversions. No; fuck that.

We're doing money conversions. That's it. I'll be stealing most of these "Features" from the book I don't like... because it's got them nicely written out.
I guess I will crack it open... one last time.
We want to our money to multiple

5 USD * 2 = 10 USD
10 EUR * 2 = 20 EUR
4002 KRW / 4 = 1000.5 KRW
5 USD + 10 EUR = 17 USD
1 USD + 1100 KRW = 2200 KRW

Those are the 4 things we need to have happen.

I've been working in Kotlin this year, so I'm gonna go back and do some C#. Which I don't do a lot... so... I may have to go update some things.
I should really update things before I get the itch to do a huge fucking project like this money one.

I suspect this is gonna serve as a few blog posts. Beck's book has 17 chapters. I'm not gonna be nearly so verbose; but hey - maybe? HAHAHAHAHA - no.

My plan is to code and write at the same time. I have no idea what/where I'm going to go. I've implemented money a few times. Some more intricate than others. One in a 'classroom' environment being taught by someone I consider a mentor. My style of object oriented programming is HEAVILY influenced from his teaching and the discussions we've had.
That said, I'm pretty sure I've taken things into my own direction; but that's what makes it fun. My mentor's also done Money many times, I wonder if he'll see and critique what I come up with here.

Oh WELL...

Visual Studio is still installing. Then I gotta update ReSharper. If you're doing C# development and don't have ReSharper - Get it. Ideally have your work get it for you. I've maintained my own subscription for over a decade because I value it that much.

... I really shouldn't update while I'm trying to blog... but I like to update things so much!!!

I'll be putting the source code into my GitHub. I'll have to come back through and add the details of where. I don't think I'll branch the "chapters". I'll try to track the commit hash so I can point to them through out.

Given that I'll be trying to do commits and what not; while I make NO PROMISES... I'll be trying to follow the commit rules laid out here

One; it makes for small commits (which I'll try to remember to do) and Nichole won't kill me for not using them in my example.
I've probably written about these somewhere on my blog. But - To recap.

Commit Message Rules

  • Separate subject from body with a blank line
  • Limit the subject line to 50 characters
  • Capitalize the subject line
  • Do not end the subject line with a period
  • Use the imperative mood in the subject line
  • Wrap the body at 72 characters
  • Use the body to explain what and why vs. how

And remember, always read your commit messages as

If applied, this commit will

If you do small commits and use Arlo's Commit Notation; the only one that really matters from that list is If applied, this commit will <YOUR SUBJECT LINE>

I actually keep that open in a little window while I code. It helps me remember.

OK... ALL SET UP AND READY TO GO!!

====================================================

SET UP

I've created my MoneyExample project as a unit test project. I don't think I need anything more.
git initd and grabbed the visual studio .gitignore from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Got that committed as the intial commit.

Next up adds the default solution created files.

MoneyExample.csproj
MoneyExample.sln
UnitTest1.cs

There's some initial clean up I like to do before diving into tests.

  • Test File Name
  • Where are the Requirements?

The file name gets to be changed from UnitTest1 to MoneyExampleTests. That's... SHIFT+F6 is not rename; nope nope. CTRL+R+R... mmmm... hot key muscle memory confusion...
Anyway; a rename is a safe refactor which can be committed.
And apparently the file will need a rename too. Normally gets picked up in the class rename...
Let's go ahead and delete the default test, we can add a new one when we get there.

And with adding the requirements file, I think we're ready to go.

NEXT TIME

And we are indeed ready to go. I'm gonna make this a teaser post. MWAH

So, next time, you'll see my uber-small step TDD approach and practices to get my money multiplying!

Show Comments