Battery Powered

Programmers need to know their English

March 30, 2009 · Leave a Comment

Jeff Atwood over at Coding Horror was concerned about how english was language de lingua franca in the world of programming. To be honest this notion doesn’t bother me and I’m a non-native english speaker. It can be rather puzzling standing point for people that are not in the programming biz.

I do believe that if you’re calling yourself a programmer and can’t read english documentation then you’re hardly a programmer at all. There are several reasons why the use of english shouldn’t bother us a lot however they are all an equal hurdle for beginning programmers:

  • Most programming languages use english keywords in their syntax. 
  • Most useful documentation is available in english and even if they are translated a lot of the technical jargong is still in english.

If you manage to learn english, I can vouch for that you are smart enough to learn programming. It was because of computer games that I started to actively learn english and this was long before I started coding. In the 80’s the games were all in english. The only exception to this rule was that instruction manuals were translated… but who reads those things anyway? As a small kid I learnt playing games by doing instead of reading manuals. This rule still applies for anything I do, even when programming I do so by trying. Back when I was a small brat learning english I also had the help of passive language acquisition through the constant bombardement of american and british tv-shows. These shows were airing in the national tv station and later also in the 90’s cable tv stations. The tv-shows were subtitled rather than having an audio dub because Scandinavians weren’t big enough of a market to warrant an audio dub at the time. This has been a contributing factor why scandinavians are so exceptionally good at english in relation to other european countries. Not everyone in Sweden knows english, but a substantial amount of people do.

When I started programming I did ponder to use my native language in my code by exactly the same reasons that the DDD guys would say about using native language when choosing names in your problem domain. However back in the 90’s when I tried this the Swedish alphabet include characters that doesn’t fit the standard ASCII-table and the use of such characters in code led to a myriad of problems both in compile time and in run time. In the end I shunned the idea since mixing english keywords with non-english wordings on classes and variables didn’t make sense to me. It still doesn’t make sense to me. I always translate the word for class names into english instead. Anything that I write in source code is english to the best of my abilities. The only exception would be to use it in declarative programming language that use the native language in their keywords.

So for any beginning programmers out there, embrace english in every way possible.

→ Leave a CommentCategories: dev
Tagged: , ,

The Collective of Chauvinistic Hypocrites (or How Stack Overflow Ruined My Day)

September 23, 2008 · Leave a Comment

Since the private beta, I’ve been a member of the StackOverflow site. A perfect place for me to quench my thirst of knowledge by asking programming related questions and help others by answering theirs. One of its key objective is to be nice and keeping the site on topic, i.e. programming topics. Today however I was unfortunate to find out the hard way how it is to be on the wrong side of the fence in this particular collective of programmers. If something my experience has taught me, it is to not let wrongdoings go. Even one person has said it with his infinite wisdom in these matters:

History will have to record that the greatest tragedy of this period of social transition was not the strident clamor of the bad people, but the appalling silence of the good people. 
Martin Luther King, Jr.

Together with my own curiosity I didn’t want to stay silent and for that I’ve been battered, tarred and feathered. I could’ve been beating my pillow at this point, but instead I’ve written this post about it. This is my story about how this ordeal happened. Earlier today I read a very interesting question:

Which female programmer do you admire most, and why?

Do you know any female programmers? I don’t know that many public figure female programmers so I was interested to know that myself. Unfortunately, the question was downvoted and closed. This was wrong, so I tried it writing the question myself and be more specific about it:

The programmer workforce is predominantly male. A fact I find to be ironic because the first programmer is known to be Ada Lovelace, who wrote for Babbage’s yet-to-be-built machine. Also in the days of the birth of the “modern” computer a lot of women were programming for von Neumann.

So in order to raise Stackoverflowians awareness of women in computing, have you met any women in programming and how was the experience?

Little did I know that I opened a can of worms… or what us boys refer to as “cooties”:

Picture of a box of Cooties, taken by titge

OMG COOTIES!

Maybe I asked it wrong, I don’t know, but the response I’ve got from fellow StackOverflowians hasn’t been a very positive one. If I was fresh conscript of Stack Overflow, it would all seem like these programmers do not like to have questions about women. It would seem as if these female specimen that I was speaking of were filled with an imaginary bacteria dangerous to the Stack Overflow community. I’ll address the criticism I had here… lets start out with the case of sexism.

