Snowball Docs
SocialsContributeTry out online!Standard Library
  • 👋Welcome to snowball!
  • Overview
    • 🐈Why Snowball
    • ✨Language Features
  • fundamentals
    • 🛠️Getting started
    • 📝Installation
      • ‼️Common install issues
    • 👶Hello world!
  • language reference
    • 🌐Global Scope
    • 🤖Functions
      • 🐣Basic syntax
      • 😵Function Generics
      • ❓External functions
      • 🔧Function Attributes
      • 💢LLVM Functions
      • 🚪Program Entries
    • 🎭Types
      • 🔢Primitive types
      • 🔀Reference types
      • ☝️Pointer types
      • 🔓Mutability
      • ⁉️Type generics
      • 🔖Type aliases
      • 🚯Unknown pointer type (void pointers)
    • 🔄Casting
      • 🔐Mutability casting
      • 🦺Dynamic casting
      • 👨‍🎓Type conversions
    • 🏗️Classes
      • 💼Members
      • 🔒Access qualifiers
      • 🛑Final classes
      • 🍧Abstract classes
    • 🔏Access qualifiers
    • ⚒️Macros
      • ✨Builtin macros
    • 🔫Unsafe snowball
    • 😴Generics
    • 🌳Code Flow
      • ☝️If statements
    • 📦Modules
      • 👉Using Statement
  • snowball cli usage
    • 💻CLI usage and parameters
    • 🧪Testing mode
  • Confy
    • ⚙️Getting Started
    • 🐈Snowball's Schema
  • Reky Package Manager
    • 📦Getting Started
  • coding style
    • 💅The desired standard
Powered by GitBook
On this page
  • Naming Conventions
  • Class syntax

Was this helpful?

Edit on GitHub
  1. coding style

The desired standard

A "perfect" coding style for an object-oriented programming language like Snowball is subjective, and it can vary depending on your team's preferences and project requirements. However, this is the official standard Snowball uses for their projects and is considered the best practice.

Naming Conventions

It's recommended to use lowercase letters for variable names, with words separated by underscores (snake_case).

let length = 25;
let mut my_class;

Class names should use CamelCase, with the first letter of each word capitalized. They shall be descriptive and full worded too!

// Good!
class MyClass {}

// Meh...
class MyVectorIter {} // suggestion: MyVectorIterator

// Absolutely not! 🤮
// * Start's with lowercase
// * No clear word case
class _Hello_there {}

Function names should also use lowercase letters with words separated by underscores.

👍 func print_something() {}
👎 func PrintSomething() {}

Additionally, it's important to choose descriptive names that accurately and succinctly reflect the purpose and function of the variable, class, or function.

Class syntax

In the snowball source code, we use tabs with 2 spaces only. This makes it good to create a clear and concise syntax declaration for the class.

Static functions should be bottom of the class and private/public in separate blocks.

class Application {
    let title: String = "";
  public:
    Application() {}
    func get_title() { ... }
}

PreviousGetting Started

Last updated 1 year ago

Was this helpful?

💅