effectiveness

Practices that keep code clear.

Effectiveness is Arandu’s decision guide: how to name, model state, handle failure, and use the compiler with less surprise.

the general rule

Make the decision visible in code.

Good conventions reduce uncertainty for the person reading, calling, and maintaining an API.

01

Clarity in use

An API is judged where it is called, not only where it is declared.

functions · names · contracts

02

Controlled state

Start with immutable values and make every mutation visible.

let before mut

03

Failure in the type

An operation that can fail should show it in its return value.

Result<T, E>

04

Memory with an owner

Transfer ownership when a function takes responsibility; borrow when it only needs access.

own and ref

quick decisions

Which tool should you use?

Ask what the type needs to communicate before choosing a construction.

an example

Clarity at the point of use.

The function tells a complete story: it receives a reference, returns a result, and names the business rule.

account.aru
module account

public struct Account {
    balance: i64
}

public func decrease_balance(account: ref mut Account, amount: i64): Result<i64, Error> {
    if amount > account.balance {
        return Result.Err(.InsufficientBalance)
    }
    return Result.Ok(account.balance - amount)
}

in practice

The compiler participates in review.

Make a small change, run arandu check, read the diagnostic, and only then execute. An effective loop is short: intent, code, verification, feedback.