It is hard to understand what this criticism was about since the critics didn’t bother to explain why it was so. They assumed that I wrote exclusively to be a sexistic troll:

I’d like to point out that this ‘question’ is sexist. PintSizedCat

But I have to disagree because I didn’t write anything in my question that was demeaning about either of the sexes. In fact some of the most influential people that I met and had huge impact to my own professional work are women. I just wanted to know more about women programmers because I wished to know more about them, but clearly nobody in the programming community wants to talk about it.

Fortunately I wasn’t the only one who thought there was bad logic behind the criticism and some SO users summed that up well such as Sara Chipps and this fellow:

The question mentions sex (as in male/female), but is in no way offensive or sexist. Have people forgotten men and women are different. This isn’t sexists… if it was, so is the olympics because women and men compete speparately.
Scott Langham

Here is the deal, if you close down a topic because it was about women you effectively send out a discriminating message that women are not welcome in this forum. That in itself is a male chauvinistic act. So who is the sexist now?

The other half of the criticism is that Stackoverflow is only for programmers doing programming things and thusly was off-topic:

[This question is] just completely off-topic for what most people think this site is for: mainly asking and answering questions directly related to programming. Not discussions/polls about programming culture.
 p5ycho_p3nguin

Unfortunately this statement is complete hypocrisy because there are several questions in StackOverflow that have evolved into pure discussion threads. Don’t believe me? Here is a list of threads falling under discussions about programming culture.

…and the list goes on and on.

Think about it, what message do these SO members send to others? That it is okay to deny threads about women who program but accept threads about men who do the same? Do you know what that smells like? It smells like we, the Stack Overflow community, are just a bunch of chauvinistic hipocrites.

I don’t know about you, but I can’t stand by such an informal policy because what happened in this case is a dysfunctional behaviour. In this community I want all programming people, like me, to ask their honest questions and get clear answers. Start answering the questions instead of becoming evil by bantering the people behind the questions.

Be nice!

→ Leave a CommentCategories: Uncategorized
Tagged:

Ganymede’s Auto Completion Sure Seems Broken

August 8, 2008 · 4 Comments

So I was using the latest version of Eclipse, dubbed Ganymede, and right of the bat as I was hacking some Java code I noticed that something was missing. Actually a whole list of things went missing after I hit the usual ultra Ctrl+Space combo. For some odd reason the code completion lists were completely empty. I hit up google for an answer and there were almost no posts whatsoever about this issue.

It seems that by default the most of the code completion settings were turned off. The simple fix is to just turn them on again:

  1. Go to Window -> Settings in the menu.
  2. Type in “Completion” in the filter field or browse to the Java / Editor / Content Assist / Advanced part of the settings.
  3. Now turn all those buggers on by checking them:
  4. And it should work now.

I’m still trying to figure out why the eclipse developers have changed the defaults. Was Content Assist getting way too processing intensive? Faster computer components is much cheaper than the added labour needed to cope with productivity issues. What even puzzles me more is that not many seemed to adress this highly annoying issue of changed defaults.

Well… it does have a fashionably simple fix.

→ 4 CommentsCategories: dev
Tagged: , ,

Deploying a Git Repository Server in Ubuntu

July 4, 2008 · 2 Comments

Git is a wonderful source code management tool. I’ve been using it now for some weeks of development and I felt ready to deploy my very own repository out on the intarwebs. While there is a lot of documentation available for using git there is also remarkably very little written about the minefield of caveats that is git and Ubuntu. I’ve been trying to create a repository on the server for almost a day until I caved in and resorted to asking people how they did it.

There is currently more than a year old issue on ubuntu, where installing git-daemon-run package clearly does not work. The dependency to runit, which is configured in a rather wrong way, breaks the installation. Unfortunately for us, that means we need to create our own init script that starts up the git-deamon as a service.

As I aim to rectify the situation, let me tell you of a way on how to correctly install a git repo server on a ubuntu machine step-by-step. We need to do the following:

  1. Install gitosis. An easy to use repo manager.
  2. Create an init-file for git-deaemon.
  3. Profit… or maybe not.

What are we waiting for? Let’s get crackin’!

Installing gitosis

Gitosis is a python program that can manage bare git repositories with easy configuration. It also provides some support for git-daemon and gitweb, making the necessary configuration on the repos. The program is fairly easy and straight-forward to install on ubuntu. In fact I did the steps described in this blog post. So I’ll just write a short hand version of that post here. First make sure you have python setup tools installed:

sudo apt-get install python-setuptools

Then grab gitosis by cloning it from original source and into a fresh new workspace. After that we’ll install it.

cd ~ && mkdir src && src
git clone git://eagain.net/gitosis.git
cd gitosis
python setup.py install

Next make a git user that will manage the git repositories.

sudo adduser \
    --system \
    --shell /bin/sh \
    --gecos 'git version control' \
    --group \
    --disabled-password \
    --home /home/git \
    git

Next copy your public key, i.e the rsa_id.pub file, to the server (e.g. with SCP or something) and add it to the list of authorized keys.

scp <location of id_rsa.pub-file>/tmp
sudo -H -u git gitosis-init < /tmp/id_rsa.pub

Now lets check out the configuration (it is ingeniously stored as a repository of its own in gitosis) and edit it a bit.

git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git
cd gitosis-admin
sudoedit gitosis.conf

You can add custom development groups that can read and write to repositories. For now, just specify a new project and let your user account be the member of that group.

[group test]
members = jdoe@email.com
writeable = test_project
daemon = yes

When the file is saved, and committed to the repository…

commit -a -m "Added group test and test_project in group test."

… then gitosis will create a bare repository automatically. The last parameter, daemon, specifies that git-daemon is free to show the repo in question. So lets try that out:

sudo -u git git-daemon --base-path=/home/git/repositories/ --export-all

You should now be able to access the repository in your local machine such as cloning the project. If you have a firewall, it might be a good idea to port forward the git port to the server. The default port in question is 9418.

Making git-daemon submit to our desires

All is fine and dandy now but the fancy part is making git-daemon run as a service in Ubuntu. As noted earlier if you tried installing the git-daemon-run package you will notice that it won’t work. Instead we’ll have to write our own damn init script. So lets start with creating the right file for the init script at /etc/init.d/git-daemon.

sudo edit /etc/init.d/git-daemon

