how-to-beat-developer-procrastination

How to beat developer procra­sti­nation

It was 10:15 AM, Monday. Daily meeting. Zoom call.

I looked at our board, there were 3 new high priority tickets.

 

  how-to-beat-developer-procrastination

 

"Okay, guys. Take one ticket each. Luckily there are three of you." I said. And continued

"I will be busy with infrastructure issues until at least Thursday. But if you need any help with these tasks, just ask me."

how-to-beat-developer-procrastination 10:15 AM, Tuesday. It's too early to expect results. If someone were to finish this fast, it would be an extraordinary event.

how-to-beat-developer-procrastination 10:15 AM, Wednesday. No commits in git, no questions. Of course, it's okay. Give people time.

how-to-beat-developer-procrastination 10:15 AM, Thursday. "Guys, no one needs help? "No," they said.

how-to-beat-developer-procrastination 10:15 AM, Friday. Still no questions, no commits.

***

A new week begins. Monday morning I have a conversation with the CEO.

"Misha, how is task TT-1010 coming along?

The one about giving a discount to a customer to motivate them to pay back a loan.

The quarter is almost over, and this functionality could help us meet our goals for the quarter.

So if you can speed up the process in any way, please do so.

I said,

"Okay, I'll figure it out."

***

"I haven't figured it out yet, ahem-ahem,"

Max, the developer, said to me, coughing. "But I've already written something, so I think I'll be able to show something soon."

"Let's take a look at your code. Maybe I can give you a little boost. Share your screen."

2 tabs from YouTube, 10 from Instagram, and an active tab with a Reddit thread about the new season of Attack on Titans. That's what I saw.

 

how-to-beat-developer-procrastination  

 

"Sorry, wrong screen, ahem-ahem"

A few changes in a few files and a half-finished html form.

"Actually, I procrastinated a bit"

At what point did it become a real justification? I worked hard to build trust with tops, to give my team autonomy, not to write reports, not to track time like other teams do. And this is what I get in return?

"And I think I'm going to take some sick days, ahem-ahem. The weather was not good this weekend."

So now the task is mine.

Nice.

***

TT-1010

The Problem: Clients who are 100+ days late on their loan payments stop paying altogether. We send them notices, they do not respond. We call them, they answer and say they will pay, but nothing happens. We end up selling these loans on a secondary loan market but at a really low price. We lose too much money.

The idea: We can motivate customers to pay by promising to write off some of their debt. But not upfront. We just want to promise a discount, have them sign some kind of agreement online with a fixed amount they have to pay, and wait for the payment. And only after they make the payment we want to apply the discount and write off the rest of their debt. We think that will motivate them more.

The mechanics:

  1. A manager communicates with a customer and offers a discount, e.g. 10%.
  2. If the customer agrees, the manager enters the discount amount into a field on the customer's page in the CRM and saves it.
  3. The customer goes to their profile and sees a payment form with a text like this

1000$ - 10% = 900$

REPAY YOUR LOAN JUST FOR $900.

  1. The customer clicks and goes to the payment system where they pay $900.
  2. The payment system sends a notification of a successful payment to our processing system
  3. The processing system accepts $900 as a payment and automatically writes off the remaining $100.
  4. The loan is closed

how-to-beat-developer-procrastination

***

Okay, let's do it.

...I think there is nothing difficult for me here. I have been working on this project for 4 years. Half of the system is written by me...

...Actually, I haven't touched the "Write-Off Module" for at least a year. But I guess I just have to start. Let's begin with something simple, like an admin widget...

...Damn, I forgot I have a job interview today. But I think I can get this done quickly...

...Hmm, maybe I am not such a fast developer anymore...

...But it's hard to do a task after someone else...

...I've written a bit, but it's a bit fragmented...

...Wow, there is a new Avatar trailer!..

...Do not disturb, please...

...All I've written is crap...

...Maybe some rest?...

...Let's grab a snack...

...Face on the table...

***

Now I have a few changes in a few files and a half finished html form.

I have to admit that I'm not doing any better than Max. Of course, I haven't spent a whole week banging my head against the wall. But I can already feel a trend.

I have a plan, technical decomposition. I'm sure Max had one too.

