什么是“生产代码"? [英] What makes a "production code"?

查看:661
本文介绍了什么是“生产代码"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名研究科学家,我们的编码方式绝对不被认为是生产代码",即原型代码,但是是什么构成了生产代码?测试可扩展性、处理实时流量的能力并测试所有边缘情况 ?但是还有什么,例如我还听说 Python 不像 Java 或 C# 那样是一种生产语言",它们能够生产的标准是什么.

I am a Research Scientist, and definitely the way we code is not considered "production code" that's prototypical code, but then what makes a production code ? Testing for scalability, ability to handle real time traffic and testing all edge cases ? But what else, for instance I also hear Python is less of a "production language" that Java or C#, what is the criteria for them to be production-able.

任何将这一点带回家或将其升华的书籍/参考资料也很棒!提前致谢

Any books/references drawing this point home or to sublime it, would also be great! Thanks in advance

推荐答案

生产代码通常意味着它已准备好交付给客户.

  1. 修复了最明显的错误
  2. 代码结构良好且自我记录
  3. 编写了自动化测试并具有足够的覆盖水平
  4. 在被纳入主代码库之前,它已经过同行评审流程.
  5. 它将通过构建系统"可能会自动检查规则,如:编码约定、复杂性、linting、测试、编译.有时,这可能包括成功部署到测试环境.
  1. Most obvious bugs are fixed
  2. code is well-structured and self-documenting
  3. Automated Tests are written and have a sufficient level of coverage
  4. It's gone through a peer review process before being incorporated into the main code base.
  5. It will pass the "build system" may automatically check rules like: coding conventions, complexity, linting, testing, compilation. Sometimes this may include deployment success to a testing environment.

这与非生产代码相比如何?

几乎所有开发人员都从原型/非生产代码开始,甚至使用测试驱动开发 (TDD) 的开发人员也是如此.他们的代码的目标是让这个工作".这样他们就可以开发出解决问题的第一遍方法.这通常会导致变量命名不当、函数过长(命令数量)、格式不正确以及通常很少或没有测试.

How would this compare to non-production code?

Nearly all developers start with prototype/non-production code, even developers that use Test Driven Development (TDD). The goal of their code is to "just make this work" so they can develop a first pass approach to a problem. Often this will lead to poorly named variables, excessively long (number of commands) functions, improperly formatted and often little or no tests.

一旦开发人员有了令人满意的工作解决方案,他们就会返回并清理代码.他们修复拼写错误;使用设计模式,如果他们看到有用的;他们使他们的代码适合团队的编码约定和风格指南,其中一些导致关于使用 制表符与空格.

Once a developer has a satisfactory working solution, they go back and clean up the code. They fix spelling errors; use design patterns, if they see one that's helpful; they make their code fit the teams coding conventions and style guide, some of which lead to real heated debates on using tabs vs spaces.

编写代码的第一步是编写软件草案,将开发人员的想法放在页面上,直到他们拥有自己的故事".或功能集.目标是让他们理解它.

The first pass at writing code is a software draft that is to get the developers ideas on the page until they have their "Story" or functionality set. The goal is for them to understand it.

第二遍,即为生产做好准备是对其进行改进,以便其他人可以理解他们的代码.就论文写作而言,您正在赋予它一个更加连贯的结构,并试图更好地将您的意思传达给其他人.

The second pass, i.e., getting it ready for production is refining it so that other people can understand their code. In paper writing terms, you're giving it a more coherent structure and improve trying to convey your meaning to other people better.

虽然这通常适用于编写代码,但部分内容是准备好用于生产";包括与实际应用程序代码无关的所有步骤.

While this will generally apply to writing code, part of saying something is "ready for production" is including all the steps not involved with the actual application code.

通常是将代码交到客户手中或上线所需的所有步骤.

Often it's all the steps needed to get the code into the clients hands or live.

这可能是创建一个持续集成持续部署系统.设置服务器、部署组、监控系统等.

This could be creating a Continuous Integration and Continuous Deployment system. Setting up servers, deployment groups, monitoring systems and so on.

如果没有这些东西,您的应用程序可能不会被您的组织视为生产就绪.

Without these things your application may not be considered production ready by your organization.

这篇关于什么是“生产代码"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