Mentoring #3

I am mentoring an Apprentice who has never done C# before and this is his first programming job. So this is a diary of some-sort of his progression and my ability to mentor.

I found an example on the Code Review section of Stack Exchange by someone who was writing their very first C# program. I thought it was a good example to give to my Apprentice to test him out.

So I showed him the code, and asked him to explain to me what it was trying to do, if he could suggest improvements or spot any bugs. Basically doing a Code Review.

I thought he explained the code fairly well and struggled in places where the code wasn’t well-written. He did point out one bug and did hint at a few areas of improvement but didn’t seem sure on how exactly to improve it.

I then took him through some changes, and explained how the code could be improved. Most of the code was jammed inside one method so it was 300 lines long. I showed him how you can easily refactor the code into smaller methods using Visual Studio, and how to rename variables (with the advice of choosing descriptive names). The end result is code that is self-describing.

You can read the popular book Clean Code by Robert C Martin which discusses more ideas along these lines.

I told him it’s an important skill to read other developer’s code, since maybe you end up spending 90% of your coding time reading existing code (not sure of the exact statistic there, but it must be high). Also you will be doing it in the code review process.

He seemed to really enjoy it, and was grateful for my tips. I told him I will probably be testing him with more of these challenges, and I also expect to see him put my advice to use in his own code.

All Nighter

After my important bug fix was complete, it needed urgently testing, so a Tester worked overtime on Friday night and Saturday.

During testing, he found a bug, but it was completely unrelated to my fix. Still, he wasn’t to know that, and so when he raised it as an issue, my manager was panicking and trying to contact  some developers.

I didn’t see the message until Saturday 11am, but when I logged on and investigated it, I saw another message from my manager to liaise with Colin. Colin loves his overtime so had jumped at the chance to get involved.

When I managed to contact Colin at around 11:45am, he sounded like he was falling asleep. He then told me he was working 10pm to 4am to work out what was happening.

To be fair, he didn’t have the advantage of knowing what the original bug was or the impact of my fix, so I assume he spent a lot of time investigating that. The thing is, the only conclusion he had was that “it wasn’t caused by your change”. I worked that out within 30 mins; I didn’t need 6 hours.

The thing is, there’s no way you can work effectively that late at night; given that you have already done 9-5, and you have it in your mind that it’s now the weekend. To get back in “work-mode” and look at code through the early hours of the morning – it’s just madness.

The thing is, I worked on an important project with Colin a couple of years back. There were major problems with the code which were often caused by Colin. I fixed them during work hours. Colin was spending a few hours extra each night in overtime fixing other problems. He would then turn up late the next day, looking completely tired, and then wrote more crap code… then had to sort it out in overtime. Then it’s an endless cycle. If you want quality code, then overtime is not the answer.

Good Job

There have been a few instances of managers just regurgitating information, but when I think about it, I guess that’s just how the world is. Someone can report back to their manager and the manager has to trust what they say. Then that manager feeds back to their manager, and so on.  I guess you can’t expect them to verify all the information. That’s why you have a hierarchy and delegate, and get information fed back to you.

It’s quite funny when it reaches Director level, because I’m sure they literally have no idea what certain things mean because they won’t have more than a basic understanding of how software is developed. 

There was a really urgent bug fix, and I volunteered to do it. It wasn’t immediately obvious what the problem was, and I was getting a bit lost trying to debug it. Recreating it was easy, understanding why it wasn’t working was tricky.

Given the urgency, I requested help. I managed to get one of my close colleagues to help. He did point me in the right direction; he pointed out something I had overlooked. Then I came up with the theory of why the bug was occurring, and I was correct. At that point, fixing it was actually trivial.

He had to give feedback to my manager to confirm that he had helped, but he tried to make sure I got credit by saying that I did “a good job”. I know this because he screenshotted the Slack conversation and sent it to me.

I then received a message from my manager stating I had done “a fantastic job”. A day later, the Development Director messages me saying that she understands I have done “a cracking job”.

I love how the adjective basically increased in importance as it went up the chain: good->fantastic->cracking.

