denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)
Denise ([staff profile] denise) wrote in [site community profile] dw_dev2010-11-16 10:35 am
Entry tags:

Technical debt

If you aren't familiar with the term technical debt, it basically refers to decisions that organizations and software projects make to get things done now in exchange for having to fix it later -- borrowing time from the future, essentially, in order to get things accomplished now. Repaying your technical debt can involve a whole host of activity from code refactoring to cleanup work to system documentation, yadda.

[personal profile] kareila has been doing yeoman's work in making massive interest payments on the 10 or so years' worth of technical debt that the DW codebase has accrued, and we have a bunch of bugs open (why-cleanup, why-dev, why-optimization, and about 1/3 to 1/2 of why-usability) to repay some more of it. I thought it might be time for a group evaluation of our outstanding technical debt, though, and brainstorm ideas on what we can do to make more payments.

So, what other forms of technical debt do we have "on the balance sheets", so to speak?

Things I can think of off the top of my head:

* finish converting the whole site to TT
* better install docs
* better "so you want to admin a DW clone site" docs
* finish moving cgi-bin/lj*.pl files into proper modules (in cgi-bin/LJ)
* better in-code commenting (ideally each method in User.pm would have a comment explaining what it does and how to call it, for instance)

That's just an example list, though, and I'm sure I'm missing stuff! What bits of 'technical debt' have you noticed?
shadowspar: Picture of ouendan (ouendan - osu!)

[personal profile] shadowspar 2010-11-16 05:06 pm (UTC)(link)
I don't know specifics, but I've heard it mentioned that much of the code could use more/better unit tests.
yvi: woman showing her biceps, text: "We can DW it" (Dreamwidth)

[personal profile] yvi 2010-11-16 05:17 pm (UTC)(link)
Or any at all :D
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-11-18 11:40 pm (UTC)(link)
The code has quite a lot of unit tests, actually! We've been getting them up to scratch.
foxfirefey: A fox colored like flame over an ornately framed globe (Default)

[personal profile] foxfirefey 2010-11-16 06:03 pm (UTC)(link)
We need to standardize all of the app site pages. They need to have standard classes for different elements that behave the same way, so they are easier to style for other people, and so each new page will almost never require any special color styling if it conforms to conventions, only some layout styling. It will greatly reduce the size of our site scheme CSS.
foxfirefey: A fox colored like flame over an ornately framed globe (Default)

[personal profile] foxfirefey 2010-11-16 06:39 pm (UTC)(link)
PS: First link to bugzilla broken, think this one works though for cleanup.

Also: we need to move the heck on over to jQuery from all the older JS.
dreamatdrew: An orange leopard gecko half hiding behind the leaf of a 'lucky bamboo' plant, looking directly at you. (Default)

[personal profile] dreamatdrew 2010-11-16 09:17 pm (UTC)(link)
I have yet to find where there is a list of "This url starts getting generated in this file" directions. I WANT THIS. It's easier to fix things if we know where they are.
foxfirefey: A fox colored like flame over an ornately framed globe (Default)

[personal profile] foxfirefey 2010-11-16 10:41 pm (UTC)(link)
I'm not finding the bugs for these yet but I am pretty sure they exist and are important:

* Redoing the support system
* Redoing the translation system
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2010-11-19 02:25 pm (UTC)(link)
I know there's at least half a gdoc with some support brainstorming; I should ask Kat when she's going to have a working phone again.
kareila: (Default)

[personal profile] kareila 2010-11-17 01:19 am (UTC)(link)
Oh, that's what I've been doing?

I'm sure we need more tests, and a few of the current tests still don't work.
thorfinn: <user name="seedy_girl"> and <user name="thorfinn"> (Default)

[personal profile] thorfinn 2010-11-17 06:51 am (UTC)(link)
Code Style Automation.

I assume DW has a current Perl coding style, but I'm betting that enforcing it costs you a huge amount of review time.

Perl's biggest problem when it comes to maintainability (which is a huge factor in technical debt) is TMTOWTDI. Adopting Damian Conway's Perl Best Practices as The Coding Style pretty much stops that problem, because it gives you One Way To Do It, for pretty much everything you might want to argue about.