But it is only a superficial plan. When I try to detail it, I get a similar cognitive overload as when I start writing code without any plan.

Every time I add details, nothing gets clearer. I just get scared about how complex this task is. How many parts of the system unrelated to this task could start working incorrectly if I make a mistake?

It's not supposed to be like this. I will never catch the state of flow if I continue this way.

The problem is that I don't understand how I can be sure that everything will work fine when I finish.

Call those who define expectations

"Hey, Andrew. I'm working on this ticket about discounts for late customers, and you're a reporter on the ticket."

"Yes, they put my name there, but there are actually a lot of stakeholders. But I think I can answer all your questions."

"How are you going to verify that we got it right? Step by step, please."

"Maybe I'm wrong, but as far as I remember, we put the steps in the ticket description"

"Yes, they are there. But I don't know how to use them. I also need to know all the prerequisites and checks you'd do. So I want to know exactly what you'd do if you had to verify our solution right now".

"Okay, I got you. Well, I would have:"

  1. registered as a new user

  2. submitted a loan application for $900

  3. logged in as an underwriter and approved the application

  4. waited for the money to be transferred to my card

  5. changed the payment date to something in the past (thank God you guys made such a magic button for this), for example to the moment when the full debt with interest will be 1000$.

  6. given myself a discount for the whole amount of interest - $100

  7. waited for a notification in the app about this promotion

  8. gone to the user account and checked if there is something like 1000$ 900$ written there

  9. paid back the $900

  10. checked if the loan was actually repaid

  11. checked if there is a certificate of a loan repayment in the customer's profile

  12. checked if there is a new line for $100 in the write-off accounting report.

Great! Now I have a scenario.

Add a few more cases

But that's not enough. I also need to check:

  • What if there is no discount? Does the system work the same as before?

  • What if a manager gives a discount that is more than the amount of interest? We can't write off even a little bit of the initial loan amount. It's simply illegal.

  • What if a customer doesn't have enough money on their card?

I think that's enough. I think I cover 80% of the situations. We can think about the other 20% later when we know if this idea of discounting really makes money.

AUTOMATE EVERYTHING YOU CAN

Damn it. It takes at least 5 minutes to complete the registration. And that's just the first of 4 steps.

I need a way to generate loans faster. I think I can create one user as a template and then duplicate all the related records in the DB using some SQL queries.

1. registered as a new user

2. submitted a loan application for $900

1. just run

INSERT INTO users (personal_id, first_name, ...) VALUES (SELECT personal_id, first_name, ... FROM users WHERE id = 1);

INSERT INTO loans SET amount = 900, ..., user_id = (SELECT max(id) FROM users);

I also think I should somehow automate the process of approving the application and changing the request date. But it's not that easy. To do it right, I literally have to click buttons in the CRM and fill out forms.

This takes about 5 minutes.

I need to use Selenium to script these steps. But I don't want to integrate it with our code repository and CI pipeline. I want to get the job done as quickly as possible.

But I remember a browser extension that does the same thing. Let's find it. Ah, it is called Selenium IDE. Ok, let's take a look at a short tutorial on how to use it.

In fact, it's so easy to use that I can automate all the other steps and checks.

Red, green, refactoring

I run the first scenario. It fails. Ok, as expected, because nothing has been written yet. Let's finally write some code.

I wrote a shitty prototype that I would never want anyone to see. But it passed the test, so I'm happy with that.

But the fourth case fails. I forgot to handle situations where the customer doesn't have enough money on the card.

Fixed it. The last case passed. But the first one failed. Fixed it again.

I can push it to production as is, but I don't want my guys struggling to read such stinky code. I should rewrite it. But now it's much easier with my bunch of autotests.

Share the approach with others

I did a release. Andrew found some minor bugs in production. I fixed them, ran my tests, and released again. It took 15 minutes.

I did a great job, got smarter, but one thought made me uncomfortable. Even if I told every developer on my team about my new approach, no one would really care. They might find it interesting, but they will 100% continue to work as usual. Through pain and fear.

I'm sure they've all heard of Behavior Driven Development, which some might say I've practically reinvented here. But somehow no one on my team is doing BDD.

I think it's time to try pair programming.