(This is copied from the first part of last week’s weekly report. I’ve copied it here since more people may be interested in what it feels like to work in a highly visible open source project.)
I’m halfway through a 3 month contract (a relationship with the WikiMedia Foundation that I hope to continue) and it seems like a good place to write up some of my lessons learned. Too many times I haven’t spent enough time going over my code. Or, when I’m refactoring someone else’s code, I don’t look over it enough. Sometimes this is due to my own inexperience with the MW code base: If I had more experience, I would have a better idea from just looking at the code that dieUsage() was being used incorrectly. Still, experience can be created, and when it is experience you lack, the effort to create experience must be made. This is where testing comes in. More than once while refactoring the UploadChunks api, Tim has just looked at the code and told me I wasn’t testing it properly. The same could be said for more trivial things like whitespace. Mixing whitespace commits with more substantive changes as well as just the way Emacs formats the code by default have irritated other developers. From this experience, I think I need to borrow an idea from Atul_Gawande’s Checklist Manifesto and make — gasp — a checklist. The checklist is the first step, but the second would be automating as much of the checklist as possible and creating a pre-commit hook that I could use to check my own code. From my experience, here are some ideas for a checklist:
- Whitespace use.
- Tabs, not spaces
- avoiding spaces for indention and lining up code
- spaces around parens
- etc.
- Code correctness.
- Ensure each exit point has a test. (Since I prefer to write unit tests for my code, noting a test for each exit point in a code comment would take care of this. An automated check would just verify that the exit point has a notation.)
- Make sure no E_STRICT warnings are thrown during tests
Note that any automation here is going to fail to really enforce anything: it is impossible to verify code-correctness completely without actually running the code. Instead the idea is not to verify that the code is bug-free, but just to make sure that I’ve caught the things that more experienced MW developers aren’t going to roll their eyes at. That said, the number of developers actively working on MW code as well as the CodeReview extension on mediawiki.org make developing MW code an overwhelmingly positive experience. These things mean that — combined with the depth of PHP and MediaWiki knowledge and care that people take — problems see the light of day really quickly. When your code is likely to end up on one of the top-10 sites on the Internet, this amount of care is crucial.
|
Posted by
hexmode |
Categories:
wmf | Tagged:
mediawiki,
open source |
Everyone loves a good apocalypse. Whether that apocalypse is Y2K, 2012, Financial Collapse, Peak Oil, Global Warming, or the being Left Behind, we love being scared. We can take any problem, and make it seem insurmountable and inevitable. In our darker moments, we become fatalistic about it. Before we understood anything about genetics, we saw our fate in the stars, the bumps on our heads, the creases on our hands, or the lay of the the cards. Now that we have genetics, we look at that superstitious thinking and laugh. Instead of saying “It’s in the stars” we say “It’s in my genes.” This apocalyptic fatalism means the end keeps coming — but it ain’t here yet. We live in with visions of impeding doom — What will I do when the oil runs out? when the oceans flood? what if I am left behind? — or we convince ourselves there is nothing to worry about, putting our faith in Man’s ingenuity, assuring ourselves that the science is junk, or simply believing our belief makes us immune. Its a wonder our civilization has kept going for so long — that we haven’t all gone mad already. I suppose its the competing visions of apocalypse that keeps us whole. As long as we don’t all believe the same thing, we can keep asking “Is the end here yet?” And the answer will continue to be “Not yet.”
|
Posted by
hexmode |
Categories:
Uncategorized | Tagged:
apocalypse |
(I went to Haiti in 1987 as a teenager. I’ve been interested in what’s been going on there ever since. My brother asked me what I thought about the most recent disaster. I spent enough time on the reply, that I thought I might share it with a larger audience.) I haven’t really been following what’s been going on. Not closely. Following the news out of Haiti is pretty depressing. Following just one man, Aristide, from 1987 onward gives some idea of the what is happening in Haiti.
- 1987 – My missions team had to leave 2-3 weeks early because of the violence. Aristide, a Roman Catholic priest, is told to stop preaching political sermons and is re-assigned.
- Elections stopped in November 1987 because of violence.
- 1990 – Aristide is elected, endorses “necklacing” (i.e. execution) his opponents
- 1991 – Aristide ousted, ends up in the States.
- 1991-1994 – Aristide embezzle’s money from Haiti’s international telecom revenue.
- 1994-1996 – Aristide leaves the priesthood, marries. With U.S. military help, he is re-instated as president. His term ends in 1996.
- 2000 – Aristide elected with 10% of the populice voting.
- 2004 – Rebellion, Aristide is forced out and ends up in Pretoria, South Africa. (Aristide claims he was kidnapped by the U.S. military although it looks like he would have died had they not shown up.)
Of course, you could easily claim that Aristide is just one corrupt ruler in a line of corrupt rulers. But I think the problem is much deeper than Haiti’s corrupt leadership. Another way to look at Haiti and get an idea of just how bad things were before the earthquake is to look at the border between Haiti and the Dominican Republic. On the west side of the border, where Haiti is, you can see there are fewer trees than on the east side. People in Haiti have been using up the natural resources — in 2007, less than 1% of their forests remained. Which means they end up finding it very hard to produce anything. Two years ago, stories started popping up about people in Haiti resorting to eating clay “cookies”. (Eating dirt isn’t unusual, but making it the primary source of nutrition is.) For as long as I’ve been aware of Haiti, it has been on the brink of disaster. The earthquake is just another disaster on top of the countless ones that came before it. Its amazing how much poverty and political violence and unrest continues to exist in a country just an hour and half flight away from Florida. Of course, this isn’t a problem that money is going to solve. If money solved problems, Haiti would be able to bounce back from this and its other problems really quickly. And we wouldn’t have ongoing “hostilities” in the Congo or Sudan. There wouldn’t be pirates in Somalia. North Korea wouldn’t have concentration camps. So, while the problem in Haiti is systemic, I’d hesitate to over-spiritualize it as, say, Pat Robertson has by claiming this is all because Haiti made a deal with the Devil. And I’d hesitate to say that this earthquake is going to lead to dramatic change in Haiti. It could, true. But any number of the crises in Haiti’s past could have led to dramatic change. I’m mostly frustrated with disaster voyeurism that we in the States seem to delight in. I applaud people who try to do something with their lives to help others. And we even need, to a certain extent, disaster “tourists” who help out whenever there is a disaster. But I’m still frustrated. And part of that is because I have done so little and there is such a great need all over the world for help.
|
Posted by
hexmode |
Categories:
Uncategorized |