It's close enough to summer that, well, I have an intern at work. I don't know that I should really *say* "I have an intern," but this particular college-aged guy working for the team for the summer was instructed to ask me questions when he had them, and I kept asking him if he was stuck, and helping him become unstuck, that, well, he comes to me and I drop everything to answer his questions, so that means that not only have I written a stunningly long run-on sentence, but also I have an intern and he has a mentor.
Which is great. He inspires me with his enthusiasm, and I help him work-wise now, and hopefully career-wise long term. I find this awesome.
Today, he was working on a new feature and was uncertain about his test cases. Did he write enough? Was everything covered? Do the tests go into different files? How do you know what is enough?
Tests should give you and everyone else behind you, including your future self, confidence that your current code works and future code breaks will surface. Knowing how much is enough and what parts to cover, that's a programmer's adventure! Having recently spent time developing my testing fu, I had a few pointers, one of which was watching Sandi Metz's Rails Conf 2013 talk: The Magic Tricks of Testing.
He asked, "at home or now?"
My response was an enthusiastic, "!!! during work hours! It's for work!"
One thing that is really hard, I think, for new developers or developers in new groups or new jobs, is to understand that you don't know everything, that is okay to ask for help, and that, IT IS OKAY TO LEARN ON THE JOB. So many times, we think, Oh, I'll learn this after hours and come back into work and apply this knowledge, and forget that work is paying for our brain time. We don't have to always be producing output. Instead, we can be sponging knowledge. If we need to learn something in order to do our job, it is okay that work pay for that time to learn.
His response, "it’s 35 minutes lol that’s $$$"
I wanted to cry for him and my 21 year old self, who once thought the same.
My response: "the company pays for your learning. 35 minutes is nothing compared to broken code. or time wasted writing the wrong tests.
"Really, it's okay to spend work time learning. You don't have to come in knowing everything.
He ended up watching the video at work, and learning.
I hope he embraces the learning part, and having work pay for that learning. Work is a give and take between employer and employee. That means the work has to give as well as take, and that give means more than just a salary sometimes.