是否有一种编程语言可以通过设计测试或至少在可测性方面表现出非常好的属性?
例如,被设计为使得单元测试是编码过程的非可选部分的编程语言,或者更好地,其中从单元测试中或多或少地推断出程序的编程语言。
或者如果你喜欢扭曲的问题,什么命令式编程是不好的做法或不必要的,以确保可测试性?
面向对象编程怎么样?像dependency injection和嘲笑图书馆真的帮助TDD,这些做法不会从作为语言设计的一部分受益?我一直在环顾四周,丰富的元模型的语言往往允许非常类似于DSL的API以目标语言编写。这些库正在构建的基础上,为什么不把这些东西拉入语言本身?
我发现James 07引用的blog post有一个很好的点。
Not long ago,I reflected on my
testing habits for the past ten years,
and I made a couple of interesting
observations:
- I feel the need to write tests for the code that I write very often.
- Just as often,that need is thwarted by environmental constraints,so I end
up not writing these tests.
你同意动态编程语言使写测试更容易的说法吗?
Google正在努力开发
noop作为一种语言(OOP,基于Java),用于生成始终可测试的代码。
原文链接:https://www.f2er.com/javaschema/282436.htmlNoop is a new language that will run on the Java Virtual Machine,and in source form will look similar to Java. The goal is to build dependency injection and testability into the language from the beginning,rather than rely on third-party libraries as other languages do.