Re:I Have a Dirty Secret. I’m a Software Craftsman
by CameronNemo on Sunday April 23, 2023 @02:32PM
(#35679155)
Yeah line count is a hard metric to evaluate. Is your code 100 lines of code like this:
let foo = Foo::new()
.with_bar()
.with_baz(bak, bat)
.listen();
Or code like this: for f in in foo.iter() {
if f == 1 || f > 9 || f % 2 == 0 || is_edge_case(f) {
ret.push((f * 100).to_string());
}
}
Makes a big difference for readability. If you have a complicated conditional, go ahead and give it a name!
Re:I Have a Dirty Secret. I’m a Software Craftsman
by MattPalmer1086 on Sunday April 23, 2023 @03:11PM
(#35679497)
I have essentially the same story, so I won't repeat it. The big win was when my colleague seized on the idea of self documenting code. That was all he needed to write better structured code.
I don't impose fixed line counts for my methods. But when it makes sense, the readability improves a lot.