Changeset View
Changeset View
Standalone View
Standalone View
src/docs/contributor/general_coding_standards.diviner
@title General Coding Standards | @title General Coding Standards | ||||
@group standards | @group standards | ||||
This document is a general coding standard for contributing to Phabricator, | This document is a general coding standard for contributing to Phorge, | ||||
Arcanist, and Diviner. | Arcanist, and Diviner. | ||||
= Overview = | = Overview = | ||||
This document contains practices and guidelines which apply across languages. | This document contains practices and guidelines which apply across languages. | ||||
Contributors should follow these guidelines. These guidelines are not | Contributors should follow these guidelines. These guidelines are not | ||||
hard-and-fast but should be followed unless there is a compelling reason to | hard-and-fast but should be followed unless there is a compelling reason to | ||||
deviate from them. | deviate from them. | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | - Strongly prefer to drive optimization decisions with hard data. Avoid | ||||
optimizing based on intuition or rumor if you can not support it with | optimizing based on intuition or rumor if you can not support it with | ||||
concrete measurements. | concrete measurements. | ||||
- Prefer to optimize code which is slow and runs often. Optimizing code which | - Prefer to optimize code which is slow and runs often. Optimizing code which | ||||
is fast and runs rarely is usually a waste of time, and can even be harmful | is fast and runs rarely is usually a waste of time, and can even be harmful | ||||
if it makes that code more difficult to understand or maintain. You can | if it makes that code more difficult to understand or maintain. You can | ||||
determine if code is fast or slow by measuring it. | determine if code is fast or slow by measuring it. | ||||
- Reject performance discussions that aren't rooted in concrete data. | - Reject performance discussions that aren't rooted in concrete data. | ||||
In Phabricator, you can usually use the builtin XHProf profiling to quickly | In Phorge, you can usually use the builtin XHProf profiling to quickly | ||||
gather concrete performance data. | gather concrete performance data. | ||||
= Naming Things = | = Naming Things = | ||||
- Follow language-specific conventions. | - Follow language-specific conventions. | ||||
- Name things unambiguously. | - Name things unambiguously. | ||||
- Choose descriptive names. | - Choose descriptive names. | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0