Introducing Nzym: A White Paper on the Programming Language that Will Revolutionize Multimedia

Published on 12 Aug 2023

Nzym Logo

Introduction 

Nzym is a new programming language that focuses on making programming easier, simpler, and faster, quickening production time to even produce better results, especially for multimedia applications. At the core of Nzym is a script file object that can exist on its own or be linked in conjunction with others. It is through these scripted objects that the Nzym interpreter can generate programs and content pages. This document serves to introduce this language and the new concepts therein.


Nzym Syntax 

The basic syntax of Nzym is very simple. Objects are created by assigning a value to a variable of the appropriate type. For example, to create a new object of type Number, you would write the following:

Number myInteger = 10;

Methods are called on objects by using the dot notation. For example, to call the Add method on an object of type Number, you would write the following:

myInteger.Add = 6;
// If the value of myInteger was equal to 10 before, it will now be 16

It is also important to note that the semicolon (;) is used to terminate all statements and a comment is created by using two forward slashes (//) and usually a space after.

Primitive Types 

Nzym introduces just five basic primitive types:
  • Number – will store integers, floats or a mix of the two
  • String – stores characters and can be used for more complex expressions
  • Boolean – a binary type storing true or false
  • Group – an array of objects, used to create and define more complex elements
  • Link – a unique type that can be void or that directs to a function

Classes & Methods 

Nzym Classes can be used to create custom types. Each script file in a project can be called and accessed as a class, however, within a script file, other classes can be created. Nzym also has a unique take on methods. There are two types of Methods in terms of how they are created and this is based on where they are created. Those that are contained in nested classes are simply referred to as Methods. The ones outside a class are referred to as Functions. The following code gives an example of the two:


Class Person;
String name= No Name;
Number age = 18;
Method ShowName;
Raw name;
Return;
Return;
 
Function GetPerson = String;
Person randomPerson;
randomPerson.name = A Stranger;
randomPerson.ShowName;
Return;

The code above creates a Class called Person and instantiates the properties of name and age, setting them up with default variables. Also in Person is a method which will print out the name of the given Person Class. The function GetPerson has a return type of String and actually creates a new Person and prints their name to the screen given the method from the Person class.


Inheritance 

Nzym classes can inherit from other classes. This allows you to reuse code and create more complex types. To inherit from a class, you would use the equals sign after creating the class, for example, the following class inherits from the Person class:

Class SuperHero = Person;
Group superpowers = (Laser eyes, Super strength, Flight);
Number activePower = 1;
Method PowerInUse;
Raw superpowers[activePower];
Return; 
Return;

The SuperHero class will have access to all the properties and methods of the Person class, as well.

Nzym Buzzwords 

Nzym: A simple, object-oriented, interpreted, imperative, multiplatform, high-performance, multithreaded, and dynamic language.

Many programming language systems use a set of standard keywords that characterize them, set forth according to their paradigms, typing discipline, and the problems which the language aims to solve. We use these keywords, which here we are referring to as buzzwords, to describe Nzym and introduce the core founding heart of its structure and ecosystem.

Sadomba-Mahari Computers (Private) Limited (or simply SM), the company behind the development of Nzym, entered the web development industry in 2010, about a few months since they had been registered, as well as dabbled in the making of specialized software for the local film industry in Zimbabwe. About a few years later, they also began to develop mobile applications targeted at higher-end mobile phones on the Android, Windows Phone, and iOS platforms. The indented italicized portions below seek to give a narrative of the issues faced by SM and to give examples of the keywords of Nzym presented.

Simple 

One of the main tenants with the development of Nzym was that there was the need for systems that could be programmed easily without the need for a lot of training, bearing some similarities to concepts that came before, but having a more simplified touch that would attract even the most beginners in programming. The most common programming languages taught during the time of Nzym’s development were those similar to C++ syntax, including C++, C#, Java, and Python. These programming languages are also object-oriented. While C++ came with some levels of complexity that the others mentioned did not have, such as lack of memory management and the concept of pointers and operator overloading, the others tried to improve on those concepts but still there remained a steep learning curve for programmers to master them with additional overheads and concepts such as garbage collection, multiple inheritance and extensive automatic coercions.
 
Nzym focuses on the object and completely removes the need for braces and many bracket types or even quotations. For every statement in Nzym, usually, there are two to three parts mainly in the form of:

Type nameOfType = value;
nameOfType.MethodOfType = value2;
Class NameOfClass = InheritFrom;
Function NameOfFx = ReturnType;
Method NameOfMethod = ReturnType;

Removing the rarely used, poorly understood, confusing features of C++ and removing the sometimes-confusing aspects of the C type syntax, which for many has been the cause of a lot of pain and grief, a simpler language was born.

In the beginning, SM employed only three full-time programmers, two of whom were interns hired from the university. The greatest challenge that was presented to them was to be able to create and replicate static websites, tailor-made for various types of clients but narrowing down production time. Obviously, stylesheets were going to be different from project to project but there were elements that were going to exist in every project and that would exist in all projects especially navigation, footer widgets, the home page, contact page, an about page, and a page for highlighting products and showing portfolios. A simpler way to prototype and produce needed to be possible…

Another aspect of being simple is visually portable. One of the goals of Nzym is to enable the creation of media applications that can run on any platform and maintain their visual look and appeal. The use of cascading stylesheets and web technology elements to create standard visual displays became a core target feature for Nzym development. The way a screen looks in a browser, in a mobile application, and in a desktop application will be the same or, at the very least, will be uniform in look and feel across all platforms.

Object-Oriented 

Arguably one of the most overused buzzwords when it comes to describing a programming language but is actually a key concept in describing Nzym. Object-oriented programming as a programming paradigm is based on objects made of data and code. In Nzym, data is in the form of the types which make up the various properties of an object, and then the code is stored in the methods (which are the procedures). Nzym makes use of object-oriented design due to the way it facilitates the clean definition of interfaces and makes it possible to provide reusable elements.

The object-oriented facilities of Nzym are essentially those of most C-type languages that came before it but with a different syntax and much more relaxed rules. Nzym script files are the key objects of a Nzym project and within them, they can contain classes that are treated as objects as well.

When working on a website, the team at SM knew they were always going to need to recreate common elements like the contact form or a drop-down menu but with some modifications as requested by the client. As they dealt mostly with creating static websites, it seemed to be a good idea if there was a way in which they could group these common elements into separate files for easy importing into a project, as and when they were needed, with minor modifications for the client. For example, changes in color, addition or removal of certain fields from a form, or the inclusion of icons on the menu.

Interpreted 

Nzym script files are interpreted by means of the Nzym Builder interpreter (which is called Elephant) and the output can be a whole website to a nzym file that works as a library to use in other Nzym projects or a ctlyst file that is Nzym bytecode which can be run using an implementation of Nzym Console on any device or machine. While Nzym Console now exists for most operating systems, more implementations are being developed, which will allow for the running of a compiled Nzym program on any device. However, if a Nzym program is interpreted to a website, the output would immediately be available to port to any device or a server to host, usually as a static website.

The team at SM would use Bootstrap or an in-house boilerplate that existed at the time to recreate and generate different types of websites. However, these code blocks had a lot of disadvantages, especially when displaying on different devices and older browsers.

A key goal of the process of interpretation for Nzym has also been to create products that work on any device, across any platform, not only maintaining visual portability, but the same functionality and performance as well.

Imperative 

Nzym uses statements to change the state of the program, and hence in this case it is an imperative programming language, describing how the program operates at every step. Nzym may also follow the tenets of procedural programming in the sense that a program can be built from one or more procedures, via the use of functions, which can localize the state changes to specific methods.

One difficulty in the work of the team at SM was having to pinpoint where to put elements they were reusing in every project. One website would have a menu system located at the top of the page above the header, and another would have a menu below the header. Sometimes the menu would be placed in the header, among other header elements and at times it was apart. Knowing where to position the clump of code with the menus was then a task that required a lot of care and if one walked away for a while from their project, it was always difficult to resume. It was equally jarring if someone needed to take over an ongoing project from another person, not being able to tell where the project was going and what had been done just at a glance.

Imperative programming for Nzym makes the language easy to learn as there is a clear control flow that can be displayed, giving the user more power to change modify and optimize the program. This also creates more efficiency in the sense that the programmer can tell the computer program exactly what to do. On the procedural side, there is the advantage of modularity as a program can be broken down into smaller reusable procedures, and these may also be reusable in other programs. Debugging is also much simpler because of the imperative paradigm.

Multiplatform 

Nzym was designed not only for the web but with multimedia applications in mind as a whole. When looking at multimedia applications, we are referring to interactive software which combines different types of media such as text, images, video, and audio, to convey information to an audience. These applications are the most dominant type of software found on various types of devices and hardware, spanning various operating systems, gaming consoles, and consumer devices like mobile phones and watches.

While the work on the websites was the bread and butter of SM, there was another big project of which SM became a part of, and that involved work on a multimedia software package called AVisPar (the African Visual Package). AVisPar was a set of software programs and tools for creating 3D visualizations, films, games, game assets, and visual effects. What was to be unique about AVisPar was its ability to make use of a graphics card to produce high-quality 3D renders and save them to disk almost in real-time. AVisPar was also developed to work, not only on the most common commercial desktop operating systems but also on some Linux distributions as well.

Since Nzym can generate websites with web assets, all-inclusive of HTML pages with JavaScript and CSS in them, it can be described as multiplatform. However, where Nzym generates a ctlyst file, it is possible to run the file on any platform which has an implementation of Nzym Console.

High Performance 

As concerns the ctlyst file format, the Nzym Console is designed to convert it directly into machine code for the particular CPU that the application is running on at runtime. The file format is so aptly named after the word catalyst which refers to that which speeds up a chemical reaction. In this case, however, Nzym Console runs the ctlyst file, enabling an environment for the program to run as any other application on the system.

The latest implementation of Nzym and Nzym Console was created using Rust and henceforth has inherited additional high-performance characteristics from the language since the Rust compiler was able to optimize the code for speed. Additionally, the Rust standard library provides a number of efficient algorithms and data structures that were used in the creation of the current build of Nzym. To give a brief outline of what this means for Nzym programs:

  • Memory safety: Rust's ownership system ensures that memory is always managed correctly, which can prevent memory leaks and crashes. This can lead to significant performance improvements, as Nzym does not have to spend time managing memory manually.
  • Efficiency: Rust's compiler is very good at optimizing code for speed. This means that Nzym Console is able to run as fast as possible, even on complex tasks.

Multithreaded 

To make an impressively powerful and interactive multimedia application it will usually mean that there will be a need to be able to handle interactive responsiveness in real-time and better synchronization amongst all elements involved. This will mean that the application will need to be able to handle multiple processes at the same time, implying multiple threads and simultaneous events that may occur at the same time.

AVisPar was a unique project for the team at SM to work on. It allowed for a lot of experimentation in terms of how to create the solutions involved but there was one huge problem that the team faced and that one was to do with handling simultaneous events. The initial code base of AVisPar had been written in C++ along with some libraries from other 3D game engines such as Irrlicht which were included. The 3D game engine Irrlicht in particular did have some multithreading functionality that was easy to use and adapt for running various processes on a single machine. However, running multiple threads on a network with various CPUs and graphics processing units involved, the threads became really difficult and complicated to handle.

C and C++ are conventionally single-threaded and using some libraries to achieve the creation of multiple threads results in the same disadvantages most programmers face when they use Java or Objective C to create multithreaded applications. Usually, problems arise from complexity in terms of needing to figure out how the threads interact, performance issues due to the operating system switching between threads if the design is not carefully done, and ultimately higher resource usage. Nzym on the other hand makes use of Rust’s async/await model for concurrent code when drawing on creating a ctlyst file. However, Nzym also has a fallback in terms of using Web Workers, much in the same way JavaScript does, in that multiple threads may be converted to JavaScript for website projects and then benefit from the improved performance, responsiveness, and scalability that JavaScript applications with multiple threads benefit from.

Dynamic 

Nzym is still developed and ever-evolving. It has been designed to adapt to an already ever-evolving technological landscape. With the continuous development and expansion of the Nzym Console and its implementations, Nzym can become the language of choice for creating applications for portable and mobile devices, including smartwatches and smartphones.

From the beginning of 2011, and all throughout the year until the end of 2012, SM experienced an increase in customers requiring their services to develop mobile applications for them. SM made use of Java in creating apps for smartphones of that time that supported Java, including Android phones that were gaining a lot of market share at that time. The problem became that the code for these platforms, although written in the same language, they were not and could not be the same. The visual presentation was not portable and the functionality greatly differed, as well as the libraries used in development.

Java was once the go-to language for developing mobile languages but has lost ground in recent years to newer languages, such as Kotlin and Swift. The main issues with Java were and remain

  • Performance: Java is not as performant as some of the newer languages, which can lead to slower apps.
  • Complexity: Java is a complex language, which can make it difficult to learn and use.
  • Fragmentation: There are many different versions of Java, which can make it difficult to develop apps that work on all devices.

While Java remains popular for developing mobile applications, due to its ecosystem of libraries and tools, support by many vendors, and its maturity, newer languages are gaining ground. With the initiative of Nzym to follow the path and make it easier, better, and faster to create and port applications to as many devices as possible with a single code base being the goal, Nzym is undoubtedly a language to watch as it fires towards this target.


Conclusion 

Nzym is a new programming language that is designed to be simple, elegant, and powerful. While it is still in its infancy, it targets to become the choice for programmers who want to create object-oriented media applications and websites. In its simplicity, it does remove the need for curly braces and quotations for strings and makes syntax more straightforward and direct.

Current Development 

Nzym’s original implementation language was C++ but with the emergence and release of the first stable release of Rust 1.0 in 2015, Nzym’s development and production shifted to the new language. Opting for a language that enforces memory safety, without requiring the use of garbage collection or reference counting seemed to be a great option for a language that will be used to create powerful media applications with high performance and very few bugs.

Future Development 

Since Nzym is still under development, there are a number of features that are planned for future releases. These features include:
  • Prebuilt libraries for easier and faster app creation
  • More powerful classes and objects
  • A better debugger
  • A simple but more user-friendly IDE
Nzym is a promising new programming language that has the potential to become a popular choice for object-oriented programming. It is a good choice for programmers who want to create simple, elegant, and fast applications, especially for various platforms including mobile and the Internet. For more information send an e-mail to hello@nzym.org.
 
Tags
  • #tech
Icon
THANK YOU

You will receive an email with a download link. To access the link, please check your inbox or spam folder