February 12, 2012

Now that Eqela is out and available, I will most probably keep posting a lot of things related to that for a while. In line with that thought, here's the first one: Eqela is a really good way to do things that previously required developing using the C (or C++) language.


Now I don't have anything against C/C++. Quite the opposite. Up to this day, anyone who starts working at Job and Esther Technologies is required to go through a training stint using C (everyone in the team, past and present, can testify to this). For some this is a very painful exercise; for others it's less painful (but often still somewhat painful). But it is needed because C is very central to computing in general.

But somehow C/C++ development is just painful. Not just for those who are not experts; even with extensive experience in C/C++, it is not the most productive environment to work in. From my own days working as a C++ programmer, I remember spending enormous amounts of time doing technicalities, having found a routine way of writing my class templates and handling memory allocation/deallocation/etc. Not having found such a routine just means that you may have a hard time managing memory, and that's just the doorway to mysterious crashes, memory corruption, etc. Difficult things to master, requires quite of bit of expertise, and at the end of the day, you still won't be as productive as you could be. And from the employer perspective, these are skills that are both hard to find and hard to develop. And once found and/or developed, tricky to maintain (right, employers?).

That's why many have found a happy place with Java. Some have found it with scripting languages like PHP, Python, etc. But while developers may find themselves productive with these languages, it is understood that the developer productivity comes at the expense of computer productivity. Code is faster to write; but it does not execute as fast. Or it uses more memory to do the same thing. Less typing and less thinking for the programmer; but much more work for the computer. The tradeoff is fairly well accepted and understood. C/C++ is considered for programs that need "maximum performance”, and scripting/interpreted languages for things that are not as "performance critical”. Or the problem is solved by using an interpreted language and putting in more memory or by adding more servers (in the case of server side applications, obviously).

Eqela, now, fits on both sides of this standoff. It delivers the speed and performance of C (since, in fact, an Eqela program IS a C program as well, through the compilation process), but the language syntax is dynamic and fast to type. We always say it is very "Java-like”, but in fact it is much faster to type than Java. From my days as a Java programmer, I remember typing enormous amounts of English. By convention, all names of variables and classes are long and tedious to type, not to mention all of "extends”, "implements”, "instanceof”, etc. Everything is so verbose in Java; and the programmer ends up typing so much. With Eqela, just the fact that one can use the "var” keyword instead of typing the full variable names at all times, most probably will save a lot of man years of programmer time. But that is not the only typing saver we have tried to put in there.

And as is also cool with Eqela programs, there is no loss of flexibility. One can always write C code if one wants to do something very C specific. Consider this class, written in Eqela:

class TCPSocket {
    int create() {
        int v = 0;
        embed "c" {{{
            v = socket(AF_INIT, SOCK_STREAM, 0);
        }}}
        return(v);
    }
}

Line 5 there is obviously pure C code, and can be anything you would want it to be (obviously as many lines and as much complexity as is needed). If you want to go really out there, you can even do this to achieve roughly the same thing:

class TCPSocket {
    int create() {
        int v = 0;
        embed "c" {{{
            __asm__("sub $12,%%esp\n"
                "movl $2,(%%esp)\n"
                "movl $1,4(%%esp)\n"
                "movl $0,8(%%esp)\n"
                "movl $102,%%eax\n"
                "movl $1,%%ebx\n"
                "movl %%esp,%%ecx\n"
                "int $0x80\n"
                "add $12,%%esp\n"
                : "=a" (s)
            );
        }}}
        return(v);
    }
}

Obviously by going C code, you introduce a dependency on the C language (to compile the same Eqela program to Java, you would need to provide a matching embed "java” block); and by introducing x86 assembly, you introduce a dependency on Intel compatible processors. But the choice and the power is given to the programmer to do the things that are necessary; unlike with many alternative languages, where you more or less have to go with what you've been given.

Of course someone in the audience will say that in Java you can achieve this with JNI. Sure. But it will take massive amounts of programming, build systems, glue code and effort, and will continue to take all those things as you continue to maintain the program. Just look at the above samples. Is that straightforward or what?

So there's one thing that I find cool about Eqela (there are still many more). I hope some of you out there will appreciate it. For applications purely in this domain of programming, the Eqela/Sys product is a good fit. It is available and ready, and can be availed through the Eqela website today. I hope that it would be found useful and that it would help more organizations achieve great things faster. If you do find yourself intrigued, do sign up on the site (it doesn't cost anything and requires no commitments) and find out more. You can always let us know how we could help.


Share this article: