A Message to the Future

A Message to the Future

Linda Rising

MAYBE iT’S BECAUSE MOST OF THEM ARE SMART PEOPLE, but in all the years I’ve taught and worked side by side with programmers, it seems that most of them thought that since the problems they were struggling with were difficult, the solutions should be just as difficult for everyone (maybe even for themselves a few months after the code was written) to understand and maintain.

I remember one incident with Joe, a student in my data structures class, who had to come in to show me what he’d written. “Betcha can’t guess what it does!” he crowed.

“You’re right,” I agreed, without spending too much time on his example and wondering how to get an important message across. “I’m sure you’ve been working hard on this. I wonder, though, if you haven’t forgotten something important. Say, Joe, don’t you have a younger brother?”

“Yep. Sure do! Phil! He’s in your Intro class. He’s learning to program, too!” Joe announced proudly.

“That’s great,” I replied. “I wonder if he could read this code.”

“No way!” said Joe. “This is hard stuff!”

“Just suppose,” I suggested, “that this was real, working code, and that in a few years, Phil was hired to make a maintenance update. What have you done for him?” Joe just stared at me, blinking. “We know that Phil is really smart, right?”

??116 97 Things Every Programmer Should Know

?

???????????????Joe nodded. “And I hate to say it, but I’m pretty smart, too!” Joe grinned. “So if I can’t easily understand what you’ve done here and your very smart younger brother will likely puzzle over this, what does that mean about what you’ve written?” Joe looked at his code a little differently, it seemed to me. “How about this,” I suggested in my best “I’m your friendly mentor” voice, “Think of every line of code you write as a message for someone in the future—someone who might be your younger brother. Pretend you’re explaining to this smart person how to solve this tough problem.

“Is this what you’d like to imagine? That the smart programmer in the future would see your code and say, ‘Wow! This is great! I can understand perfectly what’s been done here and I’m amazed at what an elegant—no, wait—what a beautiful piece of code this is. I’m going to show the other folks on my team. This is a masterpiece!’

“Joe, do you think you can write code that solves this difficult problem but will be so beautiful it will sing? Yes, just like a haunting melody. I think that anyone who can come up with the very difficult solution you have here could also write something beautiful. Hmm…I wonder if I should start grading on beauty? What do you think, Joe?”

Joe picked up his work and looked at me, a little smile creeping across his face. “I got it, prof, I’m off to make the world better for Phil. Thanks.”

时间: 2024-11-06 11:29:28

A Message to the Future的相关文章

一个http请求在play框架中的前世今生(下)

上一篇提到了play底层的网络通信基于netty实现,于是粗略地研究了一下netty,总结如下.(netty版本是3.2.5,不同版本的实现可能差异较大) 一.netty的组件 channelBuffer: 传输Buffer和抽象后的逻辑Buffer的结合,将NIO底层的多个buffer合并成了一个可以代表完整消息内容的buffer,可以理解为一个message channel: 对于Java的old IO和NIO的输入|输出通道的一个封装 channelPipeline: Netty的Chan

hdu 1399(水题)

Starship Hakodate-maru Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 751    Accepted Submission(s): 518 Problem Description The surveyor starship Hakodate-maru is famous for her two fuel conta

Dart 语言概述

// 导入(import) // 导入核心库 //导入外部库 import 'package:test_api/test_api.dart'; // 导入文件 //import 'path/test.dart'; // 每个应用都有一个 main() 函数 void main() { // 你好,世界 // 使用顶层函数 print() 来将一段文本输出显示到控制台 print('Hello, World!'); // 变量 // 虽然 Dart 是代码类型安全的语言,但是由于其支持类型推断,因

actix rust actor 框架学习 二 ping actor demo 代码

以下是官方文档的学习,了解基本的actix actor 编程模型 项目初始化 cargo 创建 cargo new actor-ping --bin 效果 ├── Cargo.toml └── src    └── main.rs 添加依赖 cargo.toml 配置 [package] name = "actor-ping" version = "0.1.0" authors = ["rongfengliang <[email protected]

ARTS Week 18

Feb 24, 2020 ~ Mar 1, 2020 Algorithm Problem 371. Sum of Two Integers(两整数之和) 题目链接 题目描述:给定两个数字,求两个数字之和.不能使用加法运算 思路为:不能使用加法运算,那么可以考虑使用位运算来实现加法.先观察只有一位数的情况: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0(进位为 1) 这个特性符合异或运算,那么可以通过异或运算来实现无进位加法,那么该如何计算进位呢?我们知道,二进制

Android Message Handling Mechanism

转自:http://solarex.github.io/blog/2015/09/22/android-message-handling-mechanism/ Android is a message driven, message driven several elements: The message says: Message Message queue: MessageQueue The news cycle, remove the message processing for circ

[Android源代码分析]Android消息机制,Handler,Message,Looper,MessageQueue

最近准备把Android源码大致过一遍,不敢私藏,写出来分享给大家,顺便记录一下自己的学习感悟.里面一定有一些错误的地方,希望广大看客理解理解. 网上也有不少分析文章,这里我尽量分析的更加细致详尽.不留死角. 一.核心循环体:Looper.loop(); 我们知道,在线程run()中Looper.prepare();Looper.looper().之后这个线程就是一个HandlerThread了.我们可以通过Handler在另外一个线程中(自己也可以)向这个线程发送消息,在这个线程中处理消息.

Github for beginners and my future references

OK. I have been trying to learn github for really a long time, but (yes, there is always a but) I just couldn't know how to use it. This article will mainly record a bunch of command lines in the github for my or beginners future reference. I give my

Android Handler处理机制 ( 二 ) ——Handler,Message,Looper,MessageQueue

Android是消息驱动的,实现消息驱动有几个要素: 消息的表示:Message 消息队列:MessageQueue 消息循环,用于循环取出消息进行处理:Looper 消息处理,消息循环从消息队列中取出消息后要对消息进行处理:Handler 平时我们最常使用的就是Message与Handler了,如果使用过HandlerThread或者自己实现类似HandlerThread的东 西可能还会接触到Looper,而MessageQueue是Looper内部使用的,对于标准的SDK,我们是无法实例化并