Write Code As If You Had to Support It for the Rest of Your Life
Write Code As If You Had to Support It for the Rest of Your Life
Yuriy Zubarev
YOU COULD ASK 97 PEOPLE what every programmer should know and do, and you might get 97 distinct answers. This could be both overwhelming and intimidating at the same time. All advice is good, all principles are sound, and all stories are compelling, but where do you start? More important, once you have started, how do you keep up with all the best practices you’ve learned, and how do you make them an integral part of your programming practice?
I think the answer lies in your frame of mind or, more plainly, in your atti- tude. If you don’t care about your fellow developers, testers, managers, sales and marketing people, and end users, then you will not be driven to employ test-driven development or write clear comments in your code, for example. I think there is a simple way to adjust your attitude and always be driven to deliver the best quality products:
Write code as if you had to support it for the rest of your life.
That’s it. If you accept this notion, many wonderful things will happen. If you were to accept that any of your previous or current employers had the right to call you in the middle of the night, asking you to explain the choices you made while writing the fooBar method, you would gradually improve toward becoming an expert programmer. You would naturally want to come up with better variable and method names. You would stay away from blocks of code comprising hundreds of lines. You would seek, learn, and use design patterns. You would write comments, test your code, and refactor continually. Support- ing all the code you’d ever written for the rest of your life should also be a scalable endeavor. You would therefore have no choice but to become better, smarter, and more efficient.

If you reflect on it, the code you wrote many years ago still influences your career, whether you like it or not. You leave a trail of your knowledge, attitude, tenacity, professionalism, level of commitment, and degree of enjoyment with every method, class, and module you design and write. People will form opin- ions about you based on the code that they see. If those opinions are constantly negative, you will get less from your career than you hoped. Take care of your career, of your clients, and of your users with every line of code—write code as if you had to support it for the rest of your life.
Write Code As If You Had to Support It for the Rest of Your Life的更多相关文章
- Code First :使用Entity. Framework编程(7) ----转发 收藏
第7章 高级概念 The Code First modeling functionality that you have seen so far should be enough to get you ...
- EntityFramework Code First 添加唯一键
在EntityFramework 6.1后可以直接使用 [Index("TitleIndex", IsUnique = true)] public string Title { g ...
- 支持向量机的smo算法(MATLAB code)
建立smo.m % function [alpha,bias] = smo(X, y, C, tol) function model = smo(X, y, C, tol) % SMO: SMO al ...
- The Ultimate List of Open Source Static Code Analysis Security Tools
https://www.checkmarx.com/2014/11/13/the-ultimate-list-of-open-source-static-code-analysis-security- ...
- C#中通过反射方法获取控件类型和名称
这个方法是简单的也是神奇的. 有木有想过,将自己项目中的所有类型,包括自定义类型的命名空间和名称全部获取出来? 有木有想过,有一种简便的方法可以自动化管理项目中的控件和窗体? 有木有想过... 首先, ...
- Winform应用程序实现通用消息窗口
记得我之前发表过一篇文章<Winform应用程序实现通用遮罩层>,是实现了透明遮罩的消息窗口,功能侧重点在动图显示+消息提醒,效果看上去比较的炫,而本篇我又来重新设计通用消息窗口,功能重点 ...
- 【C#】分享带等待窗体的任务执行器一枚
-------------201504161039更新------------- 更新内容: IWaitForm接口删除System.Windows.Forms.DialogResult Dialog ...
- language level in Intellij IDEA
The Language level setting sets which features the code assistance in the editor should support. For ...
- C#委托,事件理解入门 (译稿)
原文地址:http://www.codeproject.com/Articles/4773/Events-and-Delegates-Simplified 引用翻译地址:http://www.cnbl ...
随机推荐
- Python实现的基于ADB的Android远程工具
本工具为原创,涉及知识: - Python编程 - Tkinter GUI编程 - ADB通信机制 代码已经开源: https://code.csdn.net/codehat/andev/tree/m ...
- [原创]react-vio-form 快速构建React表单应用
react-vio-form 是一个react的快速轻量表单库,能快速实现表单构建.提供自定义表单格式.表单校验.表单信息反馈.表单信息隔离等功能.可采用组件声明或者API的形式来实现表单的功能 de ...
- 解决vmware 和hyper-v不能共存的问题
只需在 Windows 中以管理员身份运行命令提示符 cmd 1.运行 bcdedit /copy {current} /d "Windows 8 (关闭 Hyper-V)"命令, ...
- springMVC注解用法:@modelattribute的用法
在Spring MVC里,@ModelAttribute通常使用在Controller方法的参数注解中,用于解释model entity,但同时,也可以放在方法注解里. 如果把@ModelAttrib ...
- Elasticsearch入门系列~通过Java一系列操作Elasticsearch
Elasticsearch索引的创建.数据的增删该查操作 上一章节已经在Linux系统上安装Elasticsearch并且可以外网访问,这节主要通过Java代码操作Elasticsearch 1.创建 ...
- oracle数据库spfile
http://blog.chinaunix.net/uid-8996530-id-3195808.html http://www.cnblogs.com/HondaHsu/p/4885318.html ...
- openstack之虚拟机创建流程分析
这篇博文静静的呆在草稿箱大半年了.假设不是由于某些原因被问到,以及由于忽略它而导致的损失,否则我也不知道什么时候会将它完毕.感谢这段时间经历的挫折,让我知道不足.希望你能给我更大的决心! 本文试图具体 ...
- 1.3 Quick Start中 Step 2: Start the server官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 2: Start the server Step : 启动服务 Kafka ...
- [RxJS] How To get the results of two HTTP requests made in sequence
switchMap can chain two HTTP requests together, creating one request based on the results of the fir ...
- linux下pthread_cancel无法取消线程的原因
一个线程能够调用pthread_cancel终止同一进程中的还有一个线程,可是值得强调的是:同一进程的线程间,pthread_cancel向还有一线程发终止信号.系统并不会立即关闭被取消线程,仅仅有在 ...