Ballerina Programming Language - best practices guide
Welcome to the best practices guide of Ballerina programming language!
Ballerina is an open-source programming language for the cloud that makes it easier to use, combine, and create network services.
This is a collection of best practices on using various Ballerina concepts and functionalities. This guide is opinionated and not Ballerina's official documentation. You won't find a list of every Ballerina syntax and standard library usage help here. Rather, you'll find a concise list of highly recommended options. The list is growing!
Let’s begin coding effectively in Ballerina.
If you are interested in contributing to this book, check out the contribution guidelines.
Project best practices
How to use Ballerina's features to create clean, effective code organized properly in the file system.
- Structure your code
- Naming conventions
- Format the code
- Logging
- Documenting the source code
- Configuration management
- Dependency management
Language best practices
List of common Ballerina language best practices to follow.
Optionality and nil values
Values and types
Functions and parameters
- Using included record parameters
- Use expression-bodied functions
- Use tuples to return multiple values
Error handling
Records
Objects
Working with constants and strings
- Using constants
- Handle unions of string constants
- Handle unions of integer constants
- Concatenate string values
Conditionals
Query expressions
Common best practices guide
These are common some best practices which are common for any language.