DEV Community

Romans Malinovskis
Romans Malinovskis

Posted on

Hello Dev.to

Hello,

I learned PHP in 1998 and fell in love with the language. Never a fan of projects like WordPress or popular frameworks, I appreciated the language in its pure form. My work led me to releasing Agile Toolkit and creating successful consultancies around it, and even though I decided to move on about ten years ago, Agile Toolkit lives on thanks to the community.

One of the greatest advantages of ATK is the ability to operate with data models in a very unusual yet super-efficient way. Real projects which use ATK significantly reduce the number of database queries simply because those queries are built dynamically inside PHP before they are executed. This makes it possible for UI components (like filters or pagination) to naturally integrate with no additional code lines.

Entity Abstraction

There are presently two views on how applications interact with the SQL databases - either through custom-written SQL queries (SQLx for Rust) or with ORM (Diesel or SeaORM). Each has pros and cons.

But what if there is a third way?

Agile Data (https://github.com/atk4/data) implements an approach of DataSet abstractions - implemented in PHP. While it is similar to ORM in syntax - it operates on an entirely different level, allowing you to dynamically build multi-table queries, abstract away expression logic, and introduce extensions (such as soft-delete). All of that integrates into UI directly) making ATK a "low-code" framework that makes you write very little code.

If you are curious how powerful it is - www.sortmybooks.com is a full-featured online accounting suite (much more powerful than Xero), built entirely in ATK and extensively using Agile Data for UI and reports.

Moving On

A few years ago, I started learning Rust, and while I didn't have much time, I decided to write some backend application in Axum. To this day, I could not find a crate to enable pagination across all my data endpoints universally.

I thought if we want Rust to be more "appropriate" for serious business applications— an Entity Framework is absolutely required.

Rust, however, has these unusual ownership and trait systems. On top of that, the desire to apply types to anything makes it even harder to come up with a "good-looking" data abstraction framework.

My next challenge - Vantage

This seemed like a very interesting challenge, and I began working on Vantage. However, as my understanding of Rust continues to evolve, my project will probably undergo several idiomatic rewrites.

I feel that I need to dump my thoughts and ideas somewhere. It helps me reflect and refine my approach, and if this would also be of interest to anyone, GREAT!

What am I planning next?

Vantage cannot be lightweight, otherwise it will fall as "yet-another-light ORM". There are fundamental targets it must achieve in order to advance forward. Here I wanted just to list some of my design goals.

  1. Expressions - Implement an extensible interface for nested expressions, which can operate across multiple data sources and demonstrate great policy towards async execution.
  2. Persistence Mapping - Create a protocol for persistence mapping. Think of this as "serde", which supports multiple data sources, relationships, conditions, optional fields, expressions and tons of other extensions.
  3. Query Builders - This is a glue between the above two components. Provided with a persistence mapping logic - translate operations (such as reading, adding, deleting) into expressions by fully utilising query languages such as SQL or SurrealDB query language.

There are many benefits that can come out of this - but getting those 3 fundamentals correct and aligning them with Rust coding paradigms with lovely syntactic sugar is essential.

If you want to see my current work-in-progress: https://github.com/romaninsh/vantage, but I also plan to post some updates and reflections or my account here.

Top comments (0)