According to my system, it's November 2 now, which means (in this
hemisphere, at least) summer really should be considered over. Though
I do question that a little, considering it's still getting close to
90 degrees most days[0].
So, consider this my What I Did This Summer report.
Back in April, I suggested we were gliding down to a release
presumably sometime over the summer. It's possible you noticed that
didn't happen. There are reasons behind that. One of the things I
wanted to get done as part of the "break everything before 4.0"
process was to do more rearranging of the source, so that things were
a bit more organized, and we didn't have so many gigantic mishmash
files. I feel like it's important to do this before 4.0, so we can
avoid such enormous rototilling afterward and confine it to the 3.9.2
-> 4.0.0 transition where we're already breaking 3rd party patches and
everything else in the universe anyway.
It turns out that that's, like, a lot of work. And would take me
quite a while. So I figured the only way to tackle it was to be very
methodical and very consistent, and on April 30 I decided that I'd do
_something_ on ctwm every day. Some days I could put in a couple
hours, a lot of days I could only get 5 or 10 minutes. But I wanted
to always do SOMEthing. Get at least 1 change committed every day.
And see how long it took to get through things.
And so I committed some stuff on April 30th. I committed a few things
today, November 2nd. And I succeeded in making at least 1 commit on
every day in between. By my math, that's 187 consecutive days of
ctwm, which is just over half a year. That encompassed 1365 commits,
so an average of just over 7 a day. 52 of those days I only managed
1, 46 of those days I did 10 or more, and on June 11th I did a full
50. So, 'average' is a pretty gross measure in this case...
Summary of work:
The major portion of the work was breaking up our biggest files, and
especially those that had turned into disgusting dumping grounds of
often-unrelated and totally miscellaneous code. The most obviously
egregious of them were menus.c (6166 lines) and util.c (4097 lines),
but there was plenty of it everywhere. In current head, menus.c is
down to 1760 lines (of code just relating to menus!) and util.c
managed to get down to 554 (of just code that really is util-ish).
There's lots of poking that could be done at the range of revs the
work encompasses[1], but I'll hit a few high points.
68 new files were created in the process. Some were things related to
build system changes, but most are source/headers for things that were
split out. Some high points (post- line counts aren't directly
comparable to pre-; see later discussion):
- The image*.[ch] files contain the code related to building and
loading images in various formats, accounting for 2,382 lines that
were previously crammed in util.c.
- The functions*.[ch] contain code for handling and dispatching the
various f.whatever functions tied from menus, keybindings, etc.
That's currently 4,307 lines that were previously in menus.c. There
were also changes to generate a lot of function-related bits rather
than having them hand-coded. Especially the dispatching was totally
redone[2]; this is a good candidate for testing...
- Lots of code related to window handling got moved out of menus.c and
util.c, including bits related to decorations (titlebars/borders),
and generalized drawing routines. These are now in various win_*
files, drawing.[ch], etc.
- Previously, there was a >4000 line workmgr.c, which contained most
of the code related to workspaces, the workspace manager, window
occupation, etc. This is now in individual files for window
occupation handling, workspace general config, workspace manager
window handling, and workspace utils.
- And plenty of other smaller bits.
A further large part of the process was going through much of the code
as I shuffled it around, making some non-functional changes and
cleanups to the code, but also putting a lot of work into figuring out
just what it was doing and what the magic cross-dependencies of its
actions were, and writing up a giant pile of comments describing it
all. That winds up being a fair number of small general narrations of
the processes, and a gigantic pile of cross-references to other code
and how X works to explain why lots of very opaque and peculiar things
are done.
According to cloc[3], on April 29th there were 58 *.[ch] files,
containing 30,365 lines of code, 5,894 lines of comments, and 4,546
blank lines. Today, there are 116 (+58) files, containing 31,122
(+757) lines of code, 9,293 (+3,399) lines of comments, and 5,847
(+1,301) blank lines.
When looking at how many days I only managed 1 commit, I feel like
I wasn't getting much done, but seeing almost 3400 lines of
comments added? That makes me feel like I earned my oxygen.
And there was various other minor stuff done along the way. Some doc
improvements. Some improvements to the main build system. The
implementation of the minibuild system. A few minor bug and near-bug
fixes.
What's next?
Well, with that all out of the way[4], I can just go back to what I
said in April; let's move toward release.
I have a few minor bugfixes I found, some other trivial cleanups, and
some documentation fixes that I kept a list of along the way to take
care of.
Plenty of testing is needed. I've been running this code all along
the way on my own systems, and usually ran big changes for at least a
day before even landing them on trunk, so it should be reasonably
safe. But I certainly don't use every corner of ctwm, so it would
definitely be good to have more people testing it.
In support of that, I'll probably try cutting a new snapshot in the
near future, so we can start slipping into pre-release mode, and
finally finish that out. But, I'm not going to do that now.
Instead, I think I'll try doing nothing at all on ctwm tomorrow. Just
to see what it's like. It'll probably feel pretty weird at this
point, and I'll feel a _little_ guilty about slacking off. But I
figure I've earned at least one day off, and it's time to bring a
close to my Summer Of Ctwm.
[0] To those of you who live in Celcius, that would be pretty hellish,
to be sure. But I can assure you, even in Fahrenheit, it's not
how I like my Novembers to be.
[1] -r472..542 that would be.
[2] Prior to this rework, ExecuteFunction() was a 2079-line function
crammed into menus.c, the bulk of whose contents was a 2028-line
switch() statement! There may be better examples of code smells
that I think justify these cleanups, but I'm not sure there are
more spectacular ones.
[3] https://github.com/AlDanial/cloc
Note that the before and after aren't _strictly_ comparable, since
I didn't bother trying to make them count generated code, and a
fair bit of stuff was moved to being generated.
[4] There's more cleanup that can be done, but I believe I've
successfully completed pretty much all of the giant disruption and
complete rototilling, so what's left should be much less globally
damaging to outside patches.
--
Matthew Fuller (MF4839) | [email protected]
Systems/Network Administrator | http://www.over-yonder.net/~fullermd/
On the Internet, nobody can hear you scream.