Monday, 30 December 2013

How you speak reflects how you think

My good friend Audra pointed me to this list of “20 programming jargons” that is just full of awfulness. First of all—and this is the easy, facile complaint—I’ve never heard any of these terms (at least, with these definitions) used in the wild. Maybe it’s because I’ve generally worked for reasonably grown-up companies where we attempted to act like professionals, but who can say? I don’t quite know why these terms are so foreign to me, but some of them are just bad.

First, the good… or, at least, neutral:

Baklava/Lasagne Code
Okay, this one’s actually kind of good. Lasagne code evokes a particular variety of spaghetti code that got that way by adhering a little too closely to old “enterprise” techniques of organising class responsibilities, and by applying code patterns for the sake of applying code patterns. I’m hesitant to use baklava to describe this phenomenon because (a) baklava’s delicious, (b) there’s too good of a parallel to spaghetti code with lasagne, and (c) it feels like it’s making fun of Muslims, and I just don’t go in for that.
Banana Banana Banana
I’ve never heard of this, that I can recall. As an actor, I’m definitely familiar with rhubarb rhubarb rhubarb, the chorus equivalent of making it look like you’re having a conversation onstage without actually saying anything particularly coherent, that would pull focus.
Claustrocodeia
Can’t say I’m familiar with this term. Granted, I don’t like moving away from my nice 24” screen at the office, and working on my laptop screen, but it’s not like it’s anything more than a minor inconvenience. Get over it. Or buy yourself a big screen and expense it.
Stringly Typed
Again, this one’s pretty good. I’ve seen code like this, and it’s always much more of a headache than it could possibly be worth.

There’s Already A Word For This

Bugfoot
Over here, where the professionals work, we call this an “intermittent bug”. Could be environmental, could be infrastructure, could be code. But while we can’t replicate it, we don’t want to dismiss it out-of-hand, because this also means we can’t gauge its impact on the end user.
Jenga Code
Also known as “tightly coupled”. If you don’t already know this, or for some reason refuse to use this industry standard terminology, I frankly worry for the quality of your code.
Shrug Report
The bug report with insufficient detail. This is just a bad bug report, and should get sent back to the reporter for more details.
Unicorny
Otherwise known as “the business’s problem”. Unless you’re being called in to provide swag work estimates. I’ve also heard this as a “future project”.

Your Professionalism Is Showing

Counterbug
Code review isn’t supposed to be an adversarial process. When another programmer is reviewing your code, this is supposed to be about everyone’s professional development. Your reviewer may learn techniques they weren’t previously familiar with, and will gain exposure to more areas of the codebase, and that’s always a good thing. And by the same token, you’ll have the opportunity to learn techniques you weren’t previously familiar with, because your reviewed may be able to suggest a better (or even just different) way of solving the problem at hand. By saying, “yeah, well, you did this wrong”, you aren’t helping anyone (beyond exposing additional bugs to be fixed).

That said, getting used to code review as a collaborative process, and no longer hearing their comments as a personal attack, takes a conscious effort at first. But it’s effort that’s worth it. So when a reviewer points out an error, you should first bite your tongue, then think about what you can do better the next time around.
Duck
The business is not your enemy. Distracting their attention away from one particular area of the software is staggeringly unprofessional. It suggests that either you didn’t do your job properly there, or you think you know better what the business, or customer, wants. You might. You probably don’t; the business holds all the cards, and knows things they haven’t bothered to tell you, because they didn’t consider it germane to the feature request. If you have an issue with their ideas, the best thing to do is to take it up with them. In the event that they didn’t consider your alternative approach, then you might get them to reconsider their approach, and create an ultimately better product.
Refactoring
There’s a great maxim about how to write software: write code as though the next maintainer is an axe-wielding psychopath who knows where you live. Vivid, I know, and pretty violent, but I think it kind of gets the point across. Another, less aggressive version, describes the next maintainer as someone less capable than you with no context. If you’re writing code, or refactoring, and you don’t leave it in such a state that any developer could read it and know immediately what it does, you’re doing it wrong.

I know, I know; I’ve written before about self-documenting code being a lie. That doesn’t mean your code should be incomprehensible; it’s about not eschewing documenting your classes at a high level, simply because another developer need only read the code to understand it. Being a nice person to the next person is what self-documenting code is supposed to be about.
Smug Report
I’ll be the first to admit that I’m guilty of having this reaction to an external bug report that suggests that the reporter knows more about what’s going on than the developer. I’ll also cop to the reality that I’ve probably filed a few of these bug reports, as well. However, instead of going into adversarial mode, or trying to belittle the reporter, acknowledge something: you probably have a particularly technically competent reporter on your hands. If they’re outside your organisation, then you basically have someone who will do free testing for you! Make use of this reality, because you have someone on your level, who you probably wouldn’t have to work very hard to convince to do black-box testing. These reporters are gifts in human form.

Unfortunately, there are some that betray an awful interpersonal culture. Presented in no particular order, and certainly not the original order:

Being A Good Person: You’re Doing It Wrong

Jimmy
This, frankly, reads more like an in-joke at one particular organisation. Probably Jimmy was a wet-behind-the-ears recent graduate who managed to get past the interview, only to flail wildly until he was put out of the rest of the team’s misery. It happens sometimes. It’s unfortunate for Jimmy that no one on his team was willing to mentor him into a good programmer, but if the rest of the list was written at the same company, there probably weren’t many qualified candidates.

Not to say that professionals don’t turn colleagues’ names into in-jokes. Never mind that at the foosball table, I can think of at least four developers whose names are used to describe particular moves, one of our developers was, due to a fluke of seating assignments, regularly forgotten to be pulled into impromptu meetings. He’s now a verb, used when something (or, more typically, someone) is carelessly forgotten. However, this is done (a) in jest, and (b) is aimed squarely at the forgetter, not the forgettee. Poor guy just got it named after him after we did it so often that we started using his name as a shorthand for “we forgot him!’

