. NET technology-. Net theoretical data-amoskeag coding rules

Source: Internet
Author: User
Amoskeag coding rules

For the Code created for BSD amoskeag project, the rules below supersede HSL coding guidelines. note that these are not guidelines, but hard rules. no code will be accepted if not complying with these rules. some of the Rules contain recommendations; only those are not required.

Note that the existing Code does not comply with the rules 100%, although it mostly does. since we request 100% compliance from our developers I suggest that QC engineers check every submission for full rule compliance and collect their statistics from submissions only.

Main rule:

    1. Follow existing code structure and conventions as much as possible. We have to maintain existing development style to have our code accepted.

File rules:

    1. when adding new files: maintain project structure (determine appropriate project and project folder); Maintain folder structure; Start file name with "AECB" prefix, continue with "UI ", "uicmd", "uidlg" as appropriate, then follow with object/function name. for database object and their implementations continue with "col", "dbcol" or "impcol" as appropriate, then object name. extension shocould be ". CPP ".
    2. header files shocould have the same names as source files, extension replaced ". H ". header files have their own structure: headers local to project go to the project's own "Inc" folder; inter-project headers go to "Source \ Inc" or "Source \ inci" folders-as determined by Autodesk reviewer.
    3. deleting or moving of existing files is not allowed unless authorized by Autodesk reviewer.
    4. every source or header file shoshould have the standard Autodesk header. See existing code.

Resource rules:

    1. Resources and export definitions shocould be added to the appropriate existing files.
    2. All strings visible to users have to be entered as resources. strings that are not visible to users but required for certain Api have to use _ DNT macro.
    3. Use aecrmcstring and aecrmcstringarray classes for resource strings; Use appropriate macros to convert to aecrmcstring. No MFC string classes allowed.
    4. When passing strings as function parameters, use const-reference for input and or reference for output strings.
    5. Messages can be displayed with afxmessagebox or AC print function. prompts shoshould use appropriate AEC utilities with monitors.

User Interface rules:

    1. Use MFC for all UI tasks, use MFC types when appropriate extends t strings.
    2. Allocate twice as much space as required for English strings for static strings in dialogs.
    3. Try to match existing dialogs in terms of fonts and layouts.
    4. Dialogs shoshould be based on AEC uidlg base classes.

Naming rules:

    1. Class names obey the same Convention as file names. No additional prefixes or suffixes. Class Name shocould be the same as file name.
    2. Hungarian variable naming convention is strictly enforced, including using "M _" for member variable names. the Convention is extended to use some AECB-specific object prefixes, such as "ID" for object IDs or "CS" for strings. again, follow existing code as much as possible.
    3. Class and type names shocould start from capital letters; function names start from small letters. no underscores shocould be used in any names (could t for member variable prefix); New Words in names start with capital letters.

Coding rules:

  1. Multiple class definitions in the same file are not allowed, using t nested (classes within classes or functions) classes.
  2. Global functions or variables are not allowed, when T when required by APIs.
  3. Use aec_assert macro to check developer error conditions, such as function parameters and important intermediate check-points. try to fail graciously (prevent crashes) in case of an assertion. standard assertions or console print-outs shoshould not be used.
  4. Use try-catch clses only for specific exceptions that represent expected failures. Never catch all exceptions: Catch (...).
  5. Check returned error codes from the utility functions and add appropriate logic to handle error conditions.
  6. All local variables have to be initialized when defined, all member variables have to be initialized in the appropriate constructors. Exception: variables with appropriate Default constructors. Limited scope variables are encouraged.
  7. Use MFC or STL for Algorithmic utilities (vectors, maps), but try to minimize type conversions. Use AEC/AECB algorithmic utilities when possible.
  8. Use enumerations for all logical state flags as appropriate. Do not hard-code numbers when coding logical statements.
  9. Use const statements as appropriate for accessors or non-modifying functions in data classes. Use const references/pointers for Object-type parameters not modified by functions.
  10. Do not use any technologies that are not used by the existing Code; we cannot introduce new dependencies Unless specially permitted.

Code layout rules:

    1. Indent code with tab of size 4 (Set Tab and indent size as 4 and use "Keep Tabs" option ).
    2. {And} symbols and return statements must appear on their own lines.
    3. Use empty lines to denote logical code blocks.

Commenting rules:

    1. Fixed format comments are required for every function in source files and every class in header files. see existing code. no standard comments required for functions in header files, but section comments encouraged. member variables shocould have comments on the same line after their definition.
    2. Source code comments are very important and shoshould follow standard commenting rules.

Submission rules:

    1. Every code submission must represent a reasonably completed feature or a defect fix. review your changes carefully before submission. make sure words are spelled correctly. cosmetic changes or changes not related to the implemented feature or defect fix will not be accepted.
    2. Every submission must be accompanied by the description created with subdoc tool. See tool documentation and project specific instructions about the submission information to enter.
    3. All compiler warnings have to be resolved before submission.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.