What makes a “production code”? [closed]

送分小仙女□ 提交于 2021-01-05 12:34:20

问题


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:


Production code generally means its ready to ship out to a client.

  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.

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 best way to think about it is:

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.

That's not all.

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.



来源:https://stackoverflow.com/questions/52009044/what-makes-a-production-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!