So why is it unfair to call the clueless newbie a Jimmy? Because it pokes fun at the clueless newbie for being just that. Instead of mocking the new kid, they should be welcomed with open arms and guided into being a better developer.
Chug/Drug Report
Yes, suggest that the bug reporter was, at best, in an altered mental state when they wrote the report. This seems fair. Or, you could be working with a language barrier. Perhaps two, depending on when you, as the reader of the bug report, learned the language it’s written in. Assume that the reporter did their best to convey what they encountered, and give them the benefit of the doubt.
Mad Girlfriend Bug
First of all, this kind of bug is pretty much any bug that isn’t completely straightforward. Second of all, this is an idiotic gender stereotype. If you aren’t willing to try to communicate with your signficant other when you’re having an argument, your miserable relationship is your own problem. Finally, reinforcing idiotic gender stereotypes in the workplace is just one of the reasons that the gender balance both in the workforce and in school is so completely out to lunch. It’s one of the reasons that twice as many women as men exit programming as a profession. It creates a hostile work environment for your peers. Don’t do this.
Barack Obama
This one feels vaguely racist, and the fact that it’s the editors’s favourite, of everything on the list, gives a certain amount of credence to my worry in this regard. I want this to be a joke about Healthcare.gov, or about how a lot of liberal people had a lot of hope which has been repeatedly dashed, but the bit about “which would not otherwise get approval” bears a pretty strong suggestion that African Americans only voted for Obama because of the colour of his skin… and that just a reference of questionable future usefulness into a racist joke.
Ghetto Code
While I was simply wondering if the Obama project account was racist, this one pretty obviously is. Inelegant code is just that. Inelegant, perhaps sloppy. Tightly coupled. Not cohesive. Spaghetti code. With so many descriptors for code that isn’t elegant available… why on Earth would you go for the one that takes advantage of a marginalised group of people? Other than the obvious explanation that you almost certainly grew up in a life of privilege, with no idea of what it’s like to live in a ghetto. Bear in mind that the word ghetto was first used to refer to the quarters of the European cities where Jews were effectively obligated to live, because the Christians in power viewed the Jews as something less than themselves. Ghettos are areas of both crippling poverty and, at least once (if not still), systematic oppression. Your inelegant code is not described by this. Just stop using this word entirely.

As a profession, we get a lot of flak for how we treat people who don’t look like us… and I can’t say it isn’t well-earned. By adopting, using, and promoting language like this, all we’re doing is saying that we think it’s okay to do exactly that. It isn’t. So other than the two phrases up at the top… this stuff all has to go. The writers and editors at EFY Times who wrote and approved this list should give some serious consideration to what they’re really saying when they publish lists like this.

Tuesday, 3 September 2013

Abusing dependency injection for fun and profit!

Using Spring for dependency injection can do a lot more than just put together your singleton services how you need them, optionally tweaking them for different environments based on a configuration file.

Oh, the DI in Spring can do so much more fun than just that.

Let’s say, just as a “hypothetical” example, that you’re working with a controller and service interface in a prepackaged JAR that you either can’t modify, or would have to go through a far amount of headache to change. Specifically, you’re implementing the service interface, and you know it will be called from the controller.

You take on a new task that requires access to the HttpServletRequest. Okay, you think, I’ll just get it from the FacesContext, until you remember that this module isn’t using JSF (and you can’t make it—not your controller, remember?). You can read the controller source and see that the method that’s calling your service uses the HttpServletRequest, but it’s not a parameter on the service method.

Barring modifying the JAR, there’s a surprising, and easy, way to get at it: inject it. I kid you not, this works.

That’s seriously all there is to it. You can inject anything higher on the call stack, though I suspect there needs to be only one instance of it. The HttpServletRequest gets updated with each request, even though MyService has been left in the default singleton scope. I wouldn’t recommend doing this simply because you can, though, for the sake of not having to pass the HttpServletRequest as a parameter. Injection breeds reflection, which is a crapton more logic, processing time, and memory usage, than simply passing a reference down the call stack. It also opens you up to debugging hell, particularly if you inject something that you then modify.

Use this with care, is what I’m saying, only when you have no other choice.

Thursday, 29 August 2013

An unfit culture

Yesterday afternoon, Nitasha Tiku published a piece on Valleywag, entitled This Is Why There Aren’t Enough Women In Tech. It’s eye-opening reading, even for me (and I consider myself at least somewhat awake to the terrible ways in which women are treated in this industry). Go ahead, read it. I’ll be here. I’ve got a Scotch to keep me company. Read Shanley Kane’s February article and Ciara Byrne’s followup interview with Kane, while you’re there.

Read them? Good.

Assuming you’re a cis man… still feel good about yourself, and the developer culture in the office you work in? I hope not. Because if you’ve ever sat an interview, and were asked afterward about “cultural fit”, you’ve been on the edge of this problem. And the problem, as Kane puts it so eloquently over at Pretty Little State Machine, is that cultural fit is “a loosely coordinated social policy to ensure homogeneity in our workforce.” Cultural fit is a catch-all way of rejecting otherwise perfectly suitable job applicants, without having to flat out say that it’s because they don’t have a similar cultural background.

This also introduces design problems in your product. No, seriously. Hiring with a view to cultural fit ensures that your entire development team thinks similarly—and approaches problems similarly, allowing for slight differences in experience with the tools in use and with others. You could get an entire team of programmers who would write, structurally, almost the same code, just with different variable names. You might say, "great minds think alike," but I would suggest that fools seldom differ. Then. if you hire one person who is eminently qualified, and is largely unlike the rest of your staff (e.g. outspoken about what’s shit code and will just fix it, as opposed to the various forms of introversion you stereotypically see in programmers), you see not only significant structural differences in coding styles, but this also helps your entire team evolve as programmers. Instead of everyone already writing according to an unspoken code style, there’s discourse, improvement, and a gradual winnowing away of the chaff.

