Saturday, November 26, 2011
9 things I learned from reading The Clean Coder by Robert C. Martin, on how professional developers conduct themselves
I recently finished reading Robert C. Martins' latest book
The Clean Coder: A Code of Conduct for Professional Programmers (ISBN 0-13-708107-3).
Without hesitation, I can honestly say that this book has literally changed my view and thoughts on professional software developers.
While reading this book, I have been writing notes in a scrap book on things I learned and things that turned on a light switch in my head. This entry is a compilation of those notes.
I strongly suggest that any, old or new, software developer that hasn't gotten the chance to read this book yet, should take the time and do it. It provides worthwhile and interesting information on what it means to be a professional software developer.
Disclaimer; Please note, as always different people interpret different things. This my interpretation of what is said in the book.
Update: After posting this blog entry, I have noticed it is getting quite a lot Reddit users with mixed feelings posting their comments and opinions. Some agree with these 9 points, while others don't. If you are into this stuff, it could be interesting to you to read these Reddit comments as well. Maybe even letting your own voice be heard.
The 9 things I learned
- A professional developer knows the domain of their project
- A professional developer is a team player
- A professional software developer takes responsibility
- A professional developer knows patterns and disciplines
- A professional developer remains calm during hectic situations
- A professional developer keeps practicing their profession
- A professional developer rests
- A professional developer knows the value of time
- A professional developer is never afraid to say no
1 - A professional developer knows the domain of their project
As a professional developer, your job is more than just reading requirement specifications and code the software. You should also know where and how the project is being used by the its users in the real world.
This means that if you are working on an accounting software, you should at least have some basic knowledge about accounting. It is not necessary to become an expert in the subject, but a little knowledge helps a big way when solving problems and coming up with solutions.
2 - A professional developer is a team player
As a professional developer, you should of course be polite and helpful towards other people. When other people ask for help, you should treat them in the same manner as you wish someone would treat you, if you were stuck. You should always offer help and welcome help from others.
Also, you should not build a wall around yourself or your code. It is important to remember that you don’t own the code, but rather the team does. So instead of dismissing anyone from working in, or even seeing, the code, it should be encouraged. This will help you grow as a developer, since it opens up for feedback, but it also greatly benefits the group and the project itself.
Over time, teams slowly grows better and better as well, resulting in team members will eventually know each others strengths and weaknesses. When this happens the team becomes very efficient on solving issues as a group. Since it takes time to build up a solid team, when a project ends, it is smarter to give the team a new project, rather than disbanding the whole group.
3 - A professional software developer takes responsibility
As a professional developer, you take responsibility for your code. It is your job to know what your code does and know that all of the code works. When coding you should always aim to cause no harm in your project, by always aiming to get the error rate as close to zero as possible.
This is done by simple writing tests. Tested code gives you more confident about your work, knowing the fact that what deliver is at top class and checked against errors. Robert C. Martin repentantly says that a great goal is that the QA department should never find bugs. An entire project with tested code also gives the developers more confident to actually do something about smelly code.
Unit and acceptance tests should be done automatically (due to it is significantly cheaper than manually testing) by using a continuous integration system. These tests should be running all the time, every time a developer commits code to the project. If a test breaks, it should be fixed as soon as possible.
Robert C. Martin is also strongly for Test Driven Development. The TDD discipline forces the developer to think about good design and structuring up their code to make it test-friendly. According to Robert C. Martin, it is actually unprofessional not to use TDD.
4 - A professional developer knows patterns and disciplines
As a professional developer, it is your responsibility to write high-quality, tested, clean code. This includes knowing design patterns, principles, methods, disciplines and artifacts.
Since the software development industry is changing constantly with new ideas and tools around the next corner, it is also equally important that you keep yourself up to date on new disciples and techniques.
You should also never lower your standards by abandoning your disciplines, even in hectic and stressful situations just to cut time.
5 - A professional developer remains calm during hectic situations
As a professional developer, you should always remain calm during hectic and stressful situations. Instead, try and think out the best solution to resolve your situation and the inform your superiors about the situation and ask for their feedback and suggestions.
Acting on panic will most likely just result in making more errors. In emergencies, you could try and pair program with a colleague. Not only will this probably decrease the number of new errors, but pair programming is also a great source of sharing knowledge between team members.
6 - A professional developer keeps practicing their profession
As a professional developer, you should spend time caring for your profession. Just like in any other profession, practice gives performance, skill and experience.
It is your own responsibility to keep training yourself by reading, practicing and learning - actually anything that helps you grow as a software developer and helps you get on board with the constant industry changes.
An important note is this should be done on your own time, not on your employer's. It is not their responsibility to train you, but your own. However, do not mistake this with you should be doing your job during this time. This time should be dedicated for you and your own enjoyment only. You should do anything that interests you. According to Robert C. Martin, if you work 40 hours a week ,you should spend around 20 additional hours enhancing your own profession.
7 - A professional developer rests
As a professional developer, you should know that being a software developer is a very intellectual and exhausting job. It is important that you don’t overwork yourself, but rather find a balance in life with your job. Being a well rested developer makes you more focused and makes you perform better at work. It also also a great receipt against writer's block.
8 - A professional developer knows the value of time
As a professional developer, you should know the value of time. Your time is expensive and should not be wasted, meaning you should use your time wisely and know things like the the high cost of meetings. Politely decline meetings that do not benefit you, or if your present doesn’t benefit anyone.
Meetings should also have a clear agenda and a goal. If you notice that a meeting is getting boring and does not benefit you anymore, or if the agenda gets abandoned or if the meeting simple gets high-jacked, either request a new topic or politely leave the meeting. You probably have better things to do then remain seated.
9 - A professional developer is never afraid to say no
As a professional developer should not be afraid to say no. If you know something is unrealistic (such as an estimation, a deadline, a requirement, etc) it is expected from you to speak up. Not most of the time - but all the time.
You shouldn’t even say you can try, as that will give a false impression to everyone that the task is doable, and maybe even worse, it turns you into a liar which can hurt your reputation among your superiors and colleagues. Instead, try and rephrase yourself and explain your concerns. Be clear and specific about the problems and dates and times.
If your superiors refuses to listen to you and does not take no as an answer, you should think about going one step higher. Even though going over someones head might feel uncomfortable, in the end it will deliver the best possible outcome for all involved parties.
According to Robert C. Martin, the definition of an estimate is interpreted by different people. For business people, estimations are commitments. For software developers, estimations are guesses, measured in probability.
You should only do commitments, when you are certain it can be done. When professional commits to something, the provide with a hard number and makes certain the job before the deadline.
我最近刚读完 Robert C. Martins 的新书 《The Clean Coder: A Code of Conduct for Professional Programmers 》(编注:暂无中文版)。我可以毫不犹豫地、诚实地说,这本书真的改变了我对于专业软件开发人员的看法和观念。在阅读过程中,我一直把学习到的事情和头脑中瞬间转变的事情写在剪贴簿上。
我强烈建议任何,不论老手或者新手,只要是还没有机会读这本书的软件开发人员都应该找时间读一下。关于成为一名专业软件开发人员的意义,这本书提供了许多有价值和有趣的信息。
声明:请注意,因为不同的人有不同的看法。这是我对这本书阐述内容的理解。
我学到的9件事
□ 一名专业开发人员了解所开发项目的领域
□ 一名专业开发人员是具有团队精神的人
□ 一名专业软件开发人员能肩负责任
□ 一名专业开发人员知道模式和准则
□ 一名专业开发人员能够在忙碌中保持冷静
□ 一名专业开发人员会不断训练自己的专业技能
□ 一名专业开发人员会适当休息
□ 一名专业开发人员懂得时间的宝贵
□ 一名专业开发人员从不害怕说不
1. 一名专业开发人员了解所开发项目的领域
作为一名专业开发人员,你的工作不仅仅是阅读需求说明书和编写软件代码。你还应该知道项目在现实中是如何使用的。
这就意味着如果你要编写一个记账软件,你至少应该具备一些基本的财务知识。你不需要成为这个领域的专家,但是有一点这方面的知识的话,在解决问题和提出解决方案时将有很大帮助。
2. 一名专业开发人员是团队的一员
作为一名专业开发人员,你当然应该对其他人礼貌并乐于助人。当别人向你寻求帮助时,你应该换位思考,像你自己所期望的那样去帮助别人。你应该乐于助人并乐于接受别人的帮助。
而且,你不应该把自己和代码独立于团队之外。记住!这些代码不是属于你的,是属于整个团队的。所以,不要不理会参与工作的其他人,甚至不让他们看代码,而是应该鼓励。这将帮助你成长为一名开发人员,因为这样就产生了反馈,而这对团队和项目都是大有裨益的。
团队随着时间推移,也会变得越来越好,最后团队成员会了解彼此的优点和弱点。当团队能够如此时,作为一个团队就能很高效地解决问题了。由于需要时间来建立这样坚实的团队,当一个项目完成时,给团队一个新项目比解散整个团队要明智得多。
3. 一名专业软件开发人员能肩负责任
作为一名专业开发人员,你要对你的代码负责。你的工作就是了解你代码的作用和所有代码的功能。当你编码时,你应该注意不要对你的项目产生危害,并且尽可能的将错误率降至接近于零。
这能够通过简单的测试完成。测试代码使你对工作更有信心,了解怎样编写最好的代码并且避免错误。Robert C. Martin最近说最高的目标是QA部门找不到任何小错误。一个具有测试代码的完整项目也给开发人员更多的信心来处理漏洞。
单元测试和验收测试应当利用持续集成系统自动完成(因为它比手动测试更加便宜)。这种测试应该一直运行,即使是开发人员向项目提交代码的时候。如果测试间断,应该尽快修复。
Robert C. Martin也强烈支持测试驱动开发。TDD致力于训练开发人员考虑更好的设计并构建他们的代码,使之易于测试。据Robert C. Martin所说,不使用TDD是不专业的。
4. 一名专业开发人员了解模式和准则
作为一名专业开发人员,编写高质量的、已测试的、干净的代码是你的责任。这包括了解设计模式、规范、方法、准则和技巧。
由于软件产业发展的不断变化,不断使用新的思路和工具,保持更新到最新的标准和技术同等重要。
你在任何时候都不能因为忽视标准而降低你的质量,即使是繁忙和紧张的情况下为了缩短时间。
5. 一名专业开发人员能够在忙碌中保持冷静
作为一名专业开发人员,你应该在忙碌和有压力的情况下始终保持冷静。尝试想出最好的解决问题的办法并将情况告知你的上司,寻求他们的反馈和意见。
忙中更易出错。在紧急情况下,你可以尝试与同事结对编程。这样不仅可以减少新增的错误而且也是一个与团队成员分享知识的好方法。
6. 一名专业开发人员会不断训练自己的专业技能
作为一名专业开发人员,你应该花时间关心你的技能。就像其他专业,实践带来能力、技巧和经验。
通过读、练和学习一直训练你自己是你的责任——实际上,任何帮助你成长为软件开发人员和帮助你起步的事物都在不停变化着。
重要的一点是,你应该在你自己的私人时间里完成,而不是在工作时间里。培训你不是他们的责任,而是你自己的责任。当然,不要和你应该工作的时间弄错。这个时间应该专门针对你和你的兴趣。你可以做任何感兴趣的事。据Robert C. Martin所说,如果你每周工作40小时,你应该花20小时提高你的专业技能。
7. 一名专业开发人员会适当休息
作为一名专业开发人员,你应该知道做一名软件开发人员是很费脑子和累人的工作。注意不要劳累过度是很重要的,你需要在工作和生活之间寻找平衡。做一个休息好的开发人员使你能更专注并且在工作中表现得更好。这也是对抗心理阻滞的良方。
8. 一名专业开发人员懂得时间的宝贵
作为一名专业开发人员,你应该知道时间的宝贵。它们不应该被随意浪费,这就要求你要合理安排你的时间,比如开会,就很浪费时间。婉言谢绝会议对你不利,但如果参加则不利于任何人。
会议也应有明确的议程和目标。如果你注意到会议开始变得乏味并且对你不再有益,或者议程被放弃抑或会议变成简单唱高调,你要么换个新的话题要么礼貌地离开。你也许有更好的事情去做而不是继续坐在那里。
9. 一名专业开发人员从不害怕说不
作为一名专业开发人员你不应该害怕说不。如果你发现一些事情是不现实的(例如一个意见、期限、要求等等)这些需要你提出来。不是大多数时候——而是每一次。
你甚至不应该说你可以试试,因为这样将会提供一个假象那就是这个任务是可行的,也可能更糟,这使你变成一个骗子,有损你在上司和同事之间的名声。相反,尝试改换措辞并解释你所关心的问题。清晰和具体地明确问题的时间和日期。
如果你的上司不听你的或者不接受否定的回答,你应该想想更进一步行动。虽然越级不太好,但是最后会带来对所有参与者最好的结果。
据Robert C. Martin说,判断的定义因人而异。对于商务人士,判断方法是承诺。对软件开发人员,判断是猜测,概率计算。
你应该只对能够确保完成的工作做出承诺。当专业地对一些事承诺后,提供硬性标准并且确保在期限内完成工作。