Refactoring

Share this post

Hot potatoes, AI coding, and delegation πŸ’‘

refactoring.fm

Discover more from Refactoring

Weekly, practical advice on writing great software and working well with humans.
Over 50,000 subscribers
Continue reading
Sign in
πŸ’‘ Monday Ideas

Hot potatoes, AI coding, and delegation πŸ’‘

Monday Ideas β€” Edition #63

Luca Rossi
Aug 7, 2023
29
Share this post

Hot potatoes, AI coding, and delegation πŸ’‘

refactoring.fm
2
Share
Article voiceover
1Γ—
0:00
-7:45
Audio playback is not supported on your browser. Please upgrade.

Hey, Luca here! Welcome to the Monday Ideas πŸ’‘

Every Monday I will send you an email like this withΒ 3 short ideasΒ about making great software, working with humans, and personal growth.

You will also receive a long-form, original article on Thursday, like the last one:

How to Write an Accomplishment Journal πŸ†

How to Write an Accomplishment Journal πŸ†

Luca Rossi
Β·
Aug 3
Read full story

To receive all the full articles and support Refactoring, consider subscribing if you haven’t already!

Get full access to Refactoring ✨

p.s. you can learn more about theΒ benefits of the paid plan here.



🐺 QA Wolf

This week I am happy to promote QAΒ Wolf, which has developed a unique, cost-effective approach to testing that gets you to 80% automated end-to-end test coverage in just 4 months β€” and keeps you there.

How cost-effective? Their latest case study shows how they've helped GUIDEcx save $642k+ / year in QA, engineering, and support costs.

Their secret is a combination of in-house QA experts building your test suite in open-source Microsoft Playwright, unlimited test runs on their 100% parallel testing infrastructure, and 24-hour test maintenance.

Schedule a demo and see for yourself πŸ‘‡

Learn more about QA Wolf ✨

(p.s. and ask about their 90-day pilot!)


1) πŸ₯” Hot potato handoff

In many teams I have seen, the relationship between designers and devs only goes one way. Designers pass requirements to developers, and developers write code. That’s it.

When you think about it, the very word handoff seems to suggest this. You push the designs, and it’s done!

While this may work for small features, most projects instead benefit from continuous back and forth collaboration, in what Brad Frost calls β€œThe Hot Potato Process”.

Ideas are frequently passed from designer to developer and back, for the entirety of the creation cycle.

Again, this is nothing new β€” it is iteration and collaboration, instead of "waterfall". You can take the same advice and apply it to almost any company process!


2) πŸ€– AI Coding use cases

I have used AIΒ for coding a lot in the last couple of months β€” mainly Github Copilot and Replit Ghostwriter (my favorite) β€” because I wanted to write about it in the newsletter.

My take is that it is useful but not a silver bullet. Here are 7 use cases that worked for me, and 4 that didn't:

  1. πŸ₯± Boilerplate / Repetitive code β€” AI truly excels here. Creating the stubs for new components, common config, or adding libraries (e.g. add Tailwind to your project).

  2. πŸ” Write tests β€” This is a specific version of #1. AI can write good tests for your code, but expect to have to add more cases yourself. However, you will never have to write another test stub in your life.

  3. πŸ“‘ Explain / document code β€” AI is very good at explaining code and creating docs for you. I have tried it with complex stuff and it always handled it well. Obscure code seems like a thing of the past. You can also try Mintlify or Theneo to generate automatic docs.

  4. πŸ› οΈ Refactor small functions β€” For when explaining is not enough! AI is surprisingly good at splitting functions, refactoring them for better performance, and other small-scale maintenance.

  5. πŸ—„ SQL queries β€” This is an awesome use case, because SQL is no one’s favorite language. Queries look very good as long as you provide a schema. You can also try Mason for this.

  6. ⬆️ Pull Requests β€” AI can create automatic descriptions for PRs and scan code to propose improvements, before it gets merged. This is a no-brainer and I expect it to become commonplace. You can use Codacy Quality for this.

  7. πŸ’» Terminal β€” I am using Warp as my main terminal because, other than having a great autocomplete, it includes an AI assistant that can suggest and run commands for you. I always forget how to do shell things, so this is super useful.

❌ Bad use cases

Now, it hasn’t been all sunshine and rainbows. There have been times where I had to spend more time debugging AI-generated code than I would have probably spent writing the full thing myself.

