Skip to content

MarriedGames/coding-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💻 Code Standards and Guidelines

This repository contains guides of best practices for software development, covering processes, code standards, and tools.

Table of Contents

  1. Project Management
  2. Git Processes
  3. Technology Guides
  4. Code Standards
  5. Quality Assurance
  6. Infrastructure & Security

Project Management

These guides detail the processes and standards for project and task management:

Git Processes

These guides detail the processes that the team should follow when using Git, ensuring consistency, quality, and efficiency in software development:

  • Branches - Structure, naming, and workflow with branches
  • Commits - Standards for commit messages and best practices
  • Pull Requests - Creation, review, and merging of pull requests
  • Code Review - Guidelines for effective code review

Technology Guides

Each file contains specific best practices for a technology:

Web Development

  • JavaScript - Best practices guide for JavaScript
  • TypeScript - Best practices guide for TypeScript
  • Vue.js - Best practices guide for Vue.js
  • Nuxt.js - Best practices guide for Nuxt.js

Backend & Database

  • Python - Best practices guide for Python
  • .NET - Best practices guide for .NET development
  • Supabase - Best practices guide for Supabase usage with Nuxt and TypeScript

Game Development

  • C++ - Best practices guide for C++ development
  • Unity - Best practices guide for Unity game development
  • Unreal Engine - Best practices guide for Unreal Engine development
  • Godot - Best practices guide for Godot Engine and GDScript

Code Standards

The following code standards are applicable to all projects:

Code Quality

  1. Function Design

    • Functions should do only one thing and do it well
    • Keep functions small (ideally less than 20 lines)
    • Functions should have a single level of abstraction
  2. Variable Naming

    • Use names that reveal intent
    • Use pronounceable names
    • Use searchable names
    • Avoid encodings
  3. Class Design

    • Follow the Single Responsibility Principle
    • Encapsulate related data and behavior
    • Maintain high cohesion
  4. Conditional Logic

    • Use descriptive variables to explain complex conditions
    • Extract complex conditions into well-named functions or variables
    • Replace magic numbers with named constants
    • Group related conditions to express business logic
    • Avoid deep nesting of conditionals
    • Consider using early returns to simplify logic

Common Anti-patterns to Avoid

  1. God Objects/Classes
  2. Magic Numbers/Strings
  3. Deep Nesting
  4. Complex Inline Conditions

Quality Assurance

Testing

  • Write unit tests for all new code
  • Maintain test coverage above 80%
  • Follow the AAA pattern (Arrange, Act, Assert)
  • Use meaningful test descriptions
  • Test success and failure cases
  • Mock external dependencies appropriately
  • Keep tests independent and isolated
  • Write integration tests for critical paths
  • Use appropriate testing frameworks (pytest for Python, Jest for TypeScript, Pest for PHP)
  • Implement E2E tests for critical user journeys

Documentation

  • Keep README files updated
  • Document setup and installation procedures
  • Include API documentation for public interfaces
  • Add inline comments for complex logic
  • Document configuration options
  • Keep documentation close to the code it describes
  • Include examples for common use cases
  • Document significant changes
  • Maintain a CHANGELOG
  • Include troubleshooting guides for common issues

Infrastructure & Security

Security Best Practices

  • Follow OWASP security guidelines
  • Implement proper authentication and authorization
  • Sanitize all user inputs (trim, escape, validate)
  • Use environment variables for sensitive data
  • Implement proper session management
  • Use HTTPS for all network communications
  • Regular security dependency updates
  • Implement rate limiting where appropriate
  • Use prepared statements for database queries
  • Implement proper CORS policies: Don't use '*'

Performance

  • Optimize database queries
  • Implement caching strategies
  • Minimize HTTP requests
  • Use appropriate data structures
  • Implement pagination for large data sets
  • Optimize assets (images, scripts, styles)
  • Use lazy loading where appropriate
  • Monitor memory usage
  • Profile code for bottlenecks
  • Consider scalability in design decisions

Accessibility

  • Follow WCAG 2.1 guidelines
  • Use semantic HTML elements
  • Provide alternative text for images
  • Ensure keyboard navigation
  • Maintain proper color contrast
  • Support screen readers
  • Implement ARIA labels when necessary
  • Test with accessibility tools
  • Support text resizing
  • Provide focus indicators

Reliability

  • Implement proper error handling
  • Add logging and monitoring
  • Use circuit breakers for external services
  • Implement retry mechanisms
  • Handle network failures gracefully
  • Implement proper backup strategies
  • Monitor system health
  • Have fallback mechanisms
  • Implement proper validation
  • Use feature flags for risky changes

Maintainability

  • Follow SOLID principles
  • Keep code modular and loosely coupled
  • Use dependency injection
  • Maintain consistent coding style
  • Keep dependencies updated
  • Remove unused code and dependencies
  • Write self-documenting code
  • Use appropriate abstraction layers
  • Maintain proper folder structure
  • Regular code refactoring

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors