Crystal Anti-Patterns Overview
Crystal Anti-Patterns Overview
Not Leveraging the Type System
Not Leveraging the Type System
Using Exceptions for Control Flow
Using Exceptions for Control Flow
Not Using Proper Nil Handling
Not Using Proper Nil Handling
&.
), nil checks, or the try
method. This makes your code more robust and prevents nil-related runtime errors.Mutable Global State
Mutable Global State
Not Using Named Arguments for Clarity
Not Using Named Arguments for Clarity
Inefficient String Concatenation
Inefficient String Concatenation
String.build
, array joining, or string interpolation for better performance and readability.Not Using Crystal's Concurrency Features Properly
Not Using Crystal's Concurrency Features Properly
spawn
, ensure proper synchronization for shared resources using channels, mutexes, or other synchronization primitives.Not Using Proper Error Handling
Not Using Proper Error Handling
Not Using Crystal's Standard Library
Not Using Crystal's Standard Library
Not Using Type Annotations When Helpful
Not Using Type Annotations When Helpful
Not Using Proper Abstractions
Not Using Proper Abstractions
Not Using Proper Immutability
Not Using Proper Immutability
Not Using Proper Enums
Not Using Proper Enums
Not Using Proper Macros
Not Using Proper Macros
Not Using Proper Testing
Not Using Proper Testing
Not Using Proper Documentation
Not Using Proper Documentation
Not Using Proper Resource Management
Not Using Proper Resource Management
begin
/ensure
block.