The main problem is that AI almost never tells you β€œI don’t know how to do this” β€” it rather hallucinates and gives you the wrong answer.

So, I have learned to watch out for these situations:

  1. Very recent stuff β€” If you ask for something that is relatively new (<2 years), there is a higher risk of hallucinations because 1) AI might not have seen it in the training data, and/or 2) examples of it were few.

  2. Niche libraries β€” basically the same as above!

  3. Specific library versions β€” AI isn’t good at keeping consistency between function signatures and the library versions you are using. Keep that in mind if you need something very specific.

  4. Complex functions with a lot of context needed β€” AI is generally good at creating complex functions when they work in isolation (e.g. algorithms, math stuff, etc.) but it isn’t the best when it has to keep into account dependencies from a lot of other code.

More ideas on using AI in an engineering team πŸ‘‡

Refactoring
How to Use AI in an Engineering Team πŸ€–
Hey! This is the first of a series of editions that I will write about using AI for your product/engineering work. I am not exactly early at this. As you may have noticed, we are bombarded everyday with new AI tools, use cases, prompt strategies, and more…
Read more
3 months ago Β· 36 likes Β· 8 comments Β· Luca Rossi

3) 🀝 The three keys of delegation

In a way, delegating is like writing software. You take something you know well and communicate it in a way that is clear, unambiguous, and effective for someone else to execute.

When this someone else is a person β€” not a computer β€” there are three main things you should nail:

  1. πŸ‘οΈ Purpose

  2. 🎯 Outcome

  3. πŸ”€ Communication

Let’s see all three:

πŸ‘οΈ Purpose

Purpose means: why we are doing this.

This is not only incredibly important for motivation, it also helps getting better results. In fact, when people are aligned on purpose, they can take more initiative and propose alternative routes.

🎯 Outcome

You need to describe the outcome you want for the project.

In particular, you need to explain what success looks like. Sometimes it is easier to do so via inversion, by listing all the ways something would fail instead.

You should not, however, turn this into a step-by-step guide.

It’s a fine line, but you should focus on the what, rather than the how, to create space for people to develop their own solutions.

Focus on what you want to achieve, rather than how you would do it.

πŸ”€ Communication

This is where you explain how the person should interact with you. That’s because, again, delegation is not binary, and for any given task you may hand off only a part of what needs to be done.

This is especially true for decision making. Based on the kind of initiative you expect from the delegate, there might be various levels:

  1. Delegate comes up with a short list of solutions β€” and you decide the best.

  2. Delegate comes up with a short lists of solutions and suggests the best one β€” and you sign off.

  3. Delegate decides the best solution in autonomy and goes for it.

In my experience, you can and should always go for at least 1+2.

More ideas on good delegation πŸ‘‡

Refactoring
How to Delegate Effectively 🀝
There is a saying about management that goes: just hire the best people and get out of the way. But get out of what, exactly? The problem with such advice is that it assumes that delegation is binary: you either let people do the whole thing, or you will step onto their toes and prevent them from reaching their…
Read more
9 months ago Β· 29 likes Β· 2 comments Β· Luca Rossi

And that’s it for today! If you are finding this newsletter valuable, consider doing any of these:

1) βœ‰οΈ Subscribe to the newsletterΒ β€” if you aren’t already, consider becoming a paid subscriber. You can learn more about theΒ benefits of the paid plan here.

Get full access to Refactoring ✨

2) ❀️ Share itΒ β€” Refactoring lives thanks to word of mouth. Share the article with your team or with someone to whom it might be useful!

Share

I wish you aΒ great week! β˜€οΈ

Luca

29
Share this post

Hot potatoes, AI coding, and delegation πŸ’‘

refactoring.fm
2
Share
2 Comments
Share this discussion

Hot potatoes, AI coding, and delegation πŸ’‘

refactoring.fm
Gio
Writes Remotely Productive
Aug 7Liked by Luca Rossi

When using IDE-integrated AI to refactor small functions, you can also give prompts like "make into oneliner". Very handy to reduce the typing one has to do.

Expand full comment
Reply
Share
1 reply by Luca Rossi
1 more comment...
Top
New
Community

No posts

Ready for more?

Β© 2023 Refactoring ETS
Privacy βˆ™ Terms βˆ™ Collection notice
Start WritingGet the app
Substack is the home for great writing