习惯于从wiki中查找一些计算机专业用语的定义,以下为我找到的对hardcode的相关定义,利于理解

Hard coding (also, hard-coding or hardcoding) refers to the software development practice of embedding input or configuration data directly into the source code of a program or other executable object, or fixed formatting of the data, instead of obtaining that data from external sources or generating data or formatting in the program itself with the given input.

还有一个从网上摘录的定义:

hardcode:

In computer programming or text markup, to hardcode (less frequently, hard code) is to use an explicit rather than a symbolic name for something that is likely to change at a later time. Such coding is sometimes known as hardcode (noun) and it is more difficult to change if it later becomes necessary. In most programming languages, it is possible to equate a symbol with a particular name (which may also represent a number) value. If the name changes, the symbol stays the same and only the equate line of code needs to be changed to reflect the new name. When the program is recompiled, the new name is picked up wherever the symbol occurs in the code. Although there are search-and-replace tools that can change all occurrences of a given name, program code is very unforgiving in case a small error is introduced, and it is safer to have a single place in which such a change can be made. For this reason, hardcoding is usually a practice to be avoided.

举个例子,对于n-皇后的问题,如果,你在编写程序的时候,制定queen_number =6,那么你的程序就是hard coding;

然而,如果,你的程序的queen_number需要用户输入的,例如cout<<"please input queen number"<<endl; cin>>queen_number;这样就不是hard coding。,也好像是#definie NUMBER 6这样的用法

不知道是否理解正确,请大家指正^_^

hardcode 的定义相关推荐

  1. 避坑 | 早跟你说了不要写 hardcode!

    想要成为编程大牛,不仅要具备充足的理论知识,还要有在实际项目中积累的编程经验和解决问题的能力. 有时,出于经验不足或者图省事儿,我们会在开发时写很多 hardcode. 什么是 hardcode? h ...

  2. [解释]“hardcode”是什么意思?

    hardcode----硬编码. 所谓硬编码,hardcode,就是把一个本来应该(可以)写到配置信息中的信息直接在程序代码中写死了.         例如,写了一个收发邮件的程序,用户名,密码,服务 ...

  3. hardcode 什么是硬编码

    什么是硬编码?      所谓硬编码,hardcode,就是把一个本来应该(可以)写到配置信息中的信息直接在程序代码中写死了.      例如,写了一个收发邮件的程序,用户名,密码,服务器地址等最好做 ...

  4. 什么是硬编码 hardcode

    硬编码 在计算机程序或文本编辑中,硬编码是指将可变变量用一个固定值来代替的方法.用这种方法编译后,如果以后需要更改此变量就非常困难了.大部分程序语言里,可以将一个固定数值定义为一个标记,然后用这个特殊 ...

  5. 非本地类型不能定义方法 cannot define new methods on non-local type time.Duration

    能够随意地为各种类型起名字,是否意味着可以在自己包里为这些类型任意添加方法 ? 参见下面的代码演示 : package mainimport "time"type MyDurati ...

  6. etcd 笔记(06)— Client 结构定义、客户端(初始化、KV存储Get、Put、事务 Txn、压缩 Compact、Watch、Lease

    1. Client 定义 Client 定义如下: type Client struct {ClusterKVLeaseWatcherAuthMaintenance// 认证的用户名Username ...

  7. Go 知识点(05)— 类型别名与类型定义

    1. 类型别名 类型别名需要在别名和原类型之间加上赋值符号 = ,使用类型别名定义的类型与原类型等价,Go 语言内建的基本类型中就存在两个别名类型. byte 是 uint8 的别名类型: rune ...

  8. Go 学习笔记(71)— Go 接口 interface (接口定义、接口实现、接口调用、值接收者、指针接收者)

    1. 接口的定义 接口是和调用方的一种约定,它是一个高度抽象的类型,不用和具体的实现细节绑定在一起.接口要做的是定义好约定,告诉调用方自己可以做什么,但不用知道它的内部实现,这和我们见到的具体的类型如 ...

  9. 浅显易懂 Makefile 入门 (02)— 普通变量和自动变量定义、使用($@、$^、$< 作用)、变量覆盖 override、变量的来源 origin

    1. 变量的定义 Makefile 文件中定义变量的基本语法如下: 变量的名称=值列表 变量的名称可以由大小写字母.阿拉伯数字和下划线构成.等号左右的空白符没有明确的要求,因为在执行 make 的时候 ...

最新文章

  1. 关于敏捷开发和憋个大招两种开发方式的思考
  2. mysql 锁表查询和解锁操作
  3. 阿里云联合中国信通院发布《云计算开放应用架构》标准
  4. spring security加载原理(基于springboot)
  5. 操作软件_如何提升办公软件的操作能力
  6. Android中GC的触发时机和条件
  7. 线程间通信的几种方法_并发编程中的线程间通信
  8. 开发个好的RTMP播放器到底难在哪里?RTMP播放器对标和考察指标
  9. MySQL(一)存储引擎
  10. Wireshark 的使用 —— 过滤器(filter)
  11. php js多语言切换,php简单实现多语言切换的方法_php技巧
  12. Ext.Net系列:二Event之DirectEvent 示例2(Delay)
  13. 《Redis开发与运维》学习第六章
  14. linux多线程调度设置
  15. 产品读书《演讲的力量》
  16. Java实现坦克大战小游戏
  17. 需要验证的网络连接服务器,登录iCloud提示验证失败,连接到服务器时出现问题怎么办...
  18. 远程视频监控必备专业知识
  19. 吃欢天新面食的26种吃法,中国人的福音!
  20. Kotlin协程实现原理

热门文章

  1. android逆向基础教程三
  2. Stream跟String到底有啥区别
  3. IDEA 中最适合程序员的编程字体
  4. 论文中文翻译——SketchyCOCO Image Generation from Freehand Scene Sketches
  5. Fidder应用(一)
  6. summary for matplotlib(cord in python)
  7. 图形学基础知识:重心坐标(Barycentric Coordinates)
  8. 动手学深度学习-(李沐)PyTorch版本
  9. 融云即时通讯云平台获北京六局委新技术新产品认证
  10. 短边翻转一张A4纸打印18页PPT