Stop Writing God Components.
Modern frontend development has become a chaotic race to manage complexity with more complexity. We drown in primitive obsession, sprawling classes, and untestable DOM logic. We have abandoned the discipline of software engineering for the convenience of the script.
Sirpi is the correction. It is not just a framework; it is a chisel. It forces the discipline of Object Calisthenics onto the web, ensuring that your codebase is sculpted, not just written.
The 9 Laws of Sirpi
-
1. One level of indentation per method.
Complexity hides in nested loops. By enforcing a single level of indentation, your methods remain atomic and understandable.
-
2. Don’t use the ELSE keyword.
The
elsekeyword is a sign of poorly modeled logic. Use early returns or polymorphism to define clear execution paths. -
3. Wrap all primitives and Strings.
A
stringis not a Username. Anumberis not an Age. Wrap your primitives in Value Objects to capture domain meaning and prevent impossible states. -
4. First class collections.
Never pass raw arrays. Wrap them in dedicated collection classes that own the logic for filtering, mapping, and protecting the data.
-
5. One dot per line.
Enforce the Law of Demeter. Don't reach into other objects. Talk to your neighbors, not their grandchildren.
-
6. Don’t abbreviate.
If a name is too long to write, the object is doing too much. Clarity is the antidote to technical debt.
-
7. Keep all entities small.
Classes must be under 50 lines. Files must be focused. If you can't see the whole object on one screen, it is too big.
-
8. No classes with more than two instance variables.
High cohesion is the goal. If an object needs three things to function, it's likely two separate objects waiting to be born.
-
9. No getters/setters/properties.
Tell, don't ask. Encapsulate your state. Components emit Intents; the framework handles the reconciliation.
Ready to Sculpt?
Sirpi is currently in early-access development.
Follow the Progress on GitHub