简体   繁体   English

程序对您的语言和语言程序的意义

[英]Meaning of Program into Your Language and Program in Your Language

I've been reading Code Complete 2 . 我一直在阅读Code Complete 2 As I am not native english speaker some statements take some time for me to understand. 由于我不是母语为英语,因此我需要一些时间来理解。 I would like you to describe the difference between these two statements the author made in his book: 我想请你描述作者在他的书中所做的这两个陈述之间的区别:

  1. You should program into Your Language (programming language). 您应该编入您的语言(编程语言)。
  2. You shouldn't program in Your Language. 你不应该用你的语言编程。

Why in is bad and into is recommended? 为什么不好, 建议?

As I understand it, it means to think outside of the bounds of your programming language. 据我了解,它意味着超出编程语言的范围进行思考。

So in means you are thinking in terms of the language, so your thinking is limited by the language itself, and the program you write may not be easily translated into some other language if needed. 因此, 意味着您正在考虑语言,因此您的思考受到语言本身的限制,如果需要,您编写的程序可能不会轻易翻译成其他语言。

But into means you think in algorithms, ie freely, then translate into your desired language. 进入意味着你想在算法,即自由,然后翻译成你想要的语言。 So you can easily code in any language you know the syntax of. 因此,您可以使用您知道语法的任何语言轻松编写代码。

But as I have not read the book actually, this may be totally wrong per the context. 但由于我实际上没有读过这本书,因此根据上下文这可能是完全错误的。

Program into your language means that you use the language to construct the "missing" pieces - leverage it to do more than it currently does. 编程您的语言意味着您使用该语言来构建“缺失”部分 - 利用它来做比现在更多的事情。 Things like creating missing data structure, algorithms and ways of accomplishing tasks that are not native to the language. 比如创建缺少数据结构,算法以及完成非本地语言任务的方法。

Program in your language means just that - not trying to leverage it. 您的语言编写的程序就是这样 - 不要试图利用它。

I thought the examples given in the book were quite good. 我认为书中给出的例子非常好。

The author provides an example of his own in that part of the book (which unfortunately I don't remember). 作者在本书的那一部分提供了他自己的一个例子(不幸的是我不记得了)。 You can try reading a bit further. 你可以尝试进一步阅读。

It means that even if the language doesn't support a particularly convenient feature, as you should always think of writing readable, easy to maintain, modular code, you should try to find a way to emulate that feature even if its not enforced by the language, then you would document that, so that other developers who may modify the code stick to the same rule. 这意味着即使语言不支持特别方便的功能,因为您应该始终考虑编写可读,易于维护的模块化代码,您应该尝试找到一种方法来模拟该功能,即使它没有被强制执行语言,然后你会记录,以便其他可能修改代码的开发人员遵守相同的规则。 I can't provide an example right now, but I think is easy to see the rationale. 我现在不能提供一个例子,但我认为很容易看到理由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您使用新技术或编程语言的标准 - Your criteria in using a new technology or programming language 创建您的第一种编程语言比您想象的容易吗? - Creating your first programming language is easier than you think? 何时将现有程序升级到新的语言功能? - When to upgrade an existing program to new language features? 如何只使用您的程序可用的带宽 - How to only barely use the bandwidth available to your program 在你的第一个程序中,哪个构造吸引你编程? - On your very first program, which construct hooked you on programming? codepad.org和ideone.com等网站如何沙盒你的程序? - How do sites like codepad.org and ideone.com sandbox your program? 是否有可能构建一个图灵完备语言,其中每个字符串都是正确的程序? - Is it possible to construct a turing-complete language in which every string is a correct program? 你把计算放在你的集合或你的得分上吗? - do you put your calculations on your sets or your gets . 项目中的国际化 - Internationalization in your projects 在OO中使用函数式语言概念 - 是否有语言? - Using functional language concepts with OO - is there a language?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM