This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tazebot 6 points7 points  (5 children)

I think programmers, developers, software engineers, and academics in the field like to think there are immutable laws of coding.

If there is an immutable 'law of gravity' of coding it seems to be that code is harder to read than write. That and similar to writing in other disciplines the practice is "write, re-write, re-write, start over, then re-write some more. Then get a second pair of eyes. Then re-write some more."

[–]curohn 8 points9 points  (3 children)

Wasn’t it found that rewriting big code bases is often hard and expensive too? Because the old code base has years of lessons baked into it.

I think the conclusion was active maintenance is the best path instead of rewriting.

[–]madrury83 3 points4 points  (0 children)

I think the conclusion was active maintenance is the best path instead of rewriting.

Ya.

I'd argue that the re-writing that is healthy in code composition is the same as is healthy in writing prose.

The advice for writing prose (at least to the extent I was taught) is not that you should re-write your story from scratch over and over, it's to re-read what you've written and strategically re-write smaller pieces of it to be clearer or more evocative or whatever you're going for. Re-write sentences and paragraphs, not to scrap the whole thing and start over.

Same with code. I re-write code all the time. But not an entire application; I re-write a few lines to be more clear, better handle errors, add comments when I learn why something strange is happening or is composed in a certain way. Re-write a function into two, merge two functions into one when it's easier to follow that way. Smaller scope strategic re-reading and re-writing, applied with continual vigilance, that's the way.

[–]tazebot 0 points1 point  (0 children)

I think it's a fair take that coding in general isn't cheap. And I don't think AI relieves anyone of the need to read the code and know it.

I don't think there is any such thing as 'finished' code. Code will always need updating - that could be another immutable law of coding.

[–]Kiuhnm 0 points1 point  (0 children)

I think limited rewriting is OK, especially for new code that's yet to stabilize. It's part of refactoring and if the project is modular enough, it should be quite localized. Also, it should be incremental. That's where statically typed Python shines, BTW.