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!

Neither for Free, nor for a Fee

So I have been thinking a lot about prohibiting usage of my software by vicious governments, and other organisations being in violation of United Nation’s Universal Human Right declaration – In fact, I have thought about it for a very long time. So here is my current proposal for a software license, that arguably gives me the best of three worlds. First the ability to share my source code with the world. Secondly it prohibits vicious governments to use my work in any ways. Thirdly, it must create the possibility for me as an individual to create a sustainable income, by making me able to charge people using my software commercially in closed source applications. My intentions are to create a Dual License, that prohibits usage of the software unless two criteria are met: 1. The user creates Open Source software. 2. The user does not work for an organisation that is either directly or indirectly working for a government or organisation that are in violation of UN’s declaration of Universal Human Rights. Neither as a direct employer, or as an independent sub contractor.

The first point (forcing the user to create Open Source), is a demand I will wave for a fee, for users wanting to create closed source applications. This allows me to “Dual License” my software under “Quid Pro Quo” terms. However, the second demand will not be waved, resulting in that I will not sell closed source usage rights to individuals or organisations if they are in violation of Human Rights according to UN’s definition, or working for an organisation or government violating Human Rights. The idea is to keep it as simple as possible. I wanted to use an exception to the Affero GPL, but the Affero’s wording is simply too complex. I want something I can explain to a child, while still fulfilling the above intentions of mine. I am not sure if I have succeeded, but you can see my current working draft below.

Before you object; Yes! I do realise that this does not make the software “open source” or “free software” according to the OSI and FSF’s definition. However, I quite frankly don’t give a shit! Sorry, I will not work for your fascist government, neither for free, nor for a fee. OSI and FSF can quarrel about the semantic differences between Open Source and Free Software – As for me, I am creating Freedom Software … 😉

Freedom Software license version 1.0

Copyright [YEAR] [COPYRIGHT HOLDER]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and its associated documentation files (the “Software”), to use the software for any purpose, subject to the following conditions:

1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2. The entire source code for your own work that builds upon the Software either directly, or indirectly, should be published such that it is easily available for everyone.
3. All copies of the Software should clearly display a hyperlink/URL whenever it is interacted with by a human being, that allows the human to easily obtain the entire source code for your entire application, and use it under the same terms as you were given the right to use the Software.
4. You or your employer are not in any ways participating in activities that violates the United Nations Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/).

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.