Jump to content

Talk:03 Coding Standards & Guidelines: Difference between revisions

Add topic
From HEIN+FRICKE
Artha.kadamb@heinfricke.team (talk | contribs)
Artha.kadamb@heinfricke.team (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== 1 Purpose ==
== 1. Purpose ==
This document defines the coding standards and guidelines to ensure consistency, readability, maintainability, and quality across all software development projects within the organization.  
This document defines the coding standards and guidelines to ensure consistency, readability, maintainability, and quality across all software development projects within the organization.  


== 2 Scope ==
== 2. Scope ==
These standards apply to all developers, contractors, and third parties who contribute to software development for Hein Fricke.
These standards apply to all developers, contractors, and third parties who contribute to software development for Hein Fricke.


== 3 General Principles ==
== 3. General Principles ==


* Code must be clean, consistent, and self-explanatory.
* Code must be clean, consistent, and self-explanatory.
Line 13: Line 13:
* Ensure cross-platform and cross-browser compatibility where applicable.
* Ensure cross-platform and cross-browser compatibility where applicable.


== 4 Coding Conventions ==
== 4. Coding Conventions ==


=== Naming Conventions ===
=== 4.1 Naming Conventions ===
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 43: Line 43:
|}
|}


=== Indentation and Spacing ===
=== 4.2 Indentation and Spacing ===


* Use 4 spaces per indentation level (no tabs).  
* Use 4 spaces per indentation level (no tabs).  
Line 49: Line 49:
* Leave a blank line between method definitions.  
* Leave a blank line between method definitions.  


=== Line Length ===
=== 4.3 Line Length ===


* Maximum of 120 characters per line.
* Maximum of 120 characters per line.


=== File Structure ===
=== 4.4 File Structure ===


* One class/component per file.  
* One class/component per file.  
Line 59: Line 59:
* Group logically related functions and classes.  
* Group logically related functions and classes.  


== 5 Language-Specific Standards ==
== 5. Language-Specific Standards ==


=== JavaScript/TypeScript ===
=== 5.1 JavaScript/TypeScript ===


* Use `const` and `let`, avoid `var`.  
* Use `const` and `let`, avoid `var`.  
Line 68: Line 68:
* Use ES6+ syntax.  
* Use ES6+ syntax.  


=== Python ===
=== 5.2 Python ===


* Follow PEP8 standards.  
* Follow PEP8 standards.  
Line 74: Line 74:
* Document functions with docstrings.  
* Document functions with docstrings.  


=== Java ===
=== 5.3 Java ===


* Follow Oracle Java Code Conventions.  
* Follow Oracle Java Code Conventions.  
Line 80: Line 80:
* Use appropriate access modifiers.  
* Use appropriate access modifiers.  


=== HTML/CSS ===
=== 5.4 HTML/CSS ===


* Use semantic HTML tags.  
* Use semantic HTML tags.  
Line 86: Line 86:
* Use BEM naming for CSS classes.
* Use BEM naming for CSS classes.


== 6 Version Control ==
== 6. Version Control ==
Use Git for source control.


Commit messages should be clear and follow the format:
* Use Git for source control.
* Commit messages should be clear and follow the format:


<type>: <short description>   
<blockquote><type>: <short description>   


[optional body]  
[optional body]  


[optional footer]  
[optional footer] </blockquote>


Common commit types: feat, fix, docs, style, refactor, test, chore.  
* Common commit types: feat, fix, docs, style, refactor, test, chore.


== 7 Code Review ==
== 7. Code Review ==


* All code must be reviewed via pull requests.  
* All code must be reviewed via pull requests.  
Line 109: Line 109:
** Security and performance issues  
** Security and performance issues  


== 8 Testing ==
== 8. Testing ==


* Write unit tests for all functions/methods.  
* Write unit tests for all functions/methods.  
Line 116: Line 116:
* Use automated CI pipelines for running tests.  
* Use automated CI pipelines for running tests.  


For more details refer document JUnit_Test_Cases_Document.docx
For more details refer document [[JUnit_Test_Cases_Document.docx]]


== 9 Documentation ==
== 9. Documentation ==


* All public APIs, classes, and modules must be documented.  
* All public APIs, classes, and modules must be documented.  
Line 127: Line 127:
** Usage examples  
** Usage examples  


== 10 Security Practices ==
== 10. Security Practices ==


* Validate all user input.  
* Validate all user input.  

Latest revision as of 11:24, 22 December 2025

1. Purpose[edit | edit source]

This document defines the coding standards and guidelines to ensure consistency, readability, maintainability, and quality across all software development projects within the organization.

2. Scope[edit | edit source]

These standards apply to all developers, contractors, and third parties who contribute to software development for Hein Fricke.

3. General Principles[edit | edit source]

  • Code must be clean, consistent, and self-explanatory.
  • Follow the DRY (Don't Repeat Yourself) principle.
  • Optimize for readability over cleverness.
  • Include meaningful comments where necessary.
  • Ensure cross-platform and cross-browser compatibility where applicable.

4. Coding Conventions[edit | edit source]

4.1 Naming Conventions[edit | edit source]

Element Convention Example
Classes PascalCase EmployeeManager
Functions/Methods camelCase calculateSalary()
Variable camelCase employeeName
Constants UPPER_CASE_SNAKE_CASE MAX_RETRIES
Files kebab-case or snake_case employee-manager.js

4.2 Indentation and Spacing[edit | edit source]

  • Use 4 spaces per indentation level (no tabs).
  • Place opening braces on the same line.
  • Leave a blank line between method definitions.

4.3 Line Length[edit | edit source]

  • Maximum of 120 characters per line.

4.4 File Structure[edit | edit source]

  • One class/component per file.
  • Keep imports at the top.
  • Group logically related functions and classes.

5. Language-Specific Standards[edit | edit source]

5.1 JavaScript/TypeScript[edit | edit source]

  • Use `const` and `let`, avoid `var`.
  • Prefer arrow functions.
  • Use strict equality (===).
  • Use ES6+ syntax.

5.2 Python[edit | edit source]

  • Follow PEP8 standards.
  • Use type hints for function signatures.
  • Document functions with docstrings.

5.3 Java[edit | edit source]

  • Follow Oracle Java Code Conventions.
  • Use JavaDocs for documentation.
  • Use appropriate access modifiers.

5.4 HTML/CSS[edit | edit source]

  • Use semantic HTML tags.
  • Use external stylesheets.
  • Use BEM naming for CSS classes.

6. Version Control[edit | edit source]

  • Use Git for source control.
  • Commit messages should be clear and follow the format:

<type>: <short description>

[optional body]

[optional footer]

  • Common commit types: feat, fix, docs, style, refactor, test, chore.

7. Code Review[edit | edit source]

  • All code must be reviewed via pull requests.
  • At least one peer reviewer is required before merging.
  • Reviewers should check for:
    • Adherence to coding standards
    • Readability and clarity
    • Test coverage and documentation
    • Security and performance issues

8. Testing[edit | edit source]

  • Write unit tests for all functions/methods.
  • Maintain at least 80% code coverage.
  • Include integration and end-to-end tests where applicable.
  • Use automated CI pipelines for running tests.

For more details refer document JUnit_Test_Cases_Document.docx

9. Documentation[edit | edit source]

  • All public APIs, classes, and modules must be documented.
  • Use tools like JSDoc, Sphinx, or Swagger as appropriate.
  • Maintain a project README.md with:
    • Project purpose
    • Setup instructions
    • Usage examples

10. Security Practices[edit | edit source]

  • Validate all user input.
  • Use parameterized queries to prevent SQL injection.
  • Never store passwords in plain text.
  • Sanitize data before rendering on the UI.

11. Compliance & Enforcement[edit | edit source]

  • All developers must acknowledge this document.
  • Non-compliance may result in code rejection or disciplinary action.
  • Regular audits will be conducted.

12. References[edit | edit source]