Clean Code by Robert C. Martin 0

Clean Code is the best book I have read in last six months. In this book Robert C. Martin shares his great experience from the programming battlefield.

The book has a very good style. It guides you through refactoring of reams of Java code as if it was solving riddles. It’s not about high design, though, it’s about handling the code at a lower level: at the level of organizing classes, functions and blocks. It’s about writing a beautiful and readable code.

It’s also a book on craftsmanship. The author has emphasized this many times on his blog: being a craftsman-programmer means taking responsibility of producing good code only, just like being craftsman shoemaker, is all about making good shoes. And exactly the same way there are principles and best practices in both professions.

The uncompromising style helps the reader not to lose himself within arguments, but if you don’t like what Robert Martin says about certain principle, that’s very good (unless you can’t provide any arguments to back it up).

All in all it’s a very good book for anyone who wants to write better code. Get your own copy now and no worries! You’ll like it.

Gone WordPress 0

Quick and obvious info: I moved to wordpress. That’s kind of treason: wordpress is not in Python, but after evaluating it for a few hours it seems nice and very usable. I don’t know internal code, but from outside it’s quite good piece of software. Theme used: Elite.

Bazaar with Master Branch 0

Problem statement

I have a bit svnish view of writing software: there should be one master branch for project just not to confuse users of your code where to get the most recent code from.

I’m writing a little app (I’ve posted about it earlier) with my girlfriend and we wanted to share and control code with possibly the best DVCS in the world. Bazaar promises an easy way for svn people to support central/master branch workflow. Or so I thought.

Early attempt

I was to confident with bazaar easiness. So I made bzr push over sftp to some directory on hauru.eu and told my girlfriend it’s ready. But it wasn’t: all files had my user permissions (uid/gid) and she couldn’t check anything in. So… It’s not so easy. I could change initial group for both of us, but this is not general solution (it wouldn’t work on WebFaction shared hosting where you can’t change initial group).

Heaving previous experience with setting svn central repository I tried to bzr serve the code. But this is simplistic mechanism with no read-write authentication support.

SGID to the rescue

With an advice from Paweł I tried setting SGID on repository directory. It sounded as a good idea, but it didn’t work. I was desperate, but I took another shot and browsed the web for solutions with SGID.

It seems there is bug in OpenSSH or python-paramiko or in bazaar sftp support and it doesn’t honor SGID properly. But with smart-server, that is bzr+ssh it does. Moreover it works much faster than sftp. So it’s double win.

Complete solution

In four steps:

  1. on server create empty repo folder
  2. change group to some common (users or bzr or your-project)
  3. set SGID on the folder
  4. now you can push your branch with
    bzr push bzr+ssh://server/repo-path
    

Every one in group can check code in and out.

Of course this should not stop you from having as many side branches as you want, but it's good to have a single code branch you can always refer to.

Failed with Google App Engine 0

I’m writing a little app for my English course at Jagiellonian University in Django. Right now I’m hosting it here, on hauru.eu, but soon we’ll release a book we were producing whole year and thus I have to finish the app and make it public. I thought about putting it on Google App Engine  (think: free hosting in Python), but after two days of trying I must say I don’t see any point any more.

I wrote my app using many of convenience methods/classes provided by Django, but very few of them are supported by GAE. I’d have to rewrite half of code! No way. It’s right time to use some servers in KSI: Students’ Computer Science Club, which I’m proud member of.

I’m sure Google App Engine is powerful and convenient platform, but I don’t think Django fits there well. While reading about GAE I thought the best solution would be using some external libraries like Werkzeug, as GAE is based on WSGI interface.

Update (Dec 13, 2008): The little app is live and indeed running on KSIs server. Check it out, it’s called English++: English for Computer Science Students

« Previous Page