But enough about how cultural fit damages your codebase.

Cultural fit damages developer culture, and society as a whole. Reading through the anecdotes in Valleywag, I’ve seen hints of this attitude in virtually every office I’ve worked in, since I started working. My computer science program was, as in so many others, overwhelmingly dominated by men. The few women who started, and made it through the three years that I was there full-time, were either as naturally talented as some of the men, or struggled every day with it. And I can’t imagine it was made easy for any of them by the men, who alternately accused them of following their boyfriends into the program or buying answers, and incessantly hit on them.

I’ve said it before, and I’ll say it again, because it seems like every week I see another example of it: the tech industry, by and large, is an industry made up of little boys who were hurt over and over again, and never learned anything but how to hurt. They were rejected and hurt by their peers growing up, formed a tribe of comrade rejects, and grew to fear outside interest. When they were young, outsiders becoming interested in them led to pain, but now they have the means to reject and hurt those who rejected and hurt them. The bullied have become the bullies.

These hurting little boys grew up in a society of intense white male privilege. One where, even in 2003 when I began my degree, there were jokes that the women taking B.Comm. were really just being there for their “MRS”. One where the University of Waterloo was “jokingly” called the University of Waterwoo, on account of the high concentration of Asian students in the Math and Computer Science programs—almost as though they were displacing the rightful seats of (might I add, white) Ontario-raised students. A culture where, I hate to admit, I participated in jokes about final exams being either the perpetrators or victims of rape.

So these little boys, already distrustful of new people becoming interested in their interests, were raised to further distrust the motives of those others. And now that they’re creating tech companies, and doing the hiring, they’re applying that distrust to their staffing procedures, and keeping out everyone who doesn’t already think like them.

I’ve heard stories from colleagues—women who were interested in computers but hadn’t had the opportunity to try programming until they entered university—of being disregarded by the men in their program who had grown up in front of a keyboard and a CRT. That they were somehow inferior because, for whatever reason, they didn’t have the same opportunities growing up. The same men who, invariably, would describe developer culture as a welcoming meritocracy, where intelligence is fostered and output alone determines your worth. The same men who, on Slashdot (and later, Reddit) would, after receiving comments of “STFU, n00b” from their elders for asking naïve questions, would turn around and do the same to those who had naïve questions for them. A welcoming meritocracy, my ass.

Cultural fit is little more than code for “were you bullied as a kid for like computers and D&D,” when you get down it. It’s shorthand for decades of similar experiences of pain, and a similar unconscious desire to mete it out on the new kids. And it has to stop. We have to begin the difficult process of evolving past the pain and refusing to inflict it on others. Instead of demanding that people fit into our culture, we have to extend the olive branch to other cultures, and modes of thinking, and creating a brave new world where the meritocracy that we claim to exist is actually present. In private, we used to assure ourselves that, when we got older, the bullies would be working for us in the new knowledge economy. That knowledge economy seems to be here, but all the old rules of proving who’s got the bigger dick seem to still in force.

So to anyone and everyone reading who sits an interview, I call you to reject cultural fit, and reject old ways of thinking, and help create the meritocracy and the culture we all wanted our community to be.

Saturday, 17 August 2013

The only limitation has been in your mind

A few days ago, Infinity Ward announced that the upcoming Call Of Duty: Ghosts would provide an option for players to inhabit the online mode of the game either male or female characters. Finally! About 14% of US Army personnel are women, and women are further underrepresented in Xbox and PlayStation users at 10%, and Infinite Ward has joined the ranks of enlightened game publishers, like BioWare, who recognise that they ought to reach out to all their customer demographics, not just the biggest one, because it's the right thing to do, even if they are a bit late to the party (2013, guys).

Right?

I want to believe that, really I do. The only problem is that producer Mark Rubin has gone on record explaining that the reason that CoD has never before offered women as playable characters was a technical limitation in the engine. Memory and processing requirements have, until now, been far too significant to provide players with the option of using multiple meshes in online play.

I might be able to believe that, if this were, I don't know... 1996. If I'd never played Quake 3 Arena on a sub-1-GHz system, which comes stock with a wide variety of meshes, and provdes players with the option of installing their own meshes, which would be seen by all players in the arena, all over the world. If I didn't own a copy of Halo 2, which allows players to appear on Xbox Live as either a Spartan or a Covenant Elite. If there wasn't a wealth of evidence supporting the fact that the technology has been out there to do exactly that for almost two decades.

Mark, if your engine can't handle showing characters with two different meshes in this day and age, on modern hardware, you are simply using the wrong engine, or you are abhorrently misusing it. But I find that hard to believe; if your engine was as shitty as it would have to be for your excuse to be realistic, then the Call of Duty franchise wouldn't be remotely as popular as it is.

