Generate a CRUD API Using Low-Code and No-Code
By combining a CRUD generator with declarative programming constructs, you can ALMOST eliminate the need for software developers - But only ALMOST!
Join the DZone community and get the full member experience.
Join For FreeCRUD translates to Create, Read, Update, and Delete and is the axiom around which your data exists. If you've solved CRUD, you've "solved data".
CRUD isn't enough though. Just because you're able to handle data doesn't imply you can create an app - Even though it's a huge part of it. This is why we created workflows and actions based on the declarative programming parts of Hyperlambda.
By combining the CRUD generator with programming, you can however create an application, entirely without coding - At least its backend parts. Watch the following video to understand what I mean.
The CRUD Generator
A relational database such as the SQLite database I am wrapping in the above video contains metadata. Metadata implies "information about information", and allows Magic to retrieve information about how the database is structured. This allows Magic to read the schema from the database, and understand what tables, columns, and primary keys exist for a particular database.
Once Magic knows the structure of your database, it can generate API endpoints for each database table, correctly handling the required arguments needed to interact with your database. Below is one example of the code it generates for one particular table and CRUD verb.
// Create endpoint inserting one record into your Artist table in your chinook database taking ArtistId, Name with authentication and authorisation for root,admin roles
.arguments
// ArtistId column value
ArtistId:long
// Name column value
Name:string
// Meta data description for endpoint
.description:Create endpoint inserting one record into your Artist table in your chinook database taking ArtistId, Name with authentication and authorisation for root,admin roles
// Type of endpoint
.type:crud-create
// Verifying user is authorized to access endpoint.
auth.ticket.verify:root,admin
// Opening up database connection.
data.connect:[generic|chinook]
database-type:sqlite
// Parametrising our create invocation.
add:x:./*/data.create/*/values
get-nodes:x:@.arguments/*
// Creating our record.
data.create
database-type:sqlite
table:Artist
return-id:bool:false
values
// Returning the correct status code.
response.status.set:201
// Returning result of above invocation to caller.
unwrap:x:+/*
return
result:success
If you have a database with 100 tables, Magic will automatically create 500 Hyperlambda files such as the above. This allows Magic to generate thousands of lines of code for you, 100% automatically, where each HTTP endpoint has the same structure, allowing you to easily interact with your API using standardized code constructs.
This saves you months of manual software development, while producing 1,000 times higher quality in the process
Declarative Programming
Hyperlambda is a declarative programming language. A declarative programming language ignores "the how" and allows you to focus on "the what". This implies that adding business logic to your app becomes 1,000 times easier, to the point where adding business logic implies "dragging and dropping functionality onto some API endpoint".
Once you can combine generating CRUD endpoints with declarative programming, you've ended up with an interface where you can create any app you wish, completely without having to code. The declarative parts of Magic are still in its infancy, but as you can see in the above YouTube video, I can add fairly complex business to my API, without having to manually code any of it.
The result becomes.
- 1,000 times faster Time2Market
- 1,000 times higher quality
- 1,000 times easier to create
Visually Designing Your Database
With SQL Studio you can visually design your database. This brings us full circle, allowing you to start with nothing but an idea, create your database, generate a CRUD API, and then use declarative programming to add business logic to your API.
Software development in its traditional sense has been completely eliminated
No need to remember to create table SQL statements, or fiddle with how to add columns and indexes. The database designer does this for you, 100% automatically.
Conclusion
There's been a lot of hype about AI stealing our jobs as software developers lately. I wrote about it yesterday, where my argument was that AI will save your job. If you don't believe me, please go to ChatGPT and tell it to create an app for you.
The punchline of the above exercise is that unless you're a software developer, you've got no idea what to even ask it. It's the same problem we've got with chess computers. If I've got a chess computer and Magnus Karlsen has a chess computer, Magnus can use his chess computer to do things I cannot even imagine the same computer doing.
Every time I go to GitHub I am reminded of how CoPilot increases software development productivity by 55%. However, try giving CoPilot to your CEO and tell him to "create an app". He'd be baffled and have no idea where to even start. Simply conceptually understanding the acronyms and constructs required to phrase a prompt to the AI requires years of training and experience.
Just like AI, Magic is more of a tool than a replacement. If for nothing else than the fact that regardless of how much code we're able to create, and how fast we're able to deliver it, there seems to be an infinite demand for more. Neither Magic nor AI will replace you as a software developer, it's just a better tool. However, just like AI, declarative programming and metaprogramming will result in changes. I love the following quote regarding the issue.
AI won't replace you, a person using AI will replace you
The same is true for Magic, Hyperlambda, and declarative programming. As in, a person using said tools will replace you. There will still be a person in the equation in there somewhere. The way that person solves your problems will just change, and that's it...
Published at DZone with permission of Thomas Hansen. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments