StrataCode Introby Jeff Vroom
StrataCode lets programmers build customizable software using code-processing which include code editing tools, transpilation, and language-to-language converters. It parses standard Java with full type-awareness and provides APIs to read and edit Java source code incrementally. The StrataCode language supports normal Java plus a few key syntax changes to support more declarative applications. Management UIs are created automatically from annotated application classes and objects, and customized using annotations and layers. The system provides all of the difficult features required by a fully customizable SaaS platform that supports excellent tooling and long-term code lifecycle management.
StrataCode's design supports separating framework and application code, reducing the number of times you need to copy the logic needed for your business problem (called the "domain model"). This makes it easier to build, maintain and change core business logic for a more efficient business. The code-processor preserves static typing for strong, flexible frameworks and a new level of code-reuse, and deployment efficiency.
This has been primarily a solo project, inspired by twenty years of building tools and frameworks and the desire for a system that offers architects maximum leverage for managing a complex system which is used and customized by a wide audience. Before releasing it to others, I wanted to to make it my preferred development platform and that's taken just about ten years to achieve.
Another big requirement in my book is that frameworks are traceable for code editing, debugging, deployment, and runtime security and monitoring. This includes well designed, traceable error messages and log statements, static typing, toString methods to make stack traces readable. And tools for all formats that touch the domain model for automatic find-usages and refactoring. And where possible, industry standards are followed. It's important to find patterns and syntax that work well and are sustainable for customers but while also minizing the frequency and impact of incompatible changes.
StrataCode supports standard Java files as well as a smally family of formats which support a super-set of Java. The most important formats are:
- .sc for the StrataCode language feature extensions to Java
- .sct for code that has lots of text embedded in it. It is JSP-like but implemented as a one-pass translation to Java for less potential for confusing code, better typing, syntax errors, and debugging.
- .schtml which extends .sct with tags class implementations that map onto Java in a simple, powerful, more debuggable way.
- .scr for test scripts built using the command line language
The StrataCode core language adds three new keywords object, override, and scope and three new operators for data binding :=, =: and :=: My hope is that most Java developers can just read StrataCode without much training when using the IDE. For me, StrataCode has evolved into a nimble, readable code base. I can debug problems quickly and the test suite grows to be sure problems stay fixed.
StrataCode uses its own code-processing library called Parselets, built in Java with no parser-generator. Grammars are defined using APIs using a few standard parsing operators (PEG). Those grammars have lots of options and ways of customizing their behavior with simple code snippets to form a fully featured language including:
- Generation of language model AST
- An incremental read-modify-write API for the AST with base classes that provide all language features
- Partial values parse mode - for finding a reasonable AST for the given incomplete file
- Fast, incremental 'reparse' so you can get fast edits of large files
- Save/restore of AST and separate store of parse-node tree for more efficient tooling
- Type awareness and manipulation, navigation, and syntax highlighting apis with IntelliJ integration
- Usage and code completion apis and indexes for a well performing IDE
- Change language and reformat - to build easier cross language translation of nodes (e.g. JS array to Java array in 2 lines of code)
Without proper tooling, or understanding of how layers work, reading layered code can be more challenging. Fortunately StrataCode includes an IntelliJ plugin. It has a layers view, supports find usages, up/down layer, debugging of both StrataCode and the generated source, navigation to/from generated source, and wizards for create layer, modify type. The code is written to be easy to read, debug and improve so it's potentially an excellent base for those interested in building development tools, and who want to work on their own frameworks.
This is still early days for StrataCode. I've had only a few friends who've built sample applications and one company has used the APIs in their product. The test suite contains over a million lines of Java from 3rd party projects, and lots of samples and tests of the new frameworks and features. If you have some curiosity and patience for a project in the early days, it might be worth your time to try it out.
I'd love your feedback and am looking for developers who'd like to help, companies who'd like to use it, partners and investors.