Just admit it, Infinity Ward. You haven't offered women as playable characters because you didn't consider them a sufficient demographic to justify the expense of creating a second mesh (which, incidentally, would have been... What? 10K? 20? And what's your budget on these games?). You'll feel better, because you can also admit that you've been doing the wrong thing, and you want to make it up to the devoted women who play your games. That you want to encourage more women to play your games (because why wouldn't you? At 51% of the population, it's a huge market). That women deserve a hell of a lot better than the shit they receive from both the gaming industry and community, each and every day they play the games they love to play.

Anything other than the most bullshit copout to (dis)grace my screen in the last several months.

Monday, 10 June 2013

E3, or, Seventy-two hours of misogyny

After lunch most days, before returning to work, I typically take a few minutes’ break to catch up with Reddit and Twitter, to see if any of my friends have said anything funny or interesting today, or maybe there’s an programming-related article I can share with my colleagues. However, today, my Twitter feed had this waiting for me, courtesy of a retweet from @lindsaybieda:

My immediate reaction was not unlike Gollum’s, when Sméagol tells him in the film of The Two Towers, “Master looks after us now. We don’t need you any more.”… what?

Now, I knew going into this that E3 is a ridiculous three-day-long display of sexism, objectification, and misogyny (oh, and something about video games, too). Last year, Scott R Kurtz had a character deliver a webcast from “either E3, or the world’s largest Hooters.” I have privately, among my friends, and probably publicly, too, lamented every marketing department’s decision to hire booth babes for a conference—to use women as little more than decoration and furniture— and I’ve written before about the technology industry’s rampant misogyny. It's not as though I didn’t at least somewhat expect the result of what I did next.

I ran a Twitter search for “#E3 Bonnie Ross”—just that—and was promptly given a feed full of complaints about the new Halo, pleas for 343 Industries not to mess it up… and a litany of tweets about Bonnie Ross: how good she looks, how inept she (apparently) was as a presenter, and multiple people explaining in sometimes graphic details that they want to have sex with her. In particular, @Boogie2988’s gem (since, it seems, deleted):

I can’t believe that I have to ask this, but where the fuck do these guys get off, thinking that this shit is okay to suggest, let alone think?! Bonnie Ross is not the studio head of 343 Industries for you to cat-call, or to ask for sexual favours from. She is there to do a job, and judging by the Halo sales, she seems to be doing a pretty good one at that. If you think she’s a dull presenter, fine (during the BB10 launch, I described BlackBerry CEO Thorsten Hiens as having “all the personality of a wet dishrag”), but for God’s sake, can a woman, for once, show up at E3 and be treated with some basic human respect? Is that so hard, guys? Maybe, you know, not call her a MILF. Perhaps not suggest that “that bitch had to have skipped speech class.”

I went on a bit of a tear on Twitter, quote-tweeting and retweeting some of the more egregious offenders, because you know what? I am sick to death of the way that men in my industry talk about women, whether they’re presenting for their favourite console, or the speaker’s colleagues and peers. I would really like to think that, in this day and age, we were raised better than that, but, clearly, this isn’t the case:

I’m a little proud of eliciting “let’s care more than we should” as a hashtag; it really demonstrates the work that still needs to be done. And I have to say, I haven’t been challenged to a fight since Grade 9, so well done over there, too. However, one of the guys I quote-tweeted (the one who made the crack about speech class) got back to me and we had this conversation. It’s too long to embed without messing around with Storify, but I broke it down for this guy that, basically, what you say on Twitter is open for public critique (and I was just criticising his statement, not his character) but his closing statement, “I was in a casual context, speaking with kids just out of high school who couldn’t care less about semantics,” really reminded me, despite all the fucked-up things that have happened this year, that kids today still need to be taught this.

I’m sure he and his friends couldn’t care less about the semantics of what they’re saying, but the reality of the situation is that we need them to. Just as we, as adults and parents and nurturers and teachers, need to teach them to care. We need to carefully teach the younger generations about respect, and about the hidden messages they may not realise they’re delivering when they use certain words. We need to not only self-correct, and demonstrate the right behaviour; we need to call out the wrong behaviour in others. They may not realise what they’re doing, but that doesn’t mean they shouldn’t be taken to task for it. After all, not knowing that, in this particular jurisdiction, you can’t turn right on a red light doesn’t mean the traffic police are going to let you off the hook.

To make this abundantly clear, if you were one of the guys who decided to judge Bonnie Ross’ ability or competence based on her appearance or gender, or you made—or laughed at—jokes about her, using language specifically reserved for insulting women, you are part of the problem. You are holding back the human race from evolving beyond prejudice, beyond hatred, and beyond unwarranted fear. And I refuse to stand idly by and watch you do it.

Wednesday, 24 April 2013

On the definitions of terms

This morning, on my walk to work, saw a tweet in my feed mentioning a new service built on BitTorrent, called BitTorrent Sync. Fully encrypted, the blogger in question called it “Dropbox without the cloud”.

I just about tripped over my own feet.

The term “cloud” has very specific semantics in networking and computing, and it annoys me more every time I see it misused to sell something. There couldn’t possibly be a more cloud-like implementation of cloud storage than by using BitTorrent. By distributing the data all across the cloud, you really are just dropping your bits on the cloud, and picking them up later.

The Cloud, quite simply, any and all of the networks you connect to, but don’t control. Most often, network cut sheets use a cloud to represent the Internet as a whole. It’s an opaque region of the ether that may have your systems on the other side, or it might just be used to represent the source of incoming requests to your services. It may also be used to represent the networks between you and a network API with a specific, known endpoint (like, for example, Dropbox!).

Any x-As-A-Service service is fundamentally a cloud service, because it operates on on a network outside of your control. Dropbox is a cloud service. Netflix is, and you’d better believe BitTorrent is, too. Dropbox exists on a readily quantifiable set of servers, but this BitTorrent Sync product isn’t nearly so measurable—your data could literally be anywhere within the cloud.

For the sake of comparison and clarification, what would be a “Dropbox without the cloud”? A local server within your network that provides similar data mirroring. This would likely only ever be useful in an office environment full of thin clients (or tablets) where no one necessarily has the same desk from day to day. This, however, largely doesn’t exist in most office environments. I have a laptop computer at Kijiji that I bring with me when I need to work in a different room, or if I need to travel. And if, for any reason, I can’t bring the computer with me, I can access it through SSH, anywhere within the corporate network. “Dropbox without the cloud”, in our ecosystem of cheap, portable devices is fundamentally meaningless.

So please, if you&rsquo&re selling something, and want to refer to The Cloud, use the term correctly. This industry is one based on precision of language, and “cloud services” is vague enough already, without being used as its own antonym!

Saturday, 13 April 2013

Abandoning commits in Subversion

Before we begin, I don’t normally keep my code in Subversion… any more. When I started at Kijiji, Subversion was our local VCS of choice until there was a organisational decision to switch to Git, and we local developers agreed that it made sense. In the roughly two years since then, I’ve become a total convert. However, I’ve continued to use Subversion for personal projects, simply because I’m the only person working on them, and in case I move from machine to machine, I want to have reasonably quick access to the code.

I have since lived to regret this decision. Despite the fact that Subversion externals work vastly better than Git submodules, there are still some things I can easily do in Git that simply aren't available in Subversion.

One of my favourite things about Git is that, as long as you haven’t shared your repository, you can really mess with history. Step back three commits in the history, branch, write a new commit, then even cherry-pick everything else back on… then reset your HEAD hard, fast-forward, and when you push, it’s like those commits never happened!

You don’t really get that option in Subversion. Since it’s a centralised repository, everything you commit goes off immediately, so good luck getting rid of it for good! So if you realise that your last two commits were completely wrong, what do you do?

Fortunately, you can still branch from your history in Subversion:

$ svn copy http://svn.example.com/project/trunk/@56 http://svn.example.com/project/branches/whoops

Your tree now looks something like this:

--55--56--57--58--59 (trunk)
       \
        \-------------60 (whoops)

Now, everything that was on trunk up to, and including, revision 56, is in the whoops branch. Update your project’s root directory (or check out the branch into a separate directory), and get back to work! Once you’re done, the challenge becomes how to squash everything on trunk since 56. This is disturbingly simple, and only incurs two commits. It sounds dangerous as all hell, but trust me on this.

You’re going to delete trunk.

Only for a second! Since you want to destroy the last few changes on trunk anyway, and replace them with what you’ve done on whoops, this is entirely safe. After deleting trunk and committing, you just move branches/whoops to trunk, commit, and you’re off to the races! The whole process looks like this:

$ cd ~/project/
$ svn copy http://svn.example.com/project/trunk/@56 http://svn.example.com/project/branches/whoops
$ svn update
$ cd branches/whoops/
... work ...
$ cd ~/project/
$ svn rm trunk
$ svn commit
$ svn mv branches/whoops/ trunk/
$ svn commit

And, at the end of the day, you get a tree that looks like this:

--55--56--57--58--59    /-- Branched here
       \               /
        \-------------60--61--62 (trunk)
                          /    \
   Deleted trunk here -- /      \-- Renamed whoops to trunk

If you need to get any of 57, 58, or 59 back, they’ll be visible from the project root. Not remotely gone forever!

And so we see that, even in Subversion, you can achieve a measure of Git-like control of your history. The only difficulty is coordinating with your collaborators, along with the obvious evidence in the history of what you’ve done!

Friday, 29 March 2013

To duck or not to duck

About a week ago, I gave a lunch-and-learn talk at my office on Robert C Martin’s Clean Code—it’s considered “highly suggested” reading in the office, so, as I do when that happens, I read the thing cover to cover. I’m inclined to believe that most, if not all, of the other developers on staff who had been hired by this point did as well, but one of the topics that Martin brings up in his chapter on error handling is whether or not developers should be using checked or unchecked exceptions. Martin comes down on the side of preferring unchecked; there’s no good reason, he says, to use checked exceptions that you have to keep declaring every layer up until you actually catch it—it violates the Open/Closed Principle, and it creates leaky encapsulation.

He’s got a really good point. Having to constantly redeclare your exceptions (or, God forbid, catch and rethrow) is a pain in the ass, unnecessarily exposes your code’s structure, and makes it really difficult to refactor changes to your exceptions (if, of course, you don’t use a magical IDE like IntelliJ IDEA). So there’s certainly some benefit to be gained from preferring unchecked exceptions, both in purely internal code and if you intend to publish an API.

Ultimately, though, I disagree. Unchecked exceptions, to me, should really only be used to handle completely avoidable situations; this is why the stock set of unchecked exceptions in Java includes things like NullPointerException, IllegalArgumentException, and ArrayIndexOutOfBoundsException. An unchecked exception is something that the programmer could, and should, have prevented through better care. As an aside, this is also why I feel ripped off that java.net.URLEncoder.encode() throws a checked exception—the likelihood that the encoding is being specified by anyone other than the programmer is practically zero, so making me catch an UnsupportedEncodingException that will never be thrown is ridiculous:

I also don’t believe that simply switching from extends Exception to extends RuntimeException does anything meaningful in terms of application structure when the catching method is four or five stack frames below the thrower, beyond preventing throws MyException from showing up in your method signatures. If we’re really adhering to the Law of Demeter, writing software on the assumption that a method should only know about the methods of its own variables, of its own class, and of its class’ fields, then most exceptions have no earthly business falling down the stack, particularly across class boundaries. If a method, m, throws an exception, e, then e should be an exceptional circumstance that arose while m was performing its task, not one that arose while m was waiting for a called method in another class to return. I’m willing to grant leniency to private methods, treating the class as a whole with respect to error handling, but simply put, classes should not duck exceptions.

Here’s a facile example:

Clearly, the class designer is a jerk, who deals with NoResultException in the Service but not DatabaseConnectionException.

SomeService knows that there’s a possibility that the call to SomeDao might get rejected if the database connection has failed, because SomeDao declared that this might happen (this is why this is a facile example; any persistence layer worth its salt wouldn’t even throw that), but the getEntities() method is the wrong place to deal with that—it’s really just supposed to be focussed on handling Entitys, not errors. So it says one of two things:

  1. I can’t deal with this; somebody above me will, or
  2. this is crazy enough that the JVM should be able to unceremoniously terminate.

Neither of these options is particularly good. In the second case, application’s users don’t get meaningful error (unless they’re developers), and in the first case, a layer too-far-removed from the database has to deal with the database’s problems. SomeController shouldn’t know that there’s a database, or any kind of socket connection involved at all, when it asks SomeService to getEntities. All SomeController ought to know is that it can call a service that provides a List of Entity instances. That’s it; if something goes wrong in retrieving that List, it shouldn’t be up to the controller to handle that. Realistically, SomeDao should deal wih it, but, like I said earlier, the class designer was a jerk.

This architecture is bad in an extreme way, but it still shows that these classes are tightly coupled. The controller is not only tied to the data-access layer, but to that particular implementation of the data access layer… and all because the service layer ducked the exception, trusting that its caller would handle the problem.

There are certainly less insidious and less ridiculous examples that can be thought of, and probably a lot of counterexamples of occasions when it sort of makes sense to duck across a class boundary. However, I think that these can probably be programmed around with careful (re)architecture that ensures that each class and each method is concerned with doing exactly one thing.

In case you thought this was just about the rules...

Reading up on the wider response to Mackenzie Wilson’s Kickstarter is a really lonely feeling—it seems like the general consensus is that Susan Wilson is a terrible person, possibly a fraudster, ought to have just paid her daughter’s fees, and certainly shouldn’t have used/encouraged her daughter to use Kickstarter to fund it. The more I read, the more I begin to doubt my own point of view, but it’s not out of any sense of actually having been incorrect, but simply that the voices who oppose my viewpoint are incredibly overwhelming.

But then I catch sight of one of the worst of the replies, and I remember just what my viewpoint was.

I’m not passing judgment on the legitimacy of the Kickstarter. I’ve already pointed out that at least one of the arguments against the project itself is clearly unfounded. The fundraising part of the project isn’t even over; if you want to call foul about the project just being about tuition, you really have to wait until it’s clear the finished product—the video game—will never be delivered.

But the active hate and misogyny that’s being unleashed against the Wilsons is, frankly, sickening. Let’s say, just for the sake of argument, that the Kickstarter is an outright scam. The camp doesn’t exist (or Mackenzie isn’t going), and no one will ever see the game or any of the associated swag. Even if that worst-case scenario were, true, it doesn’t change the fact that I want one of those “I code like a girl” mousepads for the office. It doesn’t change the fact that the project is inspiring me to be even more vocal in my support for women in tech.

And it sure doesn’t justify some of these comments. I’ll grant that what’s visible on the Kickstarter thread, as well as the more carefully moderated news articles, is fairly civil. In fact, it’s mostly an argument between various commentors at this point. There’s a great deal of condescension and ad hominem attacks toward Susan, don’t get me wrong, but the actual insults… well, those appear in spades on Reddit. Huffington Post mentions in their coverage that there have been death threats. I grabbed a fairly representative sample. I started out on Kickstarter, then went to Huffington Post, Destructoid, and ended it out on Reddit. Mercifully, I never found the death threats.

What is heartening, however, is this deconstruction of all the arguments against the project, which follows 100% with my line of thinking:

I think some people need a few points clarified.
Point one: This project is not a violation of Kickstarter rules, if you actually read them. According to the KS guidelines:
“A project has a clear goal, like making an album, a book, or a work of art. A project will eventually be completed, and something will be produced by it. A project is not open-ended. Starting a business, for example, does not qualify as a project.”
Mackenzie has proposed a goal of creating a game, and has worked out the project budget based on the training and equipment that will help her do so. Not just for the sake of the training. So clearly, this is not a “fund my life” item.
Point two: the fact that Kenzie is under 18 does not make the project ineligible. According to the KS eligibility guidelines:
“Parents and teachers can launch projects in collaboration with children under 18 only if the adult registers for the Kickstarter and payments accounts and is in charge of running the project itself.”
So, not breaking the rules there either.
Point three: anyone who has been complaining about Susan & Kenzie not ending the project early once the goal was met clearly didn't bother to check this part of the rules:
“If a project reaches its funding goal before time expires, projects continue to accept pledges until the funding deadline. There is no option to end a project early.”
Cancel, yes. End early, no. And really, why should they cancel the whole project just because a few noisy people tell them to? Especially since those same people have already made it clear that they only pledged to be able to post rude, disrespectful and inconsiderate comments, and do not plan to honor their pledges. Perhaps it's worth reviewing what a pledge entails?
Point four: According to the KS Backer Questions section:
“By pledging, you are committing to supporting that person’s project; canceling that commitment is discouraged. If you must cancel, visit the project page and click “Manage Your Pledge.” At the bottom of the next page you’ll see the “Cancel Pledge” button.”
Enough said on that.
Point five: If you are truly still worried about whether this project violates Kickstarter rules, even though they state that projects are reviewed at the start to be sure they meet guidelines, here is what KS says to do:
“If you see a project that you believe violates the Project Guidelines or Terms of Use, the best way to let us know is with the "Report this project" button at the bottom of the project page.”
Funny, I don't see anything in there about faking a pledge in order to post endless comments nagging at the project creator to cancel it, and nagging at backers to cancel pledges.
Point six: because clearly it bears repeating - right below where you need to type in your comment:
“Be respectful and considerate.”
Does anyone need definitions of those terms as well?
And in case anyone is actually wondering:
I am not Susan.
I don't know Susan. Or Mackenzie. But she sounds like a fun kid to know.
I don't plan to cancel my pledge. Because it's a pledge. As in, a promise to support Mackenzie's goal. Not because I desperately wanted to buy a new RPG (though I look forward to seeing what she creates), but because after reading through the project goals & information, and looking at the website for the camp, I felt it was a project worth supporting. I still do.
And if I'm going to be suspicious of anything, it is links to websites that have lots of nasty, hateful information and no actual references except to OTHER websites with nasty, hateful information.
So, please - if you're actually concerned about the project, why not follow the actual Kickstarter policy and contact them directly?
Let's all play nice, shall we?
– Angela Reese

Trigger warning: open misogyny, anti-feminist sentiment, bog-standard MRA bullshit, idle vague threats, comparisons to child prostitution, violent fantasies


  • “This KS was set up by Susan Wilson to cash-in big time USING the dream of her daughter, and by turning it a pseudo-feminist sob story that resonates with naive whiteknights. People fund this KS not because they want the product, they think by throwing money at this KS they fight sexism (when it is actually detrimental to the feminist cause in this case” –Henrik
  • Kenzie is 9 years old and it's against the TOS for someone so young to use this website. The mom is the one in charge of this project and is outing her sons behavior online. To strangers mind you. What kind of parenting is that? She's shaming her own children online and worst of all, profiting off of it!
    The mom is being attacked for multitudes of reasons, all of which are just. Anyone who defends her/supports her behavior is just as guilty as she is for being a scammer/horrible parent.
    Go back to your basement, adults are talking (for the record, white knights never get laid).” –Quellcrist Falconer
  • “I fully expect Susan to go full Anita Sarkeesian now by e-mailing media outlets telling them that she had to take down the Youtube video because of mean comments towards her daughter. That'll skyrocket the amount of money coming to her because internet feminists eat that sort of thing up. It's sad that this is the thing that finally gets me to sign up for Kickstarter which is a great tool for the gaming industry but is getting bogged down by blatantly obvious scams like this. I've been following along at neogaf and a lot of this stuff is just appalling.” –Justin
  • “This was not about it being a worthy cause it was about playing on misandrist hatred of men to make a buck. The bar was set low so that she could pocket all the left over money. She was most likely thinking to clear 100k free with her heinous selling pitch of making her sons demons to get the radical feminist to push her project. As much I like the idea of her scamming non thinking femanazi drone bots its still wrong and should be called out. Let alone the way she is publicly shaming her children over a common children's fight, and for profit at that. This kick-starter is disgusting on so many levels it should make you wretch that this women thought to even try it.
    NO her original paln was to give hats and shirts and mouspads to people. The charity stuff only came when media started to ask questions. She never planned that, it was cause she was getting negative press all the sudden.
    The problem is everything with this project. From how she sold it, to even doing it, to using her children in a disgusting abominable way, without care for the fact she was making her boys out to be monsters with such a charged situation.
    That you cant see that these were wrong speaks volumes about you as a person.” – Brad Donald Lannon
  • “This family is a riot.
    Here's an indiegogo (another kickstarter-like organization) fundraiser from Susan's husband to get his kids off of video games: http://www.indiegogo.com/projects/help-me-get-these-kids-off-video-games-hunting-for-real-treasure?c=home
    Isn't that precious? One fundraiser to get off games, one fundraiser to make them.
    The mother is successful (glorified debt collector) but exploits her children, throws her boys under the bus (PR stunt) under the guise of gender issues. Her daughter has a facebook (violates facebook terms for not being at least 13, but then again this family is no stranger to violating terms) and plays Mature rated games with strong violence sexual themes (great parenting!).
    This family scams. And this article doesn't even scratch the surface of how shady they are.” – Sof Akins
  • “Susan wins. Internet can't win this fight.
    This woman is not an amateur. She knew how to manipulate the system and get all the media attention she needs.
    This is not about the money, it never was. This is about a woman getting tons of media attention and creating a platform to market from in the future. Look at her stretch goal Keep It Up gear. She's playing this for the long haul.
    She's good at it too, she's smart. Who wants to argue against a 9 year old girl? Even KS doesn't want to touch that. Now she gets to look like a hero for women everywhere and a heroic mother.
    She won. I'm sorry internet, we lost this fight.” – frankderr
  • “Wait what? So because you don't know how to raise your children or even control them after you realize you fucked up bad during their adolescence you decide to do this? Judging by every word you have said about your sons it sounds like they should not live with you because you nor your daughter can live with them.” – prettycoolstory
  • “Sadly, if Kickstarter yanks the "project" now, every crazed feminist on the internet will be beating down Kickstarter's doors with torches and pitchforks.” – Ryanne Cross
  • “More to the point, the industry is not sexist, it never has been, the jobs are there for those who want them, men are just sometimes to willing to sacrifice damn everything to achieve it, hell the owner of Obsidian says his resume ratio is 10 men for every 1 women.
    Honestly this whole crap makes it sound like women are being held down in some insane way when women have never had more rights, more than that and like you said, some of the most important positions and jobs in the world are held by women. This whole women in games, women in tech shit is getting really out of hand, its just a tool now for websites desperate for page hits, ironic that much like feminism the message has become distorted as well.” – Kyousuke Nanbu
  • “It's not the point, but she is super duper ugly.” – Phil Hasenkamp, Iowa State U
  • “I wondered who the fark Susan Wilson is, so I clicked to CNN's profile. “Her 10-year-old company finds out where debtors bank, work and own property--and gets 20% of its targets to pay up.” A farking collection agent is one of the most powerful women entrepreneurs. I don't know whether to be afraid of comforted.” – BarkingUnicorn
  • “I'm going to do a kickstarter to fund a marketing campaign to ruin this woman's life. TV ads in her home down, internet ads, etc. At $500 you can help design ads with me.” – m00
  • “I can see her pimping our her daughter to the highest bidder, if the price was right.” – WhippingBoy
  • “saturn badger: And she is a coont.
    I just want to choke this biatch.....” – shortymac
  • “That whore should have never been allowed to squat kinkos.com to make millions.” – FeminismSucks
  • “We have Anita Sarkeesian to thank for these copycats.She demonstrated that there's money in crowdfunding misandry. Now every unemployed feminazi cunt is jumping on the bandwagon.” – stupefyingly
  • “This is sickening. I have never wanted to punch a woman in the face so badly. Not that I would, this lady is just delusional and sexist as hell” – Nimrod41544
  • “This is really an embarrassment to women.
    That gender is the reason why the request received such an enthusiastic response suggests that feminism has succeeded in convincing society that women and girls just don't have what it takes to overcome obstacles facing us on our own... and that a woman who had the mental resources to reach millionaire status felt entitled to use that system instead of funding her own effort to train her daughter in the area of project creation and presentation shows that even some highly successful women aren't completely divorced from the entitlement mentality that abuses the good will of others to fund their lives... taking it even when they don't need the money. How can we expect to be perceived as independent and self-sufficient when people can point to incidents like this?” – oneirosgrip

Like I said, this has been a really lonely feeling, because in order to try to properly understand what’s going on, I’ve had to wade through a whole lot of crap, and the sheer volume of it has left me doubting myself in a few places. I’m glad there are people like Angela who are fighting the good fight.

Tuesday, 26 March 2013

What's wrong with youth interest?

I wanted to write about ducking exceptions and proper coupling tonight. I really did, but I spent all afternoon (while trying to debug an issue with TeamCity) reading about the Internet Hate Parade descending on a nine-year-old’s Kickstarter.

I’m still reading analysis of the shitshow that was Adria Richards’ firing, and then my Twitter firehose starts getting flooded by reports of further asshattery inflicted upon a nine-year-old girl who wants to be a video game developer and her mother. I try not to read the comments when it’s pretty predictable where the threads will go, but I had to read them tonight. I had to find out exactly what was being said; what was being glossed over by the larger media outlets—and I found that it’s unprintable.

So here’s Mackenzie Wilson, a young girl who’s really into role-playing games, Magic: The Gathering, video games, and wants to learn more about how make them herself. Her brothers, like so many other men, have been shitting all over her abilities and intelligence (though, just to play Devil’s Advocate, I recall how much my own older brother did this to me simply because he was older than me). The Kickstarter is asking for enough money to cover her fees at a game-making camp put on by Towson University, and promises a copy of the game to anyone who kicks in more than $10. The original aim was just the $829 single-week fee (which, I might add, doesn’t include the $519 overnight fee), and as of the time I’m writing this, has already come up with $21 910, since the evening of 20 March. Six days, and she can now afford to go to camp all summer, and then some.

The Internet Hate Brigade has descended on this kid and her mother. Between calls to report the project to Kickstarter (which are going unheeded; her mother has said in a couple of updates that the project has Kickstarter’s full support), the following points are being trotted out to fuel the fire:

  • Kickstarter doesn’t permit “pay my tuition” projects.
  • Her mother is, allegedly, a multimillionaire serial entrepreneur who chills out with Warren Buffett and periodically buys $1500 pairs of shoes, and shouldn’t be asking for money to pay for her kid’s camping trip
  • Her mother has been spamming Twitter with retweet requests (this is actually verifiable)
  • There’s no explanation of what will happen with the overflow.

Of those four points, only the Twitter one is actually, specifically, against Kickstarter’s Terms of Service. The first is kind of academic, I feel—the project is clearly titled, “9 Year Old Building an RPG to Prove Her Brothers Wrong!” When you create a Kickstarter project with a given target, you’re estimating what your costs are. In this case, she knew exactly what her costs would be, and clearly declared what they were. Is it going to tuition? Yup. But if you created a Kickstarter for a project, and knew you’d need to learn some more to pull it off, surely you could use the funding to pay for textbooks, as long as there’s a finished product at the end of it… which there will be in this case.

The second point is a series of allegations that have either all been disproven (Warren Buffett photo was a photo op at a meet-and-greet thing, and the shoes were purchased with roulette winnings) or don’t really hold water against reasoned consideration—being a serial entrepreneur doesn’t mean you have a huge bank account; just that you enjoy the thrill of starting something from scratch and are comfortable taking the inherent risks. As to whether or not she should be helping her daughter create a Kickstarter project… what would her daughter learn if everything she asked for, she got? Instead, her mother is teaching her 21st-century entrepreneurship—come up with a cool idea, go to where microinvestors hang out, talk it up, and see what sticks! This is fantastic!

As to the eventual fate of the overflow money, I have two things to say: first of all, there are a collection of material items you can get for different contribution values, and these material goods have costs. So some of the money will go to this overhead. Second, when you give money to any other Kickstarter that has a given target, and it blows past the original target, do you ask for your money back? Hell no, you understand that it will go to the project runners, to be used for the project. Now this girl has the option to not only learn more about video game design, but also, maybe, pay for professional artists and musicians. Who knows? Maybe it will seed her college fund.

But none of this has been considered by the boys’ club that can’t stand that people want in. Everybody seems to be intent on shutting this girl’s dream down, to what end? I’m sure the most likely justification would be something about “honesty” and “fairness”, but Goddamn it, she has been honest, she’s really not breaking the rules, and the way that the software community treats women is anything but fair. Here’s a girl who’s really keen on a lot of traditionally geeky things, and even though $22K is a pretty cool incentive, the words that have been sent her way are by far the cruelest she’ll have to face until she gets interested in sex (at which point, of course, the full force of our misogynist culture will come to bear on her). If you want to encourage kids to get interested in technology, this isn’t the way to do it.

There’s a cynical part of me that wonders what the response would have been if, all else being equal, it had been her father’s Kickstarter account instead of her mother’s, and if Mackenzie had been a boy. I wonder if the project would have faced nearly the same kind of invective and abuse. While I’m not a psychic, somehow I doubt if there were more boys involved, the Internet wouldn’t be shitting nearly so hard on the project.