This is a mirror of official site: http://jasper-net.blogspot.com/

The Cobra Programming Language

| Thursday, May 6, 2010
There are plenty of object-oriented programming languages in .NET such as C#, IronPython and IronRuby. Why would you want to use Cobra instead?

This would seem to be a silly question on first glance. However, Cobra is much more than Python without the eccentricities and with the raw performance of C#;  In addition, It has the support for automated unit-testing from D, the software contracts introduced by Eiffel, the static and dynamic binding of  Objective-C or Boo. It introduces Nil-tracking to eliminate some of the most difficult errors in code that are caused by NULLs being passed as parameters. Moreover, Cobra creates the same kinds of classes, interfaces, method signatures, etc. that are found in C# and Visual Basic, so that it will produce assemblies that are compatible. This allows Cobra to coexist with the more conventional .NET languages in applications.

Cobra isn't a port to .NET from the world of Linux, it is intrinsically bound up in the .NET framework and takes advantage of the standard library, the class/object model, including events, and the use of generics. Rather than compiling straight to MSIL, it acts as a pre-processor for C# which is in turn compiled to MSIL. This means that it is safe to use in a mixed project that uses C# as well as Cobra. It plays nice with C# and VB

Cobra is an excellent general-purpose imperative scripting language as it is able to do dynamic binding.

An aim of Cobra is to allow the programmer to write robust applications with a minimum of bugs. The use of Contracts, which are analogous to constraints in SQL, are implemented in a way that is very close to Eiffel. Cobra also allows you to embed unit-tests into the code, which can be executed at compile time, and every time the code is run, to catch the simple but irritating coding errors without having to create a separate test suite. You can use both of these, but they definitely improve the readability of code, since the unit tests also act as coding examples. If you also add the 'documentation' feature, primitive though it is, your source code will be starting to look clear and nicely laid out. Cobra actually rewards good coding practices.

Read more: simple-talk

Posted via email from jasper22's posterous

0 comments: