StrataCode Intro

by 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 many 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 (i.e. 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.

StrataCode has taken a leaner approach than most Java frameworks and has essentially no library dependencies outside of the JDK. Before this project, I spent many years designing in teams, and committees, under time-pressure and this design built up over many years in resistance to compromises made in previous designs. I believe in the big book of software design patterns, and that we need to limit flexibility of frameworks as much as expand them to improve manageability of applications, plugins, and the resulting ecosystems. I look to examples of HTML, and SQL as declarative frameworks which express deep abstractions from the big book in a simple way. So why not build a framework for building robust, declarative frameworks. For every declarative language like HTML you also need a procedural language like Javascript when you need to add code. It's important to support both code snippets as well as libraries, to multi-process systems. In my big book, application and framework code can be cleanly separated without a rewrite. You might do it from the start as a design practice, or perhaps wait until the first time a second conflicting framework must be supported. It's important that this is an incremental process that does not have to significantly alter the runtime code while you are doing the separation.

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:

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 the code without much training, and easily navigate and edit with the IDE. For me at least, StrataCode has evolved into a nimble, flexible, readable code base. I can debug problems quickly and the test suite grows to be sure problems stay fixed. I can write code once and run it in many different configurations.

I have built prototypes for management UIs that are complex enough that I feel comfortable building anything. What I like most is is the power of code-processing for building simple, declarative frameworks. You can then reuse application code in various ways - client-only, client/server, server-only, compiled to Javascript, with many framework options - per-window, per-request. Move tags from running on the client to on the server by setting an annotation. Running an A/B test of that new configuration, and merging the result as a new step in your deployment process. Build a management UI that automates that process in a constrained environment so you can offload a powerful type of customization. Use dynamic code and 'refresh' to reduce the round-trip times for common operations, such as editing a web page. Even one that's backed by lots of logic and has lots of current application state. Build one set of tests against the domain model and use them for all platforms and configurations. Add realtime as a feature whenneeded. Use it on every app for more comprehensive tests and diagnostics.

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:

StrataCode uses this code-processing framework to add extensions to Java for 'layering' components and configuration, as well as a template language, client/server programming model, and all of it's framework integrations. Even translating from one language to another is feasible without a ton 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 the source and the generated source, navigation between the two, and wizards for creating layers, classes, objects, modify, and run configurations. 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.

Despite the long incubation period, it's early days for StrataCode with other developers. 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, projects to build, companies who'd like to use it, investors and partners in general.

Read more about on how to leverage your code or jump straight to the documentation to learn more.