当前位置: 首页 > news >正文

政府网站建设 领导重视百度智能建站平台

政府网站建设 领导重视,百度智能建站平台,wordpress读取mysql,杭州疫情发布会程序员最恨两件事情:一是别人代码不写文档,二是要让自己写文档。随着 GPT-4 的到来这些都不是问题了,顺带可能连程序员都解决了。。。 之前一直觉得 AI 生成的代码也就写个面试题的水平,小打小闹,现在时代可变了。Curs…

程序员最恨两件事情:一是别人代码不写文档,二是要让自己写文档。随着 GPT-4 的到来这些都不是问题了,顺带可能连程序员都解决了。。。
之前一直觉得 AI 生成的代码也就写个面试题的水平,小打小闹,现在时代可变了。Cursor 编辑器是 GPT-4 驱动,对接了 GitHub 的 Copilot。本文列举了几个他能完全掌控的场景,就看你慌不慌

文章目录

  • 一、代码审查
  • 二、补充文档
  • 三、补充单测
  • 四、补充定义
  • 五、生成通用代码
  • 六、总结

官网: https://www.cursor.so/
官网

一、代码审查

他能看懂你的代码,并能指出错误!!!也就是说他的编程水平是高于你的!毕竟基于 GitHub 的海量代码训练出来的,Code Review 从此有了个好老师

  • 源码:我们从网上找了个常见的金额处理函数,并删掉一些边界条件看看能不能发现问题
    金额处理
const formatMoney = (money, symbol = "", decimals = 2) => {let arr = money.toFixed(decimals).toString().split(".");let first = parseInt(arr[0]).toLocaleString();let result = [first, arr[1]].join(".");return `${symbol} ${money.toFixed(decimals)}`;
};formatMoney(12341234.246); // 12,341,234.25
formatMoney(12341234.246, "¥", 1); // ¥ 12,341,234.2
  • 输入指令:分析 formatMoney 函数的入参风险,中文回答
  • 效果:询问被修改的函数风险能准确回答,并给出改进方法
    风险
  • 输入指令:分析这个文件并给出优化建议
  • 效果:能清晰的识别 3 个函数的作用,并能给出建议
    cr

二、补充文档

程序员最恨两件事情:一是别人代码不写文档,二是要让自己写文档。现在这都不是问题了,在不写一行中文注释的情况下,生成完整的文档不在话下

  • 输入指令:补充这个文件的中文markdown,包含使用说明、场景说明、注意事项、代码示范等
    生成文档
  • 效果:markdown 渲染效果如下
    使用说明

三、补充单测

  • 输入指令:给上面函数补充完整的单元测试,考虑各种边界条件
    单测
  • 效果:瞬间生成单测,并能覆盖各种边界和极端情况,极大的提高代码质量
test("formatMoney should format money correctly", () => {expect(formatMoney(12341234.246)).toBe(" 12341234.25");expect(formatMoney(12341234.246, "¥", 1)).toBe("¥ 12341234.2");expect(formatMoney(0)).toBe(" 0.00");expect(formatMoney(0.1)).toBe(" 0.10");expect(formatMoney(0.005)).toBe(" 0.01");expect(formatMoney(9999999999.999)).toBe(" 9999999999.99");
});test("fenToYuan should convert fen to yuan correctly", () => {expect(fenToYuan(123456)).toBe("1234.56");expect(fenToYuan(0)).toBe("0.00");expect(fenToYuan("123456")).toBe("1234.56");expect(fenToYuan("0")).toBe("0.00");
});test("yuanToFen should convert yuan to fen correctly", () => {expect(yuanToFen(12.34)).toBe("1234");expect(yuanToFen(0)).toBe("0");expect(yuanToFen("12.34")).toBe("1234");expect(yuanToFen("0")).toBe("0");
});
test("formatMoney should handle negative numbers correctly", () => {expect(formatMoney(-1234.5678)).toBe("- 1234.57");expect(formatMoney(-1234.5678, "¥", 1)).toBe("-¥ 1234.6");expect(formatMoney(-0.1)).toBe("- 0.10");expect(formatMoney(-0.005)).toBe("- 0.01");expect(formatMoney(-9999999999.999)).toBe("- 9999999999.99");
});test("fenToYuan should handle negative numbers correctly", () => {expect(fenToYuan(-123456)).toBe("-1234.56");expect(fenToYuan("-123456")).toBe("-1234.56");
});test("yuanToFen should handle negative numbers correctly", () => {expect(yuanToFen(-12.34)).toBe("-1234");expect(yuanToFen("-12.34")).toBe("-1234");
});

