Page 56 - MSDN Magazine, June 2017
P. 56

create increasingly complex systems, building on systems you’ve previously created. In a traditional programming language, you’d have to choose between building a system or building a reusable component. In Hyperlambda, such mutually exclusive choices are meaningless, and everything tends to become a little bit of every- thing else. Hyperlambda’s reusability features completely dwarf everything you’ve ever seen before in your programming life.
Use case 5: In Hyperlambda, you can actually recursively execute a folder on disc, passing in arguments to the execution, eliminating everything that used to constrain you in traditional programming. Or you can invoke a file exactly as you’d invoke a function, having the invocation of your file return multiple values to its caller. You can also easily invoke the body of an HTTP POST request transmitted to your server, effectively replacing every single Web service endpoint you’ve ever created with five to 15 lines of code. All of these are things I do almost every single day as I use Hyperlambda.
The result is that every single lambda object you create in Hyperlambda is also a potentially reusable component you can inject into other parts of your system.
Use case 6: In Hyperlambda, even thinking about a Web page as purely a Web page is meaningless because just by replacing a single assembly in your application pool you can easily cre- ate a Windows Forms application using the exact same code. In Hyperlambda, reusing the same code base for your Web apps and Windows Forms apps is actually ridiculously easy—even the GUI parts of your code.
When I show Hyperlambda to other software developers, some tend to dismiss it because Hyperlambda seems to be much more verbose than traditional programming languages. For instance, the previous code example could easily have been described with a single line of code in C#, while in Hyperlambda it took nine lines. For simple tasks, Hyperlambda is admittedly sometimes more ver- bose. However, Hyperlambda features one trait that mitigates this issue—the capability to transform lambda objects, which gives you code that’s much less verbose in the long run. So, basically, you pay a small price up front—more verbose code in the short run—to end up with far less verbose code in the long run. This allows you to deliver far more functionality with far less effort. Hyperlambda enables exponential software productivity growth. Let that last sentence sink in a little bit, please.
Hyperlambda’s Hello World
The following is the “Hello World” application created in Hyper- lambda. If you paste this code into, for instance, a lambda page in the System42 CMS, you’ll create a button that, when clicked, changes its inner value to “I was clicked.” Download P5, and try
it out by starting the Apps/CMS app. Then create a lambda page and paste in this code:
create-widget:foo-widget element:button class:btn btn-default innerValue:Click me! onclick
set-widget-property:foo-widget innerValue:I was clicked
Seven lines of Hyperlambda arguably replace potentially hun- dreds of lines of code in JavaScript, C#, or HTML, depending what framework, library, or language you use to create something similar. And if you read through the code carefully, you can prob- ably guess what HTML markup it will produce. Hyperlambda tends to be closer to natural language than other programming languages. Linguistically, it resembles the way humans naturally convey information to other humans more closely than, for example, C# or JavaScript.
As an additional bonus, if you create your own Windows Forms assembly, using an alternative implementation of the previously mentioned create-widget Active Event, you can use the exact same code to create a Windows Forms application.
Is Hyperlambda a Silver Bullet?
I’ve been accused of advertising silver bullets for as long as I’ve advocated Active Events. I admit that some of my claims prob- ably sound like magic. And, yes, Hyperlambda creates more verbose code initially, as well as adding more overhead to the execution of your programming instructions, due to its internal implementation semantics. I also occasionally find bugs, and I do refactor my things, resulting hopefully in better code. Obviously, Hyperlambda is not perfect.
However, Hyperlambda’s biggest problem is actually in your head. Hyperlambda completely invalidates everything you’ve been taught for the last 50 years as best practices for software develop- ment. And it does it with style, putting its money where its mouth is!
At the end of the day, though, the answer to whether Hyperlambda is a silver bullet is not one I can give you. This is something you’ll have to figure out for yourself. It may help to check out an exam- ple of a GMail clone, Sephia Five, built entirely in Hyperlambda (github.com/polterguy/sephia-five). Sephia Five features PGP cryptog- raphy and 100 perfect perfect virus and malware protection, and it works on all devices capable of displaying HTML. Sephia Five is also several orders of magnitudes more efficient in bandwidth usage than GMail. And its initial release was literally built in five days, from scratch. All of these claims can be checked, verified, and mathematically reproduced and proven!
To learn more about Hyperlambda, feel free to read the guide at github.com/polterguy/phosphorusfive-dox. And you can download Hyperlambda along with Phosphorus Five at github.com/polterguy/phosphorusfive. n
Thomas hansen has been creating software since he was 8 years old, when he started writing code using the Oric-1 computer in 1982. Occasionally he creates code that does more good than harm. His passions include the Web, AJAX, Agile methodologies and software architecture.
Thanks to the following Microsoft technical expert for reviewing this article: James McCaffrey
52 msdn magazine
C#














































































   54   55   56   57   58