TDD 中的实现和生产意味着什么

What are implementation and production mean in TDD

我的问题都在标题里了。每当我搜索或研究 TDD 时,我都会遇到这些词,implementationproduction。但我不知道确切的意思,只是有假设。实施和生产的概念是什么?

例如,在这个 articleFake 部分,他或她说

假货是 objects 有有效的实施,但与生产的不同。通常他们会走一些捷径并拥有简化版本的生产代码。

Fakes are objects that have working implementations, but not same as production one.

当您编写测试时,您需要模拟某些 类(DAO、存储库...)的行为,您将编写一个新的 Class 实现,这将不同于您的生产代码。

// your production code  
class UserRepository {
    public function find(Integer id){
         // get a record from the database
         return new User(...); // populate the user from the record
    }
}

//your fake implementation for make your test passed
class FakeUserRepository {
    public function find(Integer id){
         return new User('firstname', 'lastname');
    }
}