And paste the following script at this pastie link (thanks to fujin on #git @ Freenode IRC for providing the pastie). But change the DAEMON_OPTS line so it includes the correct base-path and export-all attributes, like this:

DAEMON_OPTS="--base-path=/home/git/repositories --verbose --syslog
--detach --pid-file=$PIDFILE --user=git --group=nogroup --export-all"

All that is left is to change modes and run the darn service.

sudo chmod +x /etc/init.d/git-daemon
sudo invoke-rc.d git-daemon start

You should now be able to do your git stuff with your server at a git://yourserver/your_repo.git addy. I hope this has helped you out to run your very own git repository server.

→ 2 CommentsCategories: dev
Tagged: , , ,

Howto: Alias in Ubuntu (or I CAN HAS ALIAS)

June 13, 2008 · Leave a Comment

When you found this blog post you were probably fed up with repeating some really difficult-to-write commands. You’ve probably heard of this alias command from somewhere and decided to look it up on your favorite search engine. Look no further my good man… or woman… because I will tell all you will need in few minutes of your time. The basic command for binding one new command to replace the old one looks like this:

alias new_command='old_command'

Just typing alias into your shell will list all bindings available for you. If you have Ubuntu like me, the default output should look like this:

$ alias
alias ls='ls --color=auto'

As an example, let us amend on what a windows admin geek griefs about the most when using linux. We’ll bind the well known windows dir command with the common one that your linux computer uses.

$ alias dir='ls'

Whenever you type in dir the bash shell will look up the alias and execute the old command. But because you who are most likely a wannabe Linux geek who wants to phase out of the windows world we’ll remove that stupid binding and test it:

$ ualias dir
$ dir
bash: dir: command not found

The binding should now be removed and your bash shell should not know what the command dir is. Whenever you’re binding useful commands and you restart your shell, the bindings will reset. In order to retain the changes you’ll need to edit your bashrc file and add the commands there. If you have Ubuntu like me you might want to do the following. Go to your home directory and fire up your favorite editor.

$ cd ~
$ nano .bashrc

Further down the file you will find the alias definitions and there you will find a commented if-statement. The default configuration suggests you add your bindings to the bash_aliases file. So let us first uncomment those lines like this:

# Alias definitions.
# ...
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Save, exit and start editing the bash_aliases file which will most likely be a new file.

$ nano .bash_aliases

And add your bindings in that file. So now you know how to add alias definitions and change your bash configuration to retain them. Of course you can do some really funny meowy things with this:

I can has Sudo!

The primary reason for me to write this blog post is because during an IRC chat I found out about a unix geek who bound some lolcat commands. Such as the:

alias plz=sudo

The power of this alias binding is in it’s innocently intrinsic humor:

$ plz adduser Cat
$ plz umount kittypictures

I’m pretty sure that you can invent some much more funny alias bindings yourself.

→ Leave a CommentCategories: dev
Tagged: , , , ,

Shaking Booty with Wii Fit

June 5, 2008 · Leave a Comment

I may be sexist to agree with the following video clip that the only reason for guys to buy a Wii Fit is to see your girlfriend shake her booty. This strikes me also as an interesting example of word of mouth marketing. Accidental, yet funny as heck to be passed around to other guys on the Internet who find this equally funny.

Boys will be boys, y’know.

Link: The Only Reason To Get A Wii Fit @ Kontraband

→ Leave a CommentCategories: fun
Tagged: , ,

Battery Powered – Language Practice

May 15, 2008 · Leave a Comment

It seems now that I have a lot of free time over that I should get on with this blogging business. Actually, I’m no stranger to blogs. As I have 193 blogs subscribed to my Google Reader account I do spend an awful lot of time to read them a lot.

My main reason for blogging is to keep up with the practice of writing. I need that practice in order to keep communicating clearly with others. Without trying to sound condescending, I could argue that I currently do well in contrast to other non-native English speakers.

There are certainly some perks if you are a resident of Sweden like me. Scandinavians have been incapable of voice dubbing movies and television shows, mostly due to economic reasons. Instead we subtitle everything foreign and the tradition of subtitling still lives on. You could argue that subtitles obstruct the movie, but the fact remains that we do have a very high level of language acquisition in comparison with other countries that do voice dub.

Anyhow lets see if I can keep up with this blog writing at least once every week.

→ Leave a CommentCategories: Uncategorized
Tagged: ,

A Practical Case of Mockery

May 22, 2007 · Leave a Comment

At my university there are two courses in iterative programming, using extreme programming (XP) as a methodology. It is actually two courses in one. The first one is new students who are thrown into a big Java-programming project for the first time. The project would span for eight weeks, where they had a full workday on mondays and have a design meeting in the middle of the week. Towards the end, they have to use their very own time tracking application in a race.

It is important to note that the goal is not to teach the students XP, but to actually teach them how important it is to work together as a team. As far as I know, it is the only course in the world who offers this with great support from the school staff.

Following this course is yet another optional one about coaching these teams of hapless yet jolly fellowship of students. And I became one of these coaches. But that’s not what I’m going to talk about now.

When I was a coaching, I’ve been trying to find some simple way of telling my team on why they should be using mock objects in their tests. I remember that I had a hurdle getting over them myself. My team had it a bit worse as they were fairly new in test-driven development, learning about it previous semester, but they gave this unit testing gig a try.

There are two big reasons why the team will benefit from writing mocks. The first and foremost reason is that tests will become less brittle as they actually will be testing single classes at a time disregarding how other collaborating classes will communicate with it. I’ve found by myself the hard way that when you’re testing several objects in a test that it is atrociously difficult to refactor the code.

The second reason has to do with this tip I from a peer coaching another team:

Whenever your team encounter the situation in which two pair-programmers start to fiddle around with the same class, tell them that they should consider adding an interface for that class. If they’re doing proper testing they’ll realize after a while why they need mock-objects.

If the team didn’t follow the advice it would lead to nasty merge conflicts if the team will continue to edit a class from two different pairs. Forcing them to program to an interface will teach them two things. Intuitively learning what dependency injection means and that you need to create a mock class in order to test against the interface without any outside interference.

Unfortunately, my team was a bit hesitant in using mocks, which was probably due to their inexperience with writing tests. Considering they were new at this testing dealie, it wasn’t until the end of the course when the students had to make their third release and demo it that they realized why they needed every piece of the software development puzzle. Which was also among other things they needed to learn such as acceptance tests and task lists. But I guess we all learn from our mistakes and there were other teams who were more or less successful.

→ Leave a CommentCategories: dev
Tagged: , , ,