1
ty29022 2024-11-29 11:26:54 +08:00 不如你贴出手写的一些代码片段和 chatgpt 生成的片段来做个对比
|
2
solituders 2024-11-29 11:30:07 +08:00
不如你贴出手写的一些代码片段和 chatgpt 生成的片段来做个对比
|
3
13482034233 2024-11-29 11:33:18 +08:00
要想要好的 output, 就先得有好的 input, 所以同样一个模型, 同样一个产品业务逻辑, 有的人就能用大模型写出好的代码, 有的则不行
|
4
charlie21 2024-11-29 11:34:21 +08:00 人审核代码合理性的审核的能力 > AI 写代码的写的能力 > 人写代码的写的能力
|
5
luckyc 2024-11-29 11:35:47 +08:00
生成->使用->了解为什么这么写, 和自己设想有何出入->取舍->利用.
挺好的, 学习速度明显快了. |
6
FreshOldMan 2024-11-29 11:39:03 +08:00
chagpt o1 写的还不错
|
7
mightybruce 2024-11-29 11:39:27 +08:00 最近这种低质量的贴怎么越来越多, 来活跃社区的吗
|
8
xuefeng0578 2024-11-29 11:40:13 +08:00
面对现实吧,早点谋下其它出路
|
9
liujl 2024-11-29 11:45:45 +08:00 via Android 昨天用 claude 这可一个油猴脚本, 纯自然语言,代码规范度,质量非常不错, 程序员的出路回到家编程的本质“理解业务,设计程序业务逻辑,交互逻辑,呈现结果”
|
10
wangtian2020 2024-11-29 11:48:30 +08:00
写代码的事你少管
|
11
junas7 2024-11-29 12:21:50 +08:00 via Android
你也是出租车司机吗,来抗议 ai 智能驾驶
|
12
R4rvZ6agNVWr56V0 2024-11-29 12:24:20 +08:00
使用 AI 也有技巧的,能力不行,用 AI 也很难与同行竞争 LOL
|
13
zjh7890 2024-11-29 12:32:06 +08:00 via iPhone
路过…推荐下 JetBrains IDE 可用的类 cursor 插件,gpt-tools…
|
14
zjh7890 2024-11-29 12:33:03 +08:00 via iPhone
我时常觉得,ai 写得比我好…结构清晰…
|
15
zhouxelf 2024-11-29 12:34:24 +08:00
污染代码?? please show your code
|
16
bmpidev2019 PRO 大概率你写的代码质量不如 Claude 的高,除非是一些专业领域,它没有训练过的,但是最佳实践,编程范式,设计模式,它都能吊打你的水平。
|
17
lyxxxh2 2024-11-29 13:57:49 +08:00 ```
# 以下由 gpt 生成 def init_input_and_output_door(self): frame_results = copy.deepcopy( self.frame_results ) # self.frame_results 会被以下代码改变 找太麻烦了 直接拷贝到新对象 door_line = [[828, 438], [1208, 868]] door_area_line = [[623, 523], [1144, 982]] door_line = [[336, 0], [1698, 1222]] door_line =[[186, 0], [1428, 1222]] door_line = [[336, 0], [1698, 1222]] def is_above_line(point, line): (x1, y1), (x2, y2) = line return (y2 - y1) * (point[0] - x1) > (x2 - x1) * (point[1] - y1) def filter_boxes_above_line(frame_results, door_area_line): filtered_results = [] for frame in frame_results: filtered_boxes = [] for box in frame["boxes"]: x_min, y_min, x_max, y_max = box box_center = [(x_min + x_max) / 2, (y_min + y_max) / 2] if is_above_line(box_center, door_area_line): filtered_boxes.append(box) if filtered_boxes: filtered_frame = { "id": frame["id"], "boxes": filtered_boxes, "reid_dets": frame["reid_dets"], # 保留每个帧的 reid_dets } filtered_results.append(filtered_frame) return filtered_results filtered_frame_results = filter_boxes_above_line(frame_results, door_area_line) filtered_frame_results = [ item for item in filtered_frame_results if len(item["boxes"]) != 0 ] # 使用 IOUTracker 类 tracker = IOUTracker(iou_threshold=0.3) all_tracks = tracker.track_objects(filtered_frame_results) # 用于记录人的信息、reid_dets 和 frame_ids person_groups = defaultdict(list) person_reid_dets = defaultdict(list) person_frame_ids = defaultdict(list) for frame, track_ids in zip(filtered_frame_results, all_tracks): for box in frame["boxes"]: matching_id = [ id for id, tracked_box in track_ids.items() if tracked_box == box ] if matching_id: box.append("person_id: {}".format(matching_id[0])) person_groups[matching_id[0]].append(box[:-1]) # 不包括 person_id person_reid_dets[matching_id[0]].append( frame["reid_dets"] ) # 记录 reid_dets person_frame_ids[matching_id[0]].append( frame["id"] ) # 记录 frame id crossing_events = {} final_crossing_frames = {} # 门线参数 m = (door_line[1][1] - door_line[0][1]) / ( door_line[1][0] - door_line[0][0] ) # 斜率 c = door_line[0][1] - m * door_line[0][0] # 截距 def check_position(x, y): line_y = m * x + c return y - line_y # > 0 在线上方,< 0 在线下方 for person_id, boxes in person_groups.items(): last_pos = None entry_index = None exit_index = None # if person_id != 2: # continue for idx, box in enumerate(boxes): x_center = (box[0] + box[2]) / 2 y_center = (box[1] + box[3]) / 2 current_pos = check_position(x_center, y_center) if last_pos is not None: if last_pos > 0 and current_pos < 0: exit_index = idx elif last_pos < 0 and current_pos > 0: entry_index = idx last_pos = current_pos crossing_events[person_id] = { "input_index": exit_index, "output_index": entry_index, } for person_id, events in crossing_events.items(): person_data = [] boxes = person_groups[person_id] reid_dets = person_reid_dets[person_id] frame_ids = person_frame_ids[person_id] # 获取 frame id 列表 if events["input_index"] is not None: input_index = events["input_index"] input_frames = boxes[input_index : input_index + 3] input_reid_dets = reid_dets[input_index : input_index + 3] input_frame_ids = frame_ids[ input_index : input_index + 3 ] # 取相应的 frame ids person_data.append( { "type": "output", "all_box": input_frames, "reid_dets": input_reid_dets, "frame_ids": input_frame_ids, "ids": list( range(input_index, input_index + len(input_frames)) ), } ) if events["output_index"] is not None: output_index = events["output_index"] output_frames_start = max(0, output_index - 2) output_frames = boxes[output_frames_start : output_index + 1] output_reid_dets = reid_dets[output_frames_start : output_index + 1] output_frame_ids = frame_ids[ output_frames_start : output_index + 1 ] # 取相应的 frame ids person_data.append( { "type": "input", "all_box": output_frames, "reid_dets": output_reid_dets, "frame_ids": output_frame_ids, "ids": list(range(output_frames_start, output_index + 1)), } ) final_crossing_frames[person_id] = person_data ``` 之前让 gpt 写的。 也不是不能用,就是没一点"设计"的感觉。 让他再优化下,直接处 bug 。 逻辑越复杂,我就不敢用 ai 。 因为描述太麻烦了,得写篇作文给他。 再者很难阅读和修改。 后面我直接重写了 ``` # 定义数据 for box, person_id in zip(data["head_boxes"], person_ids): if person_id is None: continue if person_id not in self.door: # 初始化 key self.door[person_id] = [] self.user_door_status[person_id] = None # 用户和门状态 for device in self.devices: # 用户和设备状态 if person_id not in device["persons"]: device["persons"][person_id] = [] self.door[person_id].append( {"box": box, "up_or_line": self.box_line_up_or_down(box)} ) # 添加到门记录器 if len(self.door[person_id]) > 100: # 用户超过一百 self.door[person_id] = self.door[person_id][-50:] for device in self.devices: # 添加到设备记录器 if person_id not in device: device["persons"][person_id].append( self.calculate_containment_ratio(device["box"], box) ) if len(device["persons"][person_id]) > 100: device["persons"][person_id] = device["persons"][person_id][-50:] # 根据 for person_id in self.door: ... .... ``` |
18
delacey 2024-11-29 13:58:19 +08:00
@bmpidev2019 感觉程序员这行危险了,既然 ai 代码水平超过大部分程序员,那大家以后怎么和 ai 竞争呢?
|
19
justfindu 2024-11-29 14:00:00 +08:00
你都是生成直接上? 不会在给它提点要求优化一下代码和逻辑?
|
20
FreshOldMan 2024-11-29 14:04:22 +08:00
@delacey #18 就是没法竞争,不仅包括程序员
|
21
UIHIHUHIU 2024-11-29 14:12:10 +08:00
我倒觉得 ai 让很多没有什么代码基础或者说基础不好的人能写点代码了,毕竟不是每个人都是程序员,大部分人还只是有一点代码需求,但是去深入学的话太费时间了,ai 就是解决这个问题的
|
22
littlewing 2024-11-29 14:14:29 +08:00
公司给买了 Copilot ,我用他作为增强型的代码补全
|
23
bk201 2024-11-29 14:15:03 +08:00
ai 的东西不调,根本没法用,倒是很多体力活可以用它
|
24
baysonfox 2024-11-29 14:16:45 +08:00
我现在一般是写个基本逻辑 -> AI 细化-> 自己分析调整 -> AI 提建议 进一步优化性能/可读性
|
25
vsitebon 2024-11-29 14:29:24 +08:00
@mightybruce #5 金币比之前值钱了
|
26
bmpidev2019 PRO @delacey 先学会怎么用 AI 写代码,而不是自己写,汽车出来了,你还研究如何拉黄包车拉的更稳更快?难道不是学会开汽车吗
|
27
prosgtsr 2024-11-29 14:48:58 +08:00
只用过方法内的补全。感觉从代码规范上来说还不错。。不过 bug 确实也不少,还是要肉眼 debug
更复杂的直接生成方法、类,就没用过了 |
28
Jerry23333 2024-11-29 15:03:30 +08:00
在 ba 都待过,都在大力推 ai 生成代码,甚至会考核团队的使用率。
|
29
Mogugugugu 2024-11-29 15:12:09 +08:00 |
30
uzumaki 2024-11-29 15:15:24 +08:00
咋了 你现在 txt 写代码了?
|
31
murmur 2024-11-29 15:16:47 +08:00
ai 太爽了
我之前做数据对接,写的 keyvalue 格式,结果错了,要求[{key: xxx, value: xxx}]格式,我用 AI 一下就给我翻译过来了,又快有准 |
32
EdisonEdz 2024-11-29 15:18:30 +08:00
我们公司还要求 AI 生成的占比了,属于是本末倒置了
|
33
Promtheus 2024-11-29 15:23:09 +08:00
ai 只是给个建议啊 难道你一行不看直接能跑就用的吗🤣 只是更强大的智能补全而已 主要还是靠人
|
34
Greendays 2024-11-29 15:59:03 +08:00
繁琐的部分用 AI 很合适,尤其是各种格式转换,还有正则表达式。简单的部分还是自己来吧。
|
35
beryl OP |
36
beryl OP |
37
rlds 2024-11-29 16:24:41 +08:00
除非 ai 写的代码你不看,直接就用了,不然 ai 作为辅助提示和某些代码片段补全还是不错的。
|
38
james2013 2024-11-29 17:28:09 +08:00 via Android
大规模写不了
作为中小公司的程序员,面向业务开发,只要有 3 年以上经验,写业务代码只是脑力劳动,只有少数情况才用下 |
39
simpleman 2024-11-29 17:33:16 +08:00
我反正尽量使用 gpt, 有时需要用没见过的算法, gpt 一下就搞定了.
|
40
InkStone 2024-11-29 17:50:52 +08:00 - 开发者自己知道要写什么,写成什么样,用 AI 来快速完成编码这个纯劳力过程 质量 √ 速度 √
- 开发者大概知道要些什么,向 AI 提需求,能简单验证一下代码,但没什么明确预期 质量 × 速度 √ - 开发者什么都不懂,把 AI 当许愿机用,生成什么算什么 质量 × 速度 × AI 能给出什么样质量的代码,其实取决于开发自己的水平。 |
41
terrysnake 2024-11-29 18:06:16 +08:00
硅谷程序员 80% 的代码都是 AI 写的了,别在这高贵了。关键是要学会怎么和 AI 配合,提高效率。
|
42
franswish 2024-11-29 18:21:29 +08:00
@InkStone
前两条不评价,关于第三条:“- 开发者什么都不懂,把 AI 当许愿机用,生成什么算什么 质量 × 速度 ×” 你这么想,把这个开发者当许愿机,产出=0 ,因为他什么都不懂,把 AI 当许愿机,至少能给一些反馈吧,即使是不能用,大概率也是相关的 |
43
guoliim 2024-11-29 18:22:01 +08:00
好用 快用
|
44
rekulas 2024-11-29 18:23:16 +08:00
@InkStone 赞同这个观点,ai 代码水平有优有劣,要确保自己能 review 每一行代码才能 hold 住,觉得 ai 代码垃圾的,大概率自己水平估计也。。。
前几天才有个小白用 ai 写合约代码结果被盗 2k 多刀,因为 ai 代码被污染了,这就是水平差又过于依赖 ai 的后果,一个正常水平的开发者,review 代码就能发现问题了 |
46
smdbh 2024-11-29 19:09:00 +08:00
高级搜索引擎, 如果别人写的好,为什么不用
|
47
COW 2024-11-29 19:20:59 +08:00 via Android
当然可以写,但你要自己执行 review 和 test 呀,前几天好像有个老哥被 AI 删数据了
|
48
LeslieLeung 2024-11-29 19:35:53 +08:00
AI 决定下限(真的不比一些人写得差),个人能力决定上限
|
49
adgfr32 2024-11-29 19:43:20 +08:00 via Android
@terrysnake 这个 80 %怎么有股营销号的味道
|
50
zjh7890 2024-11-29 21:04:55 +08:00 via iPhone
@z1829909 按行数来算我觉得不算夸大,我目前组织业务逻和样板代码都用 ai ,大刀阔斧。做好设计就行
|
51
raycool 2024-11-29 22:40:49 +08:00
我正在主导银行采购某家代码提示助手,你和我说没用?
|
52
rpish 2024-11-29 22:46:15 +08:00
@terrysnake 好奇这个数据来源,可以分享一下吗?
|
53
terrysnake 2024-11-29 23:50:26 +08:00 @rpish 老板从硅谷回来以后说的🤣
|
54
quake0day 2024-11-30 00:20:27 +08:00
楼主可能以为自己写代码是一个艺术创作,代码是艺术表达的媒介。实际代码写作只是和流水线的工人一样,代码能够易读易懂能够顺利完成任务就行——AI 写的代码完全能够符合要求。
|
55
soul11201 2024-11-30 02:02:38 +08:00
反正使用人要对最终结果负责,只要使用的人不怕被炸死,为什么不可以用呢?
|
56
cheesepoutine 2024-11-30 02:22:43 +08:00 via iPhone
我们公司买了 chatgpt 、github copilot 、microsoft copilot 各种 ai 工具鼓励大家使用 ai 提高效率,把重复性的工作想办法交给 ai 。代码方面主要还是以补全和写框架为主吧。而且 code review 还是要人来做。
|
57
RipperJack666 2024-11-30 09:40:08 +08:00
ai 辅助工具只会让强的人更强
|
58
wu67 2024-11-30 10:11:36 +08:00
我用 Gemini 来小规模辅助还挺爽的呀,
碰到某些忘记的写法, 就找它 写我不会玩的 shell script, 也找它 无聊了也会拿一段详细描述丢进去让他实现, 跟我自己写的对比一下 ai 这东西现阶段还是看你怎么用, 当辅助工具是真不错, 但是想让它完全替你干活, 它可能就会瞎编代码了, api 都对不上的那种 |
59
xsen 2024-11-30 12:33:35 +08:00
这本身说明你在使用 ai 过程中定位存在偏差
要做复杂项目,对自身定位应该是 架构+review+测试 |
60
cctv180 2024-11-30 14:00:33 +08:00
@littlewing 公司真好啊,我只能用免费的通义灵码已经爽翻天了。😁
|
61
FlashEcho 2024-11-30 17:11:25 +08:00
sonnet 的代码质量比我高咋办,我写的质量才是真正污染代码了
|
62
qiyustart 2024-11-30 17:21:16 +08:00
|
63
zhengfan2016 2024-11-30 17:59:16 +08:00
很好奇你们用 ai 辅助生成的东西会经常一大堆注释吗,和我合作的人写的代码经常自带一堆注释,很多没用的中文注释,几乎每两三行就有一个注释,问题是这些注释特别基础,除了增加行数没有任何作用,看着很烦。
|
64
wwhontheway 2024-11-30 18:05:40 +08:00
ai 写的代码也要自己 review 的呀,相辅相成。
|
65
FgHh07ObvBiST5po 2024-11-30 20:55:42 +08:00
检验楼主点蜡烛,敲算盘
|
66
AoEiuV020JP 2024-11-30 21:33:04 +08:00
cursor composer + claude-3.5-sonnet 写的代码是真的好,基本只要审核一下是否符合需求就可以了,
其他 ai 代码只能看看,参考一下然后自己写,cursor composer 能找出要改的代码, 要加的文件,自己给你整个搞定,有理解不到位甚至一些编码质量问题都可以再沟通调整, 最大问题是次数限制不够用, |
67
archxm 2024-12-01 00:17:53 +08:00 via Android
无中生有啊。我身边似乎没人用啊
|
68
x2ve 2024-12-01 14:49:41 +08:00
我还是觉得 1 设计 2 出活 3 优化,不要过于执着于初期的代码质量,时间上不允许,通过好的设计来规避部分代码质量的问题。到了后期有盈利的项目才考虑精益求精/屎上雕花
|
69
terrysnake 2024-12-04 13:30:52 +08:00
@zhengfan2016 可以要求他如何写注释的啊,需求讲给他听就行。
|