I did do a good job from a certain perspective. I did show good decision-making by requesting help to ensure the work was done on time. It definitely worked out for the better. 

Also, another developer should have actually picked this work up, but I detected his reluctance. It was one of those where it was quite late in the week, and we had to fix it with some urgency. He didn’t want the pressure/stress and responsibility. I did step up, and it was a bit more complicated than I initially thought, so I definitely mugged myself off there. 

I’d like to think I would volunteer for things like this anyway, but I am trying to be the centre of attention in order to force my manager to give me that promotion he hinted at. This has worked well, because the Development Director has been told about it.

Mentoring #2

I think I’ll end up writing loads of blogs about mentoring my new Apprentice. It’s going to be an interesting journey for sure.

  1. He doesn’t know C# or SQL and that’s a prerequisite
  2. He has never used our software before
  3. It’s his first software job so knows nothing of the process

I explained to him that this team is really difficult, but historically, we have always thrown juniors into a team like this, much to the protest of many. This team deals with a wide range of bugs, and often requires good knowledge of requirements, and excellent debugging skills. We also get really tight deadlines, since we are given all the “Major Incidents” which can have 1-3 days deadlines. It’s unfair to put that much pressure on an inexperienced developer.

I told him it’s a “sink or swim” type approach, but strangely I can’t think of anyone that quit. When I was a Junior, we all complained about this, but yet everyone stuck around and became good developers.

I was telling him my long journey into development, and told him it takes years to get good, although maybe I was just slow because I was extremely casual. He reckons he can learn within a few months. I think he is ambitious, but I reckon he can learn like 10 times faster than I did. He can put more effort in, and I can guide him.

I was telling him how I haven’t been given guidance on how to be a mentor, but I can just freestyle it. I told him I’d like to be the mentor that he expected to have. I mean, he is an Apprentice and has been here a year without anyone actually being assigned to him. That is such a classic thing to do: hire people on the promise of training and good things, then they get here and they are never assigned any official training.

Mentoring Again

Background

A few years back, I was assigned an Apprentice to mentor. I said I would love to do it, but I questioned why the Senior Developers in the team didn’t have anyone to mentor when it is literally in their job descriptions.

At the time, my manager said that she thought I’d be the best mentor in the team, and if I do it successfully, then that is good evidence I can be promoted.

I think the mentoring went successfully, but I didn’t get a promotion.

Present Day

Fast-forward to the present day: My new manager said that an Apprentice is joining our team, and out of everyone, he reckons I would be the best mentor. If I do it successfully, then that is good evidence I can be promoted.

I said I’d love to do it. This time I didn’t complain about the Seniors not mentoring. I didn’t want to risk my manager reassigning the Apprentice. I have a good feeling my manager will actually promote me, but we will see.

The Future

I had a chat with my Apprentice. He has never done C# before; but it’s vital to our team. We already had a lack of developers – and a lack of skilled ones. Now we have someone who has never seen the program we are working on, and never used the language it is written in. He has come via a bootcamp that taught him basic Web Development, so that’s some wasted training.

This means that I’ll have to spend a lot of time training him, which means my productivity to bug fixes/enhancements will drop. Our team’s productivity was already low, and now we have another member which is actually going to decrease productivity. I hope managers realise this.

I think I’ll have to encourage him to learn as much as he can on his own. I’ve sent him a C# ebook which is pretty comprehensive. He has access to an online training platform to watch in his own time, plus all the rest of the free content on the internet.

This is another topic to write about on the blog. It can document me learning how to teach someone from scratch, and also document funny mistakes he makes.

Team Summary

The team is showing unwavering commitment, innovation, resilience, and drive to deliver continuously. I’ve never seen anything like it in the years I’ve been here.

Head of Development

I always say that managers often show a massive disconnect from reality. They seem to praise when the team has performed poorly, and I think this is another case of that. I went through our team’s changes in the last month. Merges are trivial and I don’t really count them as real work, but I’ve included them in the table anyway. 

Here is the analysis:

