Files
fzu-product/.vitepress/dist/assets/技术资源汇总(杭电支持版)_3.编程思维体系构建_3.4.6.3.指明地点.md.CqJJTYJl.lean.js

2 lines
3.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as p,D as t,c as l,j as s,I as h,w as k,a as i,a4 as n,o as E}from"./chunks/framework.DtvhUNIn.js";const L=JSON.parse('{"title":"3.指明地点","description":"","frontmatter":{},"headers":[],"relativePath":"技术资源汇总(杭电支持版)/3.编程思维体系构建/3.4.6.3.指明地点.md","filePath":"技术资源汇总(杭电支持版)/3.编程思维体系构建/3.4.6.3.指明地点.md"}'),e={name:"技术资源汇总(杭电支持版)/3.编程思维体系构建/3.4.6.3.指明地点.md"},r=s("h1",{id:"_3-指明地点",tabindex:"-1"},[i("3.指明地点 "),s("a",{class:"header-anchor",href:"#_3-指明地点","aria-label":'Permalink to "3.指明地点"'},"")],-1),d={class:"warning custom-block"},g={class:"custom-block-title"},y=s("strong",null,"Copy-paste",-1),F=s("p",null,"我们很多同学在编程的过程中,可能会写出一大堆重复性很强的代码,在最近看的 pa 中,举了这样一个例子,你不需要看懂只需要感受到就可:",-1),C=n("",3),c={class:"tip custom-block"},o={class:"custom-block-title"},B=s("p",null,"更可怕的是,这种编码模式可能会导致意想不到的 bug。",-1),u=s("p",null,"当你发现这些代码有 bug 的时候,噩梦才刚刚开始。也许花了好几天你又调出一个 bug 的时候,才会想起这个 bug 你好像之前在哪里调过。你也知道代码里面还有类似的 bug, 但你已经分辨不出哪些代码是什么时候从哪个地方复制过来的了。",-1),A=s("p",null,[i("这种糟糕的编程习惯叫 Copy-Paste, 经过上面的分析,相信你也已经领略到它的可怕了。事实上,"),s("a",{href:"https://cseweb.ucsd.edu/~yyzhou/",target:"_blank",rel:"noreferrer"},"周源源教授"),i("的团队在 2004 年就设计了一款工具 CP-Miner, 来自动检测操作系统代码中由于 Copy-Paste 造成的 bug. 这个工具还让周源源教授收获了一篇"),s("a",{href:"http://pages.cs.wisc.edu/~shanlu/paper/OSDI04-CPMiner.pdf",target:"_blank",rel:"noreferrer"},"系统方向顶级会议 OSDI 的论文"),i(", 这也是她当时所在学校 UIUC 史上的第一篇系统方向的顶级会议论文。")],-1),D=s("p",null,"后来周源源教授发现,相比于操作系统,应用程序的源代码中 Copy-Paste 的现象更加普遍。于是她们团队把 CP-Miner 的技术应用到应用程序的源代码中,并创办了 PatternInsight 公司。很多 IT 公司纷纷购买 PatternInsight 的产品,并要求提供相应的定制服务,甚至 PatternInsight 公司最后还被 VMWare 收购了。",-1),f=s("p",null,"这个故事折射出,大公司中程序员的编程习惯也许不比你好多少,他们也会写出 Copy-Paste 这种难以维护的代码。但反过来说,重视编码风格这些企业看中的能力,你从现在就可以开始培养。",-1),_=n("",31);function q(b,x,m,v,P,w){const a=t("font");return E(),l("div",null,[r,s("div",d,[s("p",g,[h(a,{size:"5"},{default:k(()=>[i("某种极其糟糕的编程习惯")]),_:1})]),h(a,{size:"5"},{default:k(()=>[y]),_:1}),F]),C,s("div",c,[s("p",o,[h(a,{size:"5"},{default:k(()=>[i("你想想,你遇到这么长的代码,你愿意看他吗?")]),_:1})]),B,u,A,D,f]),_])}const T=p(e,[["render",q]]);export{L as __pageData,T as default};