《程序员的职业素养》读后

看了Bob大叔的这本书,只在软件质量上这一点就很汗颜,感觉距离真正的“专业人士”还有很大差距。

以前的项目,常常给自己找些“时间紧,任务重,资源不足”的借口就放低了对质量的要求,很多应该坚持的好东西没有坚持。这个找借口的过程非常自然,好像事情本来就是这样的。之后常常发现项目的质量有问题,BUG很多,或是实现的功能没有满足要求,往往要花费更多的时间和资源来弥补,同时还要承受很大的压力(担心其他BUG出现)。这些做法确实非常不专业!

参加工作以来,5年多时间,经历过两个大的项目。第一个有大量的维护性工作,遗留代码多,代码的结构也相对差,同时工具旧,生产率低。工程师都很“惧怕代码改动”,不会轻易改旧的代码,只好慢慢的改进,效率就更低。第二个项目用了更先进的技术,全新的平台,工具链完备,且从头做起。一开始想着要大干一场,多注意单元测试什么的,可到后来,好多应该有的流程都丢了。产品的BUG很多,代码改动依然很困难。我想资源一定也是问题,我们组一共也就4人,多的时候平台上要做2-3个不同的Release,有时候真的应接不暇。

新的项目就在眼前了,又有了很多期许,还是从最基本的坚持做起:

  • 真正的实现代码规范
  • 推行TDD,做可测试的设计(试试先,阻力可能不小!)
  • 引入验收测试(让SQA的人试试)
  • 对工期不再妥协

加油!

Gitolite服务器搭建 (How to install and configure Gitolite)

要做新项目了,老大要先做一个原型,但不能污染公司的主代码仓库,于是大家决定用目前最流行的Git。Google了一下,目前Linux下最好的Git服务器搭建工具就是Gitolite。在这总结归纳一下方法。我用的平台是Ubuntu 12.04.

Step 1. Add Group “git” and User “git”

Step 2. Install gitolite

Switch user “git” first

Get gitolite from github first

Make a “bin” directory where gitolite will be installed into.

Install gitolite to bin

Step 3. Setup gitolite

Before we setup gitolite, you need to get the administer’s ssh public key file.

As we know, when we call “ssh-keygen” on our workstation, we can get a private key (don’t share it to others) and a public key. Gitolite need the public one. For more details, please read gitolite-doc.

As I showed to you, I copy the public key to gitolite_server:/tmp/jasonlee.pub. Next we setup the gitolite and configure the admin’s public key.

Then you will find there are some files and folders generated.

 Step 4. Add a new repo and a user.

As a admin, if you want to manage repos and users, you need to clone a special repo “gitolite-admin” first.

Now, jasonlee is the admin. Let’s clone that repo on my workstation first.

Then you can find two folders conf and keydir.

In folder conf, there is gitolite’s configuration file gitolite.conf. Default, it likes

 

keydir is the folder to put the public key files of users.

If you want to add a user jason and a new repo foo.

You need put jason.pub to keydir first and add following lines in gitolite.conf.

Then commit and push all changes to gitolite server.

OK, everything is done! Repo foo is ready for jason now. 🙂