找回密码
 注册
搜索
查看: 23457|回复: 9

[心得体会] processing handbook -- coding techinques

[复制链接]
发表于 2010-10-15 15:09:22 | 显示全部楼层 |阅读模式
Modification Changing the values of variables in existing programs is a good way to explore code.Programs can be modified by trial and error or more deliberately. One way to start understanding a program is to change slightly the value of one variable and then runthe code to see the result. If there is no obvious difference, change the value again.Making the correlation between a variable and a change in the way a program runs is a good first step to understanding how it works.These modification techniques aid in learning new skills or parsing an example. Making small changes toan existing program encourages exploration and getting a feel for the code. Augmentation Augmentation uses existing code as a base for further exploration. It is similar to but more ambitious than modification. Generic program examples can serve as a foundation for longer, more specific programs. Collage The collage technique involves cutting and pasting elements of different programs together to create a new program. It’s analogous to creating music by sampling ormaking a visual collage from newspaper and magazine clippings. In order to avoiderrors, combine code carefully by copying a few lines of code at a time and runningthe program to make sure it’s always working. Copying large portions of code canintroduce a number of simultaneous errors. Mindlessly copying and pasting code cancreate “Frankenstein” code that’s difficult to debug. Coding from scratch Rarely do programmers write a complete program entirely from scratch. At theminimum, most people start with a template. A template is an outline with codeinfrastructure common to many programs. Sometimes it’s not possible to fi nd a relatedexample or appropriate template and it’s necessary to start with a blank page.
Regardless of the technique used for programming, writing a few lines of code or
making only a few changes at a time is a good tactic. Entering many lines of untested
code before running the program increases the potential for multiple errors. The more
errors in a program, the more difficult they become to find. Running a growing program
piece by piece reduces the chance for multiple errors. As your comfort with code and
your skills increase, it becomes possible to make more modifi cations between tests.
資料 來源 processing handbook --p145
程式編碼的重要概念 !!! 4大原則 ,程式不是copy 在past 執行就好,而是每一小部分的修改,累積起來的

评分

参与人数 1强度 +3 照度 +30 收起 理由
skywoolf + 3 + 30 感谢分享

查看全部评分

 楼主| 发表于 2010-10-15 15:10:49 | 显示全部楼层
而且很少編碼人員是從頭開始寫程式的,通常是找到適合的模板,相互累加,在小部分的修改並擴大。 作者在文中也提及到,改變我對編程的一些基本觀念
回复

使用道具 举报

发表于 2010-10-15 16:39:15 | 显示全部楼层
恩,感觉有时候看编程貌似“嫁接代码”,gh的嫁接感也如此之明显。
回复

使用道具 举报

发表于 2010-10-15 19:07:08 | 显示全部楼层
原来像拼贴艺术
回复

使用道具 举报

 楼主| 发表于 2010-10-15 19:33:17 | 显示全部楼层
哈哈 誰拼的漂亮就是好程式了
回复

使用道具 举报

发表于 2010-10-16 00:53:43 | 显示全部楼层
原来像拼贴艺术
回复

使用道具 举报

发表于 2010-12-24 15:44:45 | 显示全部楼层
thanks, very good!
回复

使用道具 举报

发表于 2010-12-25 23:17:56 | 显示全部楼层
都是英文!加油!好好看啦!
回复

使用道具 举报

发表于 2012-4-25 11:44:20 | 显示全部楼层
这也可以。。。。同求
回复

使用道具 举报

发表于 2012-4-25 12:21:21 | 显示全部楼层
先收藏下~~~~~~
回复

使用道具 举报

NCFZ微信公众号

手机版|小黑屋|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 ) 辽公网安备21021102000973号

GMT+8, 2026-11-23 19:31 , Processed in 0.041615 second(s), 20 queries , Gzip On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表