NameMergesFixesMy View
Me14I’ve been disappointed in my productivity. However, I haven’t done that bad when compared to everyone else. Additionally, I have got loads of changes in a branch, on hold; awaiting confirmation of actual requirements. 
Senior Dev111 (mainly small items)Decent work, but really only cherry picking “quick wins”
Colin4 (made a massive mess of one of these, made a bit of a mess with another. I think the other two were primarily to teach people how to merge [ironically].)5 (I believe 2 of these fixes were issues he created in the other 3)Colin wasted a lot of time by making a mess of a merge which introduced at least one bug, and he made a mess of one of his other changes. He claims he has been more productive whilst working at home.
Colin 203 (1 of which was removing an unused using statement)With only 2 real changes, one of which was small and it didn’t work properly; this is terrible performance.
Rob02Rob has been real quiet. I think he had a bit of time off work, but still, this is poor
Beavis01Beavis was primarily just making excuses why he can’t work. To be fair, there was one week where he was doing some other work for another team.
Total626
Our “drive to deliver“

So in a month, we haven’t done much work. I’d be interested to calculate what the average amount of fixes developers do each month. It’s a bit meaningless because a fix could take an hour, and another fix could take a week. However, you would think it would average out over a period of time.

I’ve never seen anything like it. I might use that as a recurring phrase from now on.
My manager actually said to me that my efforts “haven’t gone unnoticed”. I didn’t bother to correct him. I think I need to play up the delusion to try and get a promotion. Honesty never got me anywhere before.

Press F5 to launch

I had a look at my old team’s work to see what progress they have made and to reassure myself I had made the correct decision to leave that project. 

Not much has changed in months. All the issues we had haven’t been fixed. There’s errors logged to the console window, there’s loads of buttons that don’t work. There’s a few small features but nothing works properly. 

What made me laugh was a button that said “Press F5 to launch”. It’s a website. Pressing F5 isn’t going to launch a dialog; it’s going to refresh the page in the browser.

Maybe there is a way of overriding the browser’s refresh behaviour but that would be very annoying to the user.

What I don’t get is: how someone came up with that requirement in the first place, someone else implemented it and somehow didn’t realise it wasn’t going to work. Although surely they did realise when they wrote some code to do it, then pressed F5 and the page refreshes…but then checked it in anyway.

Honestly, you just can’t get the staff.

HTML Encoding

A developer wrote some code that tries to extract text that looks like HTML tags. So if you have <h1>, <div> etc in your text, he was basically just deleting the HTML prior to saving it to the database. 

The thing is, the code just looked for a “<” then a “>” and removed everything between. So if you had a sentence like “the value is ❤ and >1”, then run that through his code, the returned value would be “the value is 1” which has a completely different meaning. You could have paragraphs of text between these characters, and his code would just delete it.

Not sure why he decided to hand-craft his own solution. There will be more official ways of encoding HTML.

Just Copying What Was Already There

My manager calls me and says there is a bug that might end up holding the release, and wondered if I can help. He said it was found when testing Colin’s work, but it might not actually be related to his changes. 

Colin had been given some other work and he was taking ages on it,so wasn’t available to complete this work himself.

So I call Colin and ask him what this bug is. He sent me the description from the tester (Becky) which was next to useless, he showed me his recent changes, and a specification from his project. Colin assured me that his changes should work, because he just “copied what was already there”.

It seemed like everything I needed, so I got digging into the code and testing it out.

It didn’t take me long before I realised what Colin had done. There were two scenarios that he needed to check. By copying and pasting what he saw in that file; he was just covering one of the scenarios. The other scenario was actually in another file, and he would have realised that if he actually tested it.

The thing is, my first thought was to add a unit test to cover the scenario. I checked for existing unit tests for that file, and there were some existing tests. Colin hadn’t bothered adding additional unit tests; which would have made him realise that his changes didn’t cover both scenarios.

Then days have gone by, the manual testers have finally got round to testing out his changes, and logged this issue just days before the release. 

Then I have to save the day once more.

It’s so annoying/stressful when you get given a bug to fix with strict deadlines, but luckily it was very easy to fix. If Colin had shown a bit of effort, then we wouldn’t have been in that situation.