News for hackers. Stuff that matters.
Re:Git is my buddy: Effective Git as a solo developer by hinkley on Tuesday February 23, 2021 @03:37PM (#26242554)
Exploratory refactoring turns out to be very close to an exercise in creative writing, as I learned one day accidentally from my lit major friend.

Take the section you are stuck on, print it out, cut it up into sentences or phrases, and just rearrange them until either it makes sense, or you figure out where you went wrong.

Rearranging code statements until something makes sense is exactly what refactoring is.

Re:Git is my buddy: Effective Git as a solo developer by systemvoltage on Tuesday February 23, 2021 @04:52PM (#26243384)
I beg to differ.

Refactoring is not merely rearranging code statements. Refactoring is restructuring of the code starting from the architectural and abstract goal and then looking at how pieces of existing code would fit. Sometimes, that requires writing new code and tests. Refactoring by definition also means not breaking the user space.

I've never heard of any serious writer printing out their prose and cutting it and rearranging it. That just sounds absurdly unnecessary to me.

Re:Git is my buddy: Effective Git as a solo developer by hinkley on Tuesday February 23, 2021 @05:38PM (#26243921)
> code starting from the architectural and abstract goal

you are either using a different definition of architecture or this is wrong. Refactoring is bottom up construction. Most of the time when I see people frustrated or struggling (including myself) it's because they have forgotten this and need to take a break.

Re:Git is my buddy: Effective Git as a solo developer by systemvoltage on Tuesday February 23, 2021 @06:10PM (#26244283)
I am using the standard architecture difinition.

More information here: https://en.wikipedia.org/wiki/Code_refactoring

There are many goals in refactoring, specifically this section:

> Potential advantages of refactoring may include improved code readability and reduced complexity; these can improve the source code's maintainability and create a simpler, cleaner, or more expressive internal architecture or object model to improve extensibility. Another potential goal for refactoring is improved performance; software engineers face an ongoing challenge to write programs that perform faster or use less memory.

I was addressing OP's analogy to cutting pieces of written prose and rearranging.

Re:Git is my buddy: Effective Git as a solo developer by hinkley on Wednesday February 24, 2021 @03:43PM (#26255570)
A bad paragraph does not get the point across because it is doing things in the wrong order, or taking to long to get there. Hoisting code can be removing repetition, performance... So many things. Rearranging or deleting code so that a piece is not trying to do three things at cross purposes, for one.

Code is meant to be read by humans and only incidentally by computers.

A lot of architecture is just being clear about what is intrinsic complexity and what is accidental, be it cognitive or computational.

Re:Git is my buddy: Effective Git as a solo developer by johnfn on Wednesday February 24, 2021 @01:46AM (#26247309)
> I've never heard of any serious writer printing out their prose and cutting it and rearranging it.

Writers definitely do this. Maybe not at the prose level, but for sure at the plot level and chapter level.

Re:Git is my buddy: Effective Git as a solo developer by thyrsus on Wednesday February 24, 2021 @05:13AM (#26248442)
I've found myself doing this in e-mail recently. I naturally try to set the stage/explain the situation, then ask for something (opinion/resources/prioritization/...). But I've been advised to lead with the request, and then explain. It often takes a minor rewrite to make it work, but I've become convinced it helps motivate the reader to read the explanation.
Re:Git is my buddy: Effective Git as a solo developer by IggleSniggle on Tuesday February 23, 2021 @09:28PM (#26245910)
I’ve definitely heard of doing this when plotting something out, ie at compile time instead of runtime to stretch an analogy.
Re:Git is my buddy: Effective Git as a solo developer by systemvoltage on Tuesday February 23, 2021 @09:34PM (#26245945)
I think you can buy a box full of words: https://magneticpoetry.com/