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.

时间: 2024-10-09 21:26:31

Write Code As If You Had to Support It for the Rest of Your Life的相关文章

EntityFramework Code First 添加唯一键

在EntityFramework 6.1后可以直接使用 [Index("TitleIndex", IsUnique = true)] public string Title { get; set; } 在旧版本中, Unfortunately you can't define it as unique key in code first because EF doesn't support unique keys at all (it is hopefully planned for

支持向量机的smo算法(MATLAB code)

建立smo.m % function [alpha,bias] = smo(X, y, C, tol) function model = smo(X, y, C, tol) % SMO: SMO algorithm for SVM % %Implementation of the Sequential Minimal Optimization (SMO) %training algorithm for Vapnik's Support Vector Machine (SVM) % % This

转摘<<On becoming an expert C programmer>>

The following is from an EMail message that I sent to to an individual on 12-Apr-2001. You may find this EMail message useful. The Writer asked: ``I just recently visited your website ... Just wanted to say greetings and ask a simple question: Do you

Winform应用程序实现通用遮罩层

Winform应用程序实现通用遮罩层 在WEB上,我们在需要进行大数据或复杂逻辑处理时,由于耗时较长,一般我们会在处理过程中的页面上显示一个半透明的遮罩层,上面放个图标或提示:正在处理中...等字样,这样用户体验就比较好了,然而如果在Winform客户端程序,通常遮罩层的处理就显得不那么简单或不那么好看,而我今天要说明的是,我实现的这个Winform通用遮罩层,却可以实现类似WEB上的遮罩层,既可以透明,而且还可以显示动态图片以及文字,那如何实现的呢,我现在一一讲解. 首先要明确我们要实现的效果

Python著名的lib和开发框架(均为转载)

第一,https://github.com/vinta/awesome-python Awesome Python A curated list of awesome Python frameworks, libraries, software and resources. Inspired by awesome-php. Awesome Python Admin Panels Algorithms and Design Patterns Anti-spam Asset Management A

AutoCAD .NET开发大师Kean有价值的博客 2006年8月 .NET内容整理

一 Calling AutoCAD commands from .NET 使用.NET调用AutoCAD命令 In this earlier entry I showed some techniques for calling AutoCAD commands programmatically from ObjectARX and from VB(A). Thanks to Scott Underwood for proposing that I also mention calling com

IntelliJ IDEA 2014 付费版 免费版比较

http://www.jetbrains.com/idea/features/editions_comparison_matrix.html Freemarker, Velocity IDE Features Ultimate Edition Free Community Edition Darcula — The darker UI theme. Y Y Android — UI Designer, Layout Refactorings, etc. Y Y Maven, Gradle, An

Method and apparatus for an atomic operation in a parallel computing environment

A method and apparatus for a?atomic?operation?is described. A method comprises receiving a first program unit in a parallel computing environment, the first program unit including a memory update?operation?to be performed atomically, the memory updat

C# 文字滚动特效(上下滚动)

本程序改编至网上下载的一个自定义控件,原控件是左右滚动效果,类似于跑马灯效果,由于项目需要,改编为上下滚动. 前期没有实现自动折行,今天刚加上自动折行. using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Data; using System.Windows.Forms; usi