NCF参数化建筑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 13741|回复: 9
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
1m
发表于 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 感谢分享

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
2m
 楼主| 发表于 2010-10-15 15:10:49 | 只看该作者
而且很少編碼人員是從頭開始寫程式的,通常是找到適合的模板,相互累加,在小部分的修改並擴大。 作者在文中也提及到,改變我對編程的一些基本觀念
3m
发表于 2010-10-15 16:39:15 | 只看该作者
恩,感觉有时候看编程貌似“嫁接代码”,gh的嫁接感也如此之明显。
4m
发表于 2010-10-15 19:07:08 | 只看该作者
原来像拼贴艺术
5m
 楼主| 发表于 2010-10-15 19:33:17 | 只看该作者
哈哈 誰拼的漂亮就是好程式了
6m
发表于 2010-10-16 00:53:43 | 只看该作者
原来像拼贴艺术
7m
发表于 2010-12-24 15:44:45 | 只看该作者
thanks, very good!
8m
发表于 2010-12-25 23:17:56 | 只看该作者
都是英文!加油!好好看啦!
9m
发表于 2012-4-25 11:44:20 | 只看该作者
这也可以。。。。同求
10m
发表于 2012-4-25 12:21:21 | 只看该作者
先收藏下~~~~~~

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

GMT+8, 2024-4-27 00:04 , Processed in 0.161744 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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