How Magic works

Magic is a CRUD backend generator that will scaffold up HTTP REST endpoints for you, wrapping your database “automagically”. This allows you to point it towards an existing database, click a button, and end up with every single CRUD operation towards every single table in your database. Behind the scenes, Magic will read the meta data from your database, and create one code file for every single CRUD operation in your database. These code files will contain “Hyperlambda” code. Magic supports both MySQL and Microsoft SQL Server databases, and is built on top of .Net Core and C#. Most of its source code is publicly available online.

Hyperlambda is my own programming language, inspired by YAML, that allows you to create functionality in a more “declarative way” than traditional programming. In fact, if you look at any of the Hyperlambda files that Magic creates, they will resemble “configuration files” more than for instance C#. However, have no doubts, Hyperlambda is 100% perfectly Turing complete, and actually a “real” programming language, albeit a bit “simple” in its syntax. For instance, Hyperlambda have no classes, no OO, and none of the complex and advanced structures that more “hardcore” programming languages contains, such as C# or Java. In a way, Hyperlambda is a super scalable DSL, as easily understood and extended as FoxPro or Clipper from the old days of 4th generation programming languages – But of course 100 times as scalable as both FoxPro and Clipper were. Hyperlambda sits as a tiny layer in between your HTTP REST endpoint, and the C# code that Magic is built with. Hence, for Magic, Hyperlambda is an “orchestration programming language with DSL qualities”.

Magic also contains a “routing controller” which is a plain C# controller class, that accepts “any URL”. This component will map URLs and HTTP verbs to files physically existing in your Magic installation – Some of whom are the results of the CRUDify operations you have performed on your databases. This combination between having physical files representing each endpoint, and using Hyperlambda to “declare” the endpoints functionality, allows Magic to know a lot of meta information about its own capabilities. You can see this in action after you have CRUDified your tables, and you click the “Endpoints” menu item, to look at your endpoints. This results in that Magic produces a very friendly API, arguably inspired by the Open Web API initiative, that allows you to “see” into your server, and understand what Magic is capable of doing – Without risking creating security holes, etc. Each endpoint can be secured through mechanisms of authorisation and authentication, forcing the client that invokes your endpoint, to belong to some pre-defined role to allow him or her access to execute the code in the endpoint. Internally, Magic is using JWT security tokens to authenticate and authorise its clients.

The end results of this, becomes that you can create 4662 lines of code, and 888 code files, wrapping a database with 222 tables into all CRUD operations, securely – In no more than 40 seconds. Which is what I am doing in the video below.

Notice, scaffolding endpoints and creating CRUD endpoints from your database, does not even interrupt normal usage of the existing backend – And could in theory be done on your production server, without interrupting normal usage. An analogy for this process would be repairing the wings of an airplane, during its flight, without risk of crashing.

Extending Magic with your own functionality, is easy, since the whole thing is created in C#. So you can easily mix Magic with as much C# code as you wish, in addition to creating your own “keywords” for Hyperlambda, by looking at how the existing keywords are implemented, in components such as magic.lambda. However, you don’t really need to understand Hyperlambda at all in order to use Magic – Because it was created more to be understood by the computer, than to be understood by the software developer. In a way, Hyperlambda serves the same function to Magic as IL code or Assembly code serves to C# and C++. So hence, arguably, there is little or no new knowledge required to start using Magic in your own solution – Beyond being able to modify a connection string, compiling your Angular frontend, and C# backend, and literally clicking a button. Clicking that button of course, often results in saving you for hundreds and sometimes thousands of hours of work – Which is its purpose.

That’s why I chose to name it Magic, because you don’t need to understand how it works to take advantage of it. You can simply take advantage of that something else understands how it works (your computer), for then to take advantage of your computer’s ability to make you fly, kind of like you probably don’t understands how a Boing 747 works – But you can still fly. And that’s Magic!

If you’re still interested in its technical details, and you feel you have to understand its internals, 98% of its source code is publicly available online by following my GitHub account. Magic will cost your company €495 for each server you want to run it on. You can obtain a license to run Magic here.

Advertisements

Cutting your software development costs in half

Let’s be honest about this. Much of the work we software developers do during our day, doesn’t require an Einstein – It’s repetetive and boring work, but still required to make the end product function – And it could arguably be done by “trained monkeys”. If you go through what you did today, I am sure you can relate to this. Making computers offload some of our burdens in these regards, isn’t exactly a new thing either. Databases are basically an alternative to old style libraries and document cabinets. Emails are basically an alternative to snail mail. So making the computer do our work, isn’t something new either. So how come we haven’t made our computers create our code then?

In the video below I am demonstrating Magic. Magic allows you to do just that, basically cut your costs in half, and only leave the fun and challenging parts of your software development job left – While your computer does all the boring and repetetive stuff.

Then imagine how your business could prosper, if you could get away with being equally productive, but only needing to spend half of your costs? If you want to talk with me about Magic, feel free to use the form below.

Make money creating Open Source code

For a long time it has bothered me that so many great developers are creating so much awesome software, and releasing it as Open Source, without being able to earn money on their work. If you ask most of the Open Source “titans” about how much they’re making in donations, their answer is “not anywhere near enough”. I might not have the answer to how to fix that for everyone, but I do have the answer for that question if you’re using Magic to create your Open Source things. Simply because even though most of Magic’s source code is freely available online, it’s not Open Source – In fact, 5 hours after having put a Magic solution into production, it’ll stop working without a valid license key.

This means that if you create an awesome CRM, or a magical Webmail client on top of Magic, or even a small SSO portal to serve JWT tokens to other developers and apps, and others are choosing to use your stuff – They’ll have to pay me €495 to have it work on their servers.

Realising Rome wasn’t built in neither one day, nor by one man, I’m willing to do revenue sharing for each license sold to anyone needing a license to make 3rd party components and applications work. In fact, I’ll share everything 50/50 with you. This implies that if you create an awesome app or component on top of Magic, and it becomes popular, and somebody wants to use it, and choose to purchase a license from me – Catching! You’re up €200. No needs to rely on PayPal donations. No needs to beg your users for handouts. No needs to chase companies to sponsor your app. Simply create something Free on top of Magic, let others download it, link to your own custom PayPal payment link, tell your users they’re saving €100 when using it – And whenever somebody wants to put your Open Source stuff into production – You magically get paid €200 each time! (Minus PayPal fees)

Not too bad for creating Open Source and Free Software if you ask me

Why should anybody care? Well, Magic allows you to create HTTP Web backend REST APIs in seconds, wrapping your database by simply clicking a button. This means that among other things, you could probably create your entire backend in seconds – Or at least 80% of it. Maybe you’d have to plaster on some 20% of C# code on top of it, to make your backend do everything you want it to do, but I pretty much guarantee you that if your backend requirements includes reading and writing data to and from some database, you’d be able to “magically” create it (at least) 10x as fast. Then you could simply add some frontend on top of your Magic backend, using e.g. Angular, and voila! You have a complete Web application.

It might not be free as in free beer, but it might just provide you with a beer 😀

Contact me on email if you have built something using Magic, and you want to hear more about this.

When the computer creates the code

When your computer becomes your lead developer

Ignoring solar activity and acts of God, you can safely assume that every single security hole and bug you have ever had in your software systems, originated from a human being, doing something wrong, often somewhere deeply hidden within your codebase. Hence, creating perfect code, is literally as easy as eliminating the “human equation”. And in fact, if you think about it, there’s nothing magical about code that doesn’t allow its creation to become automated, the same way code has a tendency towards automating everything else. In fact, not having automated our creation of code a long time ago, is arguably pathetic, and hypocritical, since we are after all in the business of automation …

Once you start thinking in this direction, you realise that if you could create one single tiny piece of code, that perfectly automates the creation of code, you can reuse that snippet of code, creating code, over again, and over again, and over again, to produce perfect code every single time you use it!

Automating the process of automation

So instead of creating code every time confronted with a problem, like we software developers have a tendency towards ending up doing, we should rather ask ourselves how we can create code that creates the code we need in the end. This is the very basics of “problem solving 101”.

Don’t solve your problem! Rather create a solution that can be applied to solving all problems – Including those problems you might have in the future

If you believe this is science fiction, think again. I have just released a new version of Magic, which actually is a software system that creates code. Highly useful code too I would argue, since it solves arguably 80% of 80% of our largest problems as software developers – The creation of HTTP REST backend endpoints, allowing us to do CRUD operations towards our database.

Although it’s still not extremely mature, and only supports MySQL for instance, it’s already easy to imagine how these same ideas could be leveraged much further, to permanently eliminate (more or less) the need for human interaction (in the code), to produce computer systems, of immense complexity, built on hundreds of thousands of automagically created lines of code.

New release of Magic

I just created a new release of Magic. One of the primary features, is to make its codebase completely modularised, and creating NuGet packages for every single module in the project. This implied creating more than 20 NuGet packages for the record, so it was a substantial job for me. This allows you to use Magic in existing (legacy) code bases, by simply referencing the “magic.library” NuGet package in your project, and including the “files” folder from Magic in your own existing ASP.NET Core Web API. Read more about how to accomplish this here. Although I want to emphasise that I would encourage you to download the entire code base, since it contains the necessary frontend parts to “crudify” your database.

I’ll probably end up creating some more instructional material over the next couple of weeks, but for now I’m heading to the beach 🙂

Anyways, have fun!

The Hippocratic Affero GPL addendum

Some time ago Coraline Ada Ehmke created a Hippocratic MIT style Open Source license, and the Open Source Initiative explicitly commented on it, and said “it is not open source”. For me personally, Open Source and Free Software is not a goal, it is the means. The means to accomplish good things, and our reasons to create Open Source software, is because we (developers) wants to contribute positively to the world. Hence I don’t care what the OSI thinks about the Hippocratic Addendum to Open Source licenses to be honest with you, I intend to use it for my own software regardless of whether or not technicalities makes it an “open source license” or not.

The next release of Magic will therefor be released under two distinctly different licenses; One “quasi open source” license, the Affero GPL license with the “Hippocratic Addendum”. And another commercial/proprietary enabling license. I allow you to use the first license because I want to contribute to the world, and do my part in making it better. I sell the right to use Magic under the seconds type of license, because I need to pay my rent like everybody else. I also do not sell proprietary enabling licenses to governments or organisations who are in violation of international human rights, by for instance having a military presence in a country without a UN resolution underneath backing their presence, etc. Sorry, you can use something else do – But you cannot use Magic. If you don’t know what the Hippocratic Addendum is, you can find it below.

The Software may not be used by individuals, corporations, governments, or other groups for systems or activities that actively and knowingly endanger, harm, or otherwise threaten the physical, mental, economic, or general well-being of individuals or groups in violation of the United Nations Universal Declaration of Human Rights. Read more here – https://www.un.org/en/universal-declaration-human-rights/

You can read the UN’s Universal Declaration of Human Rights here.

Thank you Coraline for a great idea!