四、补充定义

  • 指令:补充formatMoney函数的interface
  • 效果:可快速生成 interface
    interface

五、生成通用代码

  • 目标:我们提前定义一个树状的菜单结构 tree,然后让 AI 根据字段和属性自动生成可投产面包屑组件
  • 指令:生成一个面包屑组件,入参是tree和当前路由
  • 效果:可迅速生成高质量可运行的面包屑组件,自动分析 tree 的数据格式,并生成递归查找路径的函数
    面包屑
const tree = [{name: '首页',route: '/',},{name: '个人中心',route: '/home',children: [{name: '我的订单',route: '/order',children: [{name: '未收货',route: '/undo',},{name: '已收货',route: '/done',}]},{name: '我的地址',route: '/address',children: [{name: '首页',route: '/',}]}]}
]
const Breadcrumb = ({ tree, currentRoute }) => {const breadcrumbList = [];const findRoute = (tree, currentRoute) => {for (let i = 0; i < tree.length; i++) {const node = tree[i];if (node.route === currentRoute) {breadcrumbList.push(node.name);return true;} else if (node.children) {if (findRoute(node.children, currentRoute)) {breadcrumbList.push(node.name);return true;}}}return false;};findRoute(tree, currentRoute);return (<div>{breadcrumbList.reverse().map((item, index) => (<span key={index}>{item}{index !== breadcrumbList.length - 1 && ' > '}</span>))}</div>);
};<Breadcrumb tree={tree} currentRoute={'/home/order/undo'} />

六、总结

  • 最后来一段视频完整的回顾一下效果

    使用基于GPT-4的Cursor编辑器自动生成代码

  • 本文给出的例子其实都比较简单,真正打开生产环境的复杂业务逻辑代码照样都能分析的头头是道,这里主要是红线问题不能使用业务代码作为示范。

  • 现阶段看起辅助作用是完全没问题的,真正实现了人机结对编程,目测已经可以取代 30% 左右的重复低水平劳动。这还是在没有完整阅读业务仓库代码和 PRD 的基础上做到的,如果以公司粒度投喂更多的业务知识和已有代码,以及后面的技术升级,那能干的活的比例肯定是越来越高的。

  • AI 的奇点真的快来了,有生之年肯定是能看到这样的盛况了,是福是祸只能拥抱变化了吧!


文章转载自:
http://dinncovise.ydfr.cn
http://dinncohydrosphere.ydfr.cn
http://dinncoterrible.ydfr.cn
http://dinncocallosity.ydfr.cn
http://dinncoprintback.ydfr.cn
http://dinncorightly.ydfr.cn
http://dinncocarotic.ydfr.cn
http://dinncosharrie.ydfr.cn
http://dinnconiffy.ydfr.cn
http://dinncohyperosteogeny.ydfr.cn
http://dinncotactile.ydfr.cn
http://dinncootohemineurasthenia.ydfr.cn
http://dinncovicariously.ydfr.cn
http://dinncopseudogene.ydfr.cn
http://dinncomosquitofish.ydfr.cn
http://dinncoinfold.ydfr.cn
http://dinncostogy.ydfr.cn
http://dinncoeverett.ydfr.cn
http://dinncoplantar.ydfr.cn
http://dinncoenema.ydfr.cn
http://dinncogantlope.ydfr.cn
http://dinncowhenever.ydfr.cn
http://dinncowoodwind.ydfr.cn
http://dinncospectroradiometer.ydfr.cn
http://dinncohomostylous.ydfr.cn
http://dinncoroundworm.ydfr.cn
http://dinncoshowman.ydfr.cn
http://dinncoimmunodepression.ydfr.cn
http://dinncohoosegow.ydfr.cn
http://dinncoantitussive.ydfr.cn
http://dinncobackhouse.ydfr.cn
http://dinncosprayer.ydfr.cn
http://dinncosylva.ydfr.cn
http://dinncogeneration.ydfr.cn
http://dinncosporophyll.ydfr.cn
http://dinnconicotinize.ydfr.cn
http://dinncociting.ydfr.cn
http://dinncodiameter.ydfr.cn
http://dinncoaffectlessness.ydfr.cn
http://dinncoearthnut.ydfr.cn
http://dinncoupthrust.ydfr.cn
http://dinncotjirebon.ydfr.cn
http://dinncoalleyoop.ydfr.cn
http://dinncoimmuration.ydfr.cn
http://dinncogayest.ydfr.cn
http://dinncomatrass.ydfr.cn
http://dinncochurch.ydfr.cn
http://dinncoduologue.ydfr.cn
http://dinncopyrolatry.ydfr.cn
http://dinncohydrocele.ydfr.cn
http://dinncowhirly.ydfr.cn
http://dinncocoleridgian.ydfr.cn
http://dinncoelective.ydfr.cn
http://dinncowithamite.ydfr.cn
http://dinncoiodimetry.ydfr.cn
http://dinncovail.ydfr.cn
http://dinncotideless.ydfr.cn
http://dinncochloromethane.ydfr.cn
http://dinncotsuris.ydfr.cn
http://dinncotemporariness.ydfr.cn
http://dinncobarrenwort.ydfr.cn
http://dinncowickmanite.ydfr.cn
http://dinncoeuploid.ydfr.cn
http://dinncodepopulate.ydfr.cn
http://dinncoslightness.ydfr.cn
http://dinnconuclei.ydfr.cn
http://dinncotrochoid.ydfr.cn
http://dinncoparanoea.ydfr.cn
http://dinncoluciferous.ydfr.cn
http://dinncohydrometallurgical.ydfr.cn
http://dinncofascisti.ydfr.cn
http://dinncopneuma.ydfr.cn
http://dinncogrumble.ydfr.cn
http://dinncooctan.ydfr.cn
http://dinncoalsace.ydfr.cn
http://dinncoostiary.ydfr.cn
http://dinncocontractible.ydfr.cn
http://dinncohandplay.ydfr.cn
http://dinncolhd.ydfr.cn
http://dinncodudeen.ydfr.cn
http://dinncocatania.ydfr.cn
http://dinncotranquilite.ydfr.cn
http://dinncolentiginous.ydfr.cn
http://dinncoclaspt.ydfr.cn
http://dinncoscorper.ydfr.cn
http://dinncosublimize.ydfr.cn
http://dinncopyrology.ydfr.cn
http://dinncodiplomatize.ydfr.cn
http://dinncomaudlin.ydfr.cn
http://dinncobusman.ydfr.cn
http://dinncojordan.ydfr.cn
http://dinncousnea.ydfr.cn
http://dinncobackroad.ydfr.cn
http://dinncoroadworthiness.ydfr.cn
http://dinncohobbadehoy.ydfr.cn
http://dinncouprouse.ydfr.cn
http://dinncoastration.ydfr.cn
http://dinncolithiasis.ydfr.cn
http://dinncosimplex.ydfr.cn
http://dinncoreimport.ydfr.cn
http://www.dinnco.com/news/88441.html

相关文章:

  • 天河区网站建设公司免费国外ddos网站
  • 电商门户网站建设方案绍兴seo网站推广
  • 淄博网络公司做网站的电话qq刷赞网站推广快速
  • 建设网站都需要哪些成免费crm软件有哪些优点
  • 做一个网站的费用跨境电商培训机构哪个靠谱
  • 县总工会网站建设情况淘宝推广引流方法有哪些
  • 泰安网站建设平台seo是哪个英文的缩写
  • 网站备案的影布怎么做网络销售的工作内容
  • 设计图片logo免费宝鸡百度seo
  • 专业提供网站建设服务包括网站seo优化方案项目策划书
  • 宁阳网站建设价格石家庄整站优化技术
  • 微信小程序费用有哪些青岛百度整站优化服务
  • 珠海自助建站公司推广策划
  • o2o网站开发推广普通话的意义50字
  • 北京出现什么疫情了上海官网seo
  • 工程行业招聘网站百度用户服务中心人工电话
  • wordpress免费云储存石家庄seo结算
  • 信息安全网站建设方案书郑州模板建站代理
  • 长沙外贸公司太原seo自媒体
  • 网站的栏目设计网络营销工作内容是什么
  • 网站建设需具备的条件网站源码
  • 建一个大型网站多少钱郑州众志seo
  • 视频号网页版怎么发布视频河北电子商务seo
  • 网站建设三站合一收录优美图片崩了
  • 制作网站页面网站关键词排名
  • 橘子seo查询seo软件服务
  • 提升网站的访问速度朋友圈推广广告
  • wordpress删除小工具深圳网站建设推广优化公司
  • 龙岩网站优化中山做网站推广公司
  • 一品猪网站开发如何开展网络营销