Implementing it as an incremental process on an existing codebase is not hard.... Create a script which runs perlcritic and perltidy over a file and reports errors, and make use of that script as the first thing to be done when checking out code and the last thing to be done before checking in code.

I promise you, that one thing alone will save a huge immense amount of time in code review, code style arguments, and massively improve the readability of your codebase alongside that.
Edited 2010-11-17 06:52 (UTC)
pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)

[personal profile] pne 2010-11-17 09:28 am (UTC)(link)
*nods* Even if programmers disagree with this or that coding style guideline, having a uniform guideline amongst all programmers makes maintenance much easier (especially maintenance by another programmer than the one who wrote the code in the first place).
thorfinn: <user name="seedy_girl"> and <user name="thorfinn"> (Default)

[personal profile] thorfinn 2010-11-17 11:56 am (UTC)(link)
Yep. And the best thing about Conway's PBP is that it is *so* comprehensive - it really covers everything you might want in a perl style guide and more... and that a huge proportion of its ruleset is implemented in Perl::Critic, so it can be automatically detected. You don't even need to buy the book (although I really do recommend it for anyone doing a significant amount of Perl) - just install perlcritic and get his .perltidyrc (which is well published), and use them.

Automatic code style enforcement is a massive win on human time - human based code style review is horrendously time consuming, and sufficiently so that it is extremely marginal in terms of net benefit on programmer time.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-11-18 11:44 pm (UTC)(link)
I suspect you're right with this. Our current coding style is documented at http://wiki.dwscoalition.org/notes/Programming_Guidelines . There are parts of it I don't agree with, but I still always make sure my patches are in that format.
thorfinn: <user name="seedy_girl"> and <user name="thorfinn"> (Default)

[personal profile] thorfinn 2010-11-19 01:28 am (UTC)(link)
*nodnod* I just took a look. That is a very very tiny amount of style guide, compared to what exists in the Perl Best Practices book and the resultant Perl::Critic/Perl::Tidy. :-)

That's the difficulty with developing your own style guide - there's so many possible things to nail down, and so many good reasons to do any of the different possibilities.

Just adopting the PBP wholesale as is rather than trying to debate possibilities simplifies the entire process immensely, and buys you the massive advantage of being able to completely automate the style checking.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-11-19 03:48 am (UTC)(link)
Not quite, from our perspective. While we're moving away from it, slowly but surely, a lot of our pages still use BML, which mostly serve as glorified Perl scripts nowadays. But it does mean that BML files aren't standard Perl files, so they probably wouldn't be automatically checkable.

When the conversion to Template Toolkit is complete, though, we'll be able to do that. :D

[edit: However, even when it's done, bear in mind that there's 10 years' worth of code to change. Perl::Tidy would probably help a lot, but I'm sure there would still be bits that would need checking.]
Edited 2010-11-19 03:50 (UTC)
thorfinn: <user name="seedy_girl"> and <user name="thorfinn"> (Default)

[personal profile] thorfinn 2010-11-19 04:01 am (UTC)(link)
*nod* I don't actually recommend implementing this as any kind of "do the whole lot of code" thing.

Just do it on files that are being changed - and doing it is surprisingly quick and easy. Pipe code through perltidy, which cleanly reformats it for you. Run perlcritic on the code, fix errors until all errors gone. Commit as "cleaned up code". Then start doing the real work. :-)

You're right that BML might be an issue, but as you say, conversion is under way.

I definitely think it would be a good idea to do perltidy/perlcritic as the conversion is happening. :-)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2010-11-17 07:39 pm (UTC)(link)
PODified documentation embedded in each module.
kareila: (Default)

[personal profile] kareila 2010-11-18 05:44 pm (UTC)(link)
There are still some English-stripping bugs open, to get all user-facing text into the translation system.
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2010-11-19 02:26 pm (UTC)(link)
Does breadcrumbing count?
kareila: (Default)

[personal profile] kareila 2010-11-20 03:22 am (UTC)(link)
I just thought of another one: exporting all the changed site strings back into the Mercurial repositories.