Why C and why Vely?
C
Writing programs in C generally results in fastests and smallest programs, which is the reason why it's widely used in system programming and infrastructure software. C is also the
greenest programming language, which means if all programs were written in C, there would be considerably less emissions, water use and pollution, not to mention we would all enjoy faster software that requires less hardware and consequently less use of resources.
On the other hand, the reason why you wouldn't have picked up C in the past may be memory management and low-level constructs. That changes with Vely.
Vely
Vely is a framework for C that lets you rapidly build server-side applications of maximum possible performance with code that's ergonomic, easy to write and read, and considerably safer than C alone.
Vely
statements are embedded in C code and designed to be declarative, i.e. a single line of code performs a task that is meaningful to a human, and without having to know details of how exactly to do it. Such tasks include building strings, querying databases, outputting data, file manipulation, memory structures like hash and fifo, program execution, encryption, encoding, JSON parsing, web stuff like cookies, input parameters, uploading and downloading files, request handling, daemonizing etc. - in short, lots of high-level stuff you need every day and don't want to spend time reinventing the wheel.
When you use Vely statements, you do not need to allocate/free memory, or worry about buffer overruns or memory violations; you also get automatic memory freeing and automatic file closing.
Vely generates C underneath for several reasons. It is the shortest route to maximum performance and the smallest memory footprint. C is simple. It also allows usage of virtually any library in existence. And Vely statements are carefully crafted with the goal of generating fast and safe C code on their own. Vely itself is written in C.
Vely's goal is not to write more C code, quite the opposite. By using Vely anywhere possible, C code can be used as a supporting mechanism for Vely statements, such as declaring variables, conditional statements, program flow and usage of external libraries. This means most of the important and difficult parts are done by single-line Vely statements.
Simple and practical
Vely statements look nothing like C, or for that matter like many other popular languages. They are simple and you write them inside C code so there is no need to learn anything new about the layer underneath; C is quite simple and well-known.
Most of Vely statements generate a number of C statements. Still, their scope is typically narrow and the generated code is shallow and direct, similar to what an experienced C programmer would write, incurring virtually no loss of performance. Vely's design omits the classic API look and feel on purpose and focuses on simplicity. The arguments are specified in any order by naming their purpose.
Vely is about practical, actual needs people have; it's about productivity, safety and performance. The idea is to not sacrifice performance at all, and to improve productivity and safety significantly.
What it is, and what it isn't
Vely is not a language. It is a better way to API. As a founding layer, C is a great compromise: rapid and easy development on top of a simple programming base with improved safety and arguably the best performance. This is especially true in the Cloud, where smaller and faster means less CPU seconds, less RAM, less money spent, less energy used and less emissions. And
Moore's law may or may not be failing, but it will take significantly more funding, time and expenditure of all kinds to keep it going, and at some point it may no longer.
In short, the goal of Vely is to lend the superior performance of C to general-purpose application development, and especially web applications. Regardless of what kind of hardware you run, or whatever kind of software you're designing, ultimately, performance matters.
What does Vely look like
Here's an example that lists employees, writes output to file "employees", and then displays the result in a web page or on the command line - all this in less than 30 lines of code:
void list_employees() {
out-header default
@<html><body>
char *header = make_header();
p-out header
write-string define outmsg
run-query ="select name, salary from employees order by name" output name, salary
@Name: <<query-result name>>
@<br/>
@Salary: <<query-result salary>>
@<br/><br/>
end-query
end-write-string
write-file "employees" from outmsg status define st
if (st<0) {
@Error in writing file (<<pf-out "%lld", st>>)
exit-request
} else {
p-out outmsg
}
@</body></html>
}
Highlighted with Vely's
syntax_highlighting using
2html.
See also
General (
deploying_application how_vely_works quality_control rename_files SELinux vely vely_architecture vely_removal vf vv why_C_and_Vely )
SEE ALL (
documentation)