Ad

scala-style-guide: Concise Scala Coding Conventions

Enforces standardized coding practices for Scala development, promoting readability, maintainability, and robustness in Databricks projects.
Screenshot of databricks/scala-style-guide homepage

The scala-style-guide provides a set of conventions for writing clear, consistent, and maintainable Scala code. It's based on the experience of Databricks engineers working on large-scale projects and incorporates best practices from the Scala community. This guide aims to improve code readability, reduce bugs, and facilitate collaboration among team members. We advocate for writing simple, understandable code to enhance long-term project health.

This guide offers specific recommendations on naming conventions, line length, and code structure, fostering a unified coding style across Databricks projects. It details best practices for language features like case classes, concurrency, and Java interoperability, contributing to robust and efficient Scala applications. The guide’s focus on maintainability makes it valuable for large, evolving codebases and promotes consistent code reviews.

  • Naming Convention: Follows Java conventions for classes, traits, and packages; camelCase for methods and variables; uppercase for constants. - Line Length: Limits lines to 100 characters, with exceptions for long statements and URLs. - Case Classes and Immutability: Encourages the use of case classes for data representation and promoting immutability for thread safety. - Concurrency: Provides guidelines for using concurrent collections and synchronization primitives for efficient parallel processing. - Java Interoperability: Offers advice on best practices when interacting with Java code, addressing common pitfalls. - Testing: Focuses on exception handling strategies to ensure robust application behavior. - Well-tested methods: Prioritizes using existing well-tested methods rather than reinventing the wheel.

This guide is actively maintained and regularly updated with new language features and best practices. It has a history of revisions since its initial release in 2015 and continues to adapt to the evolving Scala ecosystem. Extensive translations indicate community engagement. The guide is well-documented, with a comprehensive table of contents and detailed explanations.

This resource benefits Scala developers by providing a structured approach to writing high-quality code. It improves code consistency, enhances collaboration, and facilitates long-term maintainability. It's especially valuable for teams working on large, complex projects, enabling a shared understanding and reducing technical debt.

Summarize:
Share:
Stars
2,803
Forks
580
Issues
14
Created
11 years ago
Commit
2 years ago
License
None
Archived
No
Updated 17 days ago

Similar Repositories