Skip to main content

Development

This chapter covers practical strategies for testing and debugging Zymba code, and the patterns and conventions that make ZeyOS applications maintainable in production.

What's in this chapter

PageContent
Testing and DebuggingSDK test runner, echo debugging, @Console.log, assertion helpers, common bugs
Best PracticesCode organization, naming conventions, database patterns, error handling, performance, anti-patterns

Quick reference: common pitfalls

SymptomLikely causeFix
String concatenation produces 0Used + instead of ."a" . $b
Object method doesn't update stateMissing $this. prefix$this.value++
Closure can't see outer variableMissing use clausefunction() use ($x) { ... }
use capture doesn't accumulateuse is copy, not referenceUse @Array.reduce or pass by argument
"0" treated as false"0" is falsy in ZymbaTest explicitly: $v !== null && $v !== ""
fetchOne crashes on no resultsResult is null when not foundCheck if ($user is null) before accessing fields

See also