Skip to content

zeenea/scala-best-practices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Scala coding guidelines

Theses guidelines are a consensus among the dev team and should be followed as much as possible.

They can be modified at any time by anyone but the modification PR should be approved by the whole dev team.

There is two kind of rules:

  • the [MUST] rules should not be transgressed. If some exceptions are needed, they should be specified in the rule (and accepted by the whole team)
  • the [PREFER] rules are a strong recommendation but can be transgressed if needed. A comment should explain why we need to ignore the rule.

Rules in bold are the most important ones.

Table of contents

  1. Language
  2. Functional programming
    • [PREFER] Use pure functions as much as possible
    • [PREFER] By default, use immutable values
  3. Architecture
    • [PREFER] Split technical and business code
    • [PREFER] Write a wrapper for lib that do not follow theses guidelines to adapt them
    • [MUST] Avoid using mutable shared state
    • [PREFER] Do not rely on temporal coupling
    • [MUST] Do not build an invalid object
  4. Syntax
    • [MUST] Always write type for public methods and attributes
    • [PREFER] Write type for private methods and attributes
    • [PREFER] Functions should be less than 25 lines
    • [MUST] object attributes should start with a lower case letter to avoid conflicts with types

Contribute

Open a PR with your rule and let's discuss.

To adopt a rule, the PR should be approved by every team member.

References and inspirations

They are here just as a source of inspiration, they are not included in our guidelines

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published