Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

When to invest effort in writing clean code

21 views
Skip to first unread message

Graham Ashton

unread,
Oct 11, 2023, 6:36:05 AM10/11/23
to nwrug-...@googlegroups.com
At last month's meeting Brandon asked about tools that help you manage code complexity.

I mentioned Adam Tornhill's books "Your Code as a Crime Scene" [1] and "Software Design X-Rays" [2].

Somebody asked me to send the info to the list, so here we are...

I've got both, but not read the second one yet.

They sprung to mind for Brandon's question because Adam is into using version control history to identify hot spots in your code base.

The first book comes with some open source code for putting his ideas into practice, and analysing your git logs. [3]

Maintenance is expensive because changing code is hard, and it makes sense to invest some effort in making that maintenance easier. Unfortunately, we don't know when we're adding a new feature whether or not we're going to need to do much work on it in future. And many of us are tempted to make *all* of it easy to change.

Adam's big idea is that writing good code by default is a waste. He's developed techniques to identify areas of the code where you see a positive return from investing the effort. He goes into detail on that in [4].

Cheers,
Graham

[1] https://pragprog.com/titles/atcrime2/your-code-as-a-crime-scene-second-edition/
[2] https://pragprog.com/titles/atevol/software-design-x-rays/
[3] https://github.com/code-as-a-crime-scene
[4] https://www.adamtornhill.com/articles/code-quality-in-context/why-i-write-dirty-code.html

Brandon Burton

unread,
Oct 11, 2023, 11:01:00 AM10/11/23
to nwrug-...@googlegroups.com
Thanks very much for this, Graham! 

--
You received this message because you are subscribed to the Google Groups "North West Ruby User Group (NWRUG)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwrug-member...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nwrug-members/8c447906-33a1-4b15-8fbe-090a34bd359e%40betaapp.fastmail.com.

Rob Whittaker

unread,
Oct 16, 2023, 10:56:50 AM10/16/23
to nwrug-...@googlegroups.com
Graham,

Thank you so much for sharing these links.

I enjoyed Adam's blog post.

Is it worth spending the time investing in the books?

Also, have you used any open-source tooling in the way suggested in the blog post?

—Rob

Rob Whittaker

unread,
Oct 16, 2023, 10:57:29 AM10/16/23
to nwrug-...@googlegroups.com
Graham,

Thank you so much for sharing these links.

I enjoyed Adam's blog post.

Is it worth spending the time investing in the books?

Also, have you used any open-source tooling in the way suggested in the blog post?

—Rob

> On 11 Oct 2023, at 11:35, Graham Ashton <gra...@effectif.com> wrote:
>

Graham Ashton

unread,
Oct 16, 2023, 11:27:36 AM10/16/23
to North West Ruby User Group (NWRUG)
On Mon, 16 Oct 2023, at 15:52, 'Rob Whittaker' via North West Ruby User Group (NWRUG) wrote:
>
> Is it worth spending the time investing in the books?

"worth it" is a tricky one for me to assess without more context — I think that all depends on whether or not you have any problems he can help you solve. Are you currently dealing with a mess, or a project that feels hard to change?

> Also, have you used any open-source tooling in the way suggested in the blog post?

I can't remember what he mentions in the blog post, but I've used scripts like the ones he talks about (and shares) in the first book. I suspect he evolved them into his startup (CodeScene).

They were very useful. I remember thinking "what I really need is to build a tool that will let the team look at data like this, for any given feature" or "for any given fortnight". I was working on a 3 year old monolithic web app that had seen about 80 different developers working on it at the time.

It'd be largely pointless on small or new Rails projects though.
Reply all
Reply to author
Forward
0 new messages