[英]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: 我想请你描述作者在他的书中所做的这两个陈述之间的区别:
- You should program into Your Language (programming language). 您应该编入您的语言(编程语言)。
- 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.