Hi,
I'm still exploring many web technologies and I'm a beginner in the field, well actually I'm getting back to programming after about 9 years of complete absence from it. I was wondering if Cobra could eventually be a good language for client side and server side script to be used instead of current web technologies like PHP and Javascript. I've heard good and bad things about PHP, but most people find it a poor choice in the long run. I personally don't find PHP code to be particularly pretty even though it is supposedly very easy to learn. Since some people prefer to use Python instead of PHP in the long run, I was wondering if it would be possible to use Cobra instead of PHP and Python? Do anyone foresee any major obstacles to it?
Similarly, Javascript could be made much better, and it actually was made much better with Coffeescript. From the little knowledge I have, Coffeescript looks great and seems much more easy to work with and simpler in most ways. I understand that for a client side script language it has to be made standard by the different browsers of the industry to be a smart choice. And since Coffeescript compiles to Javascript it's not a problem. Would it be possible to make Cobra compile in Javascript just like Coffeescript does? Or could Cobra replace Javascript altogether at some point as a performant client side script language?
I am looking at making the right choice of languages for a few web project I have in mind and I would really like to consider Cobra if at all possible, because if more of us are using it in more places it will give the languages more visibility and more chance to be adopted and become a standard.
What are your thoughts?
Forums
Cobra instead of PHP and/or Javascript?
18 posts
• Page 1 of 2 • 1, 2
Re: Cobra instead of PHP and/or Javascript?
I was just reading that some people use C# with ASP.Net to write web based applications and even though not too easy to get around at first, it can be a smart and powerful choice in the long run. Since Cobra compile to C# and is well integrated with C# and .Net from what I read, I'm assuming it would be possible to develop and program in Cobra for server side applications.
I'm wondering if this means that, Cobra doesn't even have to be installed on the server as long as the server is running on windows and .Net friendly? Because if Cobra compiles to C#, and most Hosting Companies running windows server, offer .Net support, I'm assuming it should not be a problem.
I guess, I would still be stuck with Javascript or Coffeescript for client side programming, and Coffeescript doesn't look too bad and should work well for AJAX technology.
Am I completely wrong on this?
I'm wondering if this means that, Cobra doesn't even have to be installed on the server as long as the server is running on windows and .Net friendly? Because if Cobra compiles to C#, and most Hosting Companies running windows server, offer .Net support, I'm assuming it should not be a problem.
I guess, I would still be stuck with Javascript or Coffeescript for client side programming, and Coffeescript doesn't look too bad and should work well for AJAX technology.
Am I completely wrong on this?
- MaximC
- Posts: 15
Re: Cobra instead of PHP and/or Javascript?
Re: compilation and hosting:
Cobra compiles to C# and then immediately invokes the C# compiler to compile down to bytecode (stored as CIL in .exe or .dll extensioned files). In the end, you get the same kind of bytecode that you would get from C# and VB, and .NET ultimately only cares about the bytecode.
Re: server side web dev:
What we're lacking as a language community is a public, simple, sample blog application written in Cobra against a web framework which could be any of:
-- ASP.NET MVC
-- MonoRail
-- OpenRasta
-- Nancy
-- FubuMVC
-- A new Cobra web framework
Throw in a few basic features like comments and user management, and now we have a web app that people can learn from or even gut in order to build out to their own requirements.
I've made a couple forays into this, but I always get sidetracked by the main compiler work. If you look at other language communities like Python and Ruby, the people who push the web dev forward and the people who work on the language/compiler/interpeter are not the same people. There is enough work to go around in both areas!
We need one or more people in the Cobra community to head up the web dev investigations and discussion.
Re: client side web dev:
The only ubiquitous client side language right now is JavaScript. We don't have a JavaScript back-end for Cobra at this point in time. Also, CoffeeScript was designed to be a wrapper for JavaScript so there is little to no overhead. Compare that to languages like Python and Cobra where there would be extra run-time operations to capture the semantics of the original language.
What the world needs in general is a ubiquitous client side low level asm-like language or bytecode (sans issues like "slow startup", "slow execution" and "buggy"). Until then, I think CoffeeScript is our best bet for client side.
Cobra compiles to C# and then immediately invokes the C# compiler to compile down to bytecode (stored as CIL in .exe or .dll extensioned files). In the end, you get the same kind of bytecode that you would get from C# and VB, and .NET ultimately only cares about the bytecode.
Re: server side web dev:
What we're lacking as a language community is a public, simple, sample blog application written in Cobra against a web framework which could be any of:
-- ASP.NET MVC
-- MonoRail
-- OpenRasta
-- Nancy
-- FubuMVC
-- A new Cobra web framework
Throw in a few basic features like comments and user management, and now we have a web app that people can learn from or even gut in order to build out to their own requirements.
I've made a couple forays into this, but I always get sidetracked by the main compiler work. If you look at other language communities like Python and Ruby, the people who push the web dev forward and the people who work on the language/compiler/interpeter are not the same people. There is enough work to go around in both areas!
We need one or more people in the Cobra community to head up the web dev investigations and discussion.
Re: client side web dev:
The only ubiquitous client side language right now is JavaScript. We don't have a JavaScript back-end for Cobra at this point in time. Also, CoffeeScript was designed to be a wrapper for JavaScript so there is little to no overhead. Compare that to languages like Python and Cobra where there would be extra run-time operations to capture the semantics of the original language.
What the world needs in general is a ubiquitous client side low level asm-like language or bytecode (sans issues like "slow startup", "slow execution" and "buggy"). Until then, I think CoffeeScript is our best bet for client side.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Cobra instead of PHP and/or Javascript?
Btw we do have an SCGI module for Cobra so you can back a web page with Cobra code right now, but it's a very low level approach. No framework here.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Cobra instead of PHP and/or Javascript?
Wouldn't .Net or more specifically ASP.Net be considered a general purpose framework for web dev? When you say no framework do you mean, no "Content Management" framework like Wordpress, Django or Joomla?
I am starting to get back into web dev from very, very far, but if possible, I'd like to attempt to play with Cobra, Coffeescript, ASP.Net even if that means I would have to code the web dev from scratch. I believe it would help me learn more in dept and get more familiar with all those language. And since it is a personal project I would not be rush by time.
Also, inspired from Coffeescript, maybe, like you said, there could be a wrapper for Javascript called Cobrascript which would try to use some Cobra concept for syntax and coding philosophy. That would probably have to come from the Cobra community in the long run.
Now, the thing about Cobra is that, even though it is open source, it seems to be somewhat dependent of proprietary solutions like .Net, C# and Microsoft servers. I have to say that even though those proprietary solution are very professional and well done, I have a thing against "Proprietary Technologies" in general. I try to avoid them because I'd much rather try to support and spread open source solutions. Using proprietary solutions end up representing added cost usually, and possibly hinder some people from getting into Cobra for web dev. I took a look and from what I could identify, it represent double the cost of hosting in most cases, which is not that bad. You can host a reasonable site for 10-20$/month. Definitely not the end of the world. But the majority of the open source community seems to like cheap stuff and to stay away from Windows as much as possible.
I wonder if it will be eventually possible to see Cobra on Linux and Mac just like Python, without using Mono. Charles, I feel that you might have some love for Mac since you use to work with Obj-C a bit, and I would love to see Cobra as a standard eventually.
The community needs to find a way so that the core of you beast coding guys can put 100% of your work time in developing the language/compiler/interpeter. That would help a lot for the language to take off. Maybe some day, big companies will see the genius in Cobra and you'll start receiving decent donations and live comfortable on them.
I am starting to get back into web dev from very, very far, but if possible, I'd like to attempt to play with Cobra, Coffeescript, ASP.Net even if that means I would have to code the web dev from scratch. I believe it would help me learn more in dept and get more familiar with all those language. And since it is a personal project I would not be rush by time.
Also, inspired from Coffeescript, maybe, like you said, there could be a wrapper for Javascript called Cobrascript which would try to use some Cobra concept for syntax and coding philosophy. That would probably have to come from the Cobra community in the long run.
Now, the thing about Cobra is that, even though it is open source, it seems to be somewhat dependent of proprietary solutions like .Net, C# and Microsoft servers. I have to say that even though those proprietary solution are very professional and well done, I have a thing against "Proprietary Technologies" in general. I try to avoid them because I'd much rather try to support and spread open source solutions. Using proprietary solutions end up representing added cost usually, and possibly hinder some people from getting into Cobra for web dev. I took a look and from what I could identify, it represent double the cost of hosting in most cases, which is not that bad. You can host a reasonable site for 10-20$/month. Definitely not the end of the world. But the majority of the open source community seems to like cheap stuff and to stay away from Windows as much as possible.
I wonder if it will be eventually possible to see Cobra on Linux and Mac just like Python, without using Mono. Charles, I feel that you might have some love for Mac since you use to work with Obj-C a bit, and I would love to see Cobra as a standard eventually.
The community needs to find a way so that the core of you beast coding guys can put 100% of your work time in developing the language/compiler/interpeter. That would help a lot for the language to take off. Maybe some day, big companies will see the genius in Cobra and you'll start receiving decent donations and live comfortable on them.
- MaximC
- Posts: 15
Re: Cobra instead of PHP and/or Javascript?
I meant that when you use the SCGI module, there is no framework that comes with it like MVC or anything else. It's low level.
.NET could be called a general purpose development framework.
ASP.NET and ASP.NET MVC are web development frameworks.
Yes, WordPress and Joomla are CMSs, but Django is another web dev framework in the same category as ASP.NET [MVC], Ruby on Rails, Webware for Python, etc.
Re: "proprietary", I'm doing most of the Cobra compiler development on Ubuntu Linux 12.04 with Mono 2.10 neither of which is proprietary. I still test on Win 7 32-bit + .NET 2, Win 7 64-bit + .NET 4 and Mac 10.6 + Mono 2.10.
Re: "I wonder if it will be eventually possible to see Cobra on Linux and Mac just like Python, without using Mono." ... Mono supplies standard libraries, a garbage collector, machine code generator and much more. Dumping Mono means implementing those things ourselves or cobbling together other open source components. With Mono already being open source under the MIT license and available on Mac and Linux (and even iPhone and Android via Xamarin compilation tools), doing that non-trivial extra work is not attractive.
In terms of shipping things without requiring a Mono install first, Mono provides tools for that too:
mkbundle: https://www.google.com/search?q=mkbundle
linker: http://www.mono-project.com/Linker
I have love for the Mac, but don't know when I'll have free time to push the Objective-C back-end forward. I suppose I would be more encouraged if Linux supported the same Objective-C language and base libraries with high compatibility and minimal fuss so that I was targeting two platforms. My servers tend to run Linux.
The last time I tried Obj-C on Linux, it did not support the garbage collection option that is available on Mac. That was awhile ago.
Re: funding, I doubt a series of donations will come along and replace my current income as a contract software developer. But being sponsored by a company that can afford it is certainly possible. Google sponsors Guido van Rossum on Python. He just had to work on it for about 15 years first.
.NET could be called a general purpose development framework.
ASP.NET and ASP.NET MVC are web development frameworks.
Yes, WordPress and Joomla are CMSs, but Django is another web dev framework in the same category as ASP.NET [MVC], Ruby on Rails, Webware for Python, etc.
Re: "proprietary", I'm doing most of the Cobra compiler development on Ubuntu Linux 12.04 with Mono 2.10 neither of which is proprietary. I still test on Win 7 32-bit + .NET 2, Win 7 64-bit + .NET 4 and Mac 10.6 + Mono 2.10.
Re: "I wonder if it will be eventually possible to see Cobra on Linux and Mac just like Python, without using Mono." ... Mono supplies standard libraries, a garbage collector, machine code generator and much more. Dumping Mono means implementing those things ourselves or cobbling together other open source components. With Mono already being open source under the MIT license and available on Mac and Linux (and even iPhone and Android via Xamarin compilation tools), doing that non-trivial extra work is not attractive.
In terms of shipping things without requiring a Mono install first, Mono provides tools for that too:
mkbundle: https://www.google.com/search?q=mkbundle
linker: http://www.mono-project.com/Linker
I have love for the Mac, but don't know when I'll have free time to push the Objective-C back-end forward. I suppose I would be more encouraged if Linux supported the same Objective-C language and base libraries with high compatibility and minimal fuss so that I was targeting two platforms. My servers tend to run Linux.
The last time I tried Obj-C on Linux, it did not support the garbage collection option that is available on Mac. That was awhile ago.
Re: funding, I doubt a series of donations will come along and replace my current income as a contract software developer. But being sponsored by a company that can afford it is certainly possible. Google sponsors Guido van Rossum on Python. He just had to work on it for about 15 years first.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Cobra instead of PHP and/or Javascript?
Charles wrote:In terms of shipping things without requiring a Mono install first, Mono provides tools for that too:
mkbundle: https://www.google.com/search?q=mkbundle
linker: http://www.mono-project.com/Linker
That is very interesting! Because I find that the main drawback of using Mono and the like is that it is very inconvenient for the general users to have to install something a platform to be able to run a software or an application. I know that I personally don't like to install platforms like Adobe AIR for example. And also, aren't platform affecting performances as well. I wouldn't be able to know how much from experience, but I'm sure there must be something noticeable.
If it is possible to package Mono with the software, and things are seamless, then it's much more convenient.
- MaximC
- Posts: 15
Re: Cobra instead of PHP and/or Javascript?
Whether or not Mono is making things slower or faster depends on where you are coming from. If you are coming from Python, PHP or Ruby, things get much faster. If you are coming from C or C++ things are getting somewhat slower.
If you throw in other approaches like CPython, the picture gets more complicated. But here is an overview based on small benchmark programs:
http://shootout.alioth.debian.org/u32/w ... astest.php
Cobra runs at the same speed as C# when -turbo is passed to turn off contracts, assertions, nil/null checks, etc.
Regarding real life applications, once you throw in common network I/O, database operations, operating system calls, etc. the performance differences are less severe due to those common elements and also how slow some of them are (I/O).
Overall, I'm satisfied with Mono's performance.
If you throw in other approaches like CPython, the picture gets more complicated. But here is an overview based on small benchmark programs:
http://shootout.alioth.debian.org/u32/w ... astest.php
Cobra runs at the same speed as C# when -turbo is passed to turn off contracts, assertions, nil/null checks, etc.
Regarding real life applications, once you throw in common network I/O, database operations, operating system calls, etc. the performance differences are less severe due to those common elements and also how slow some of them are (I/O).
Overall, I'm satisfied with Mono's performance.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Cobra instead of PHP and/or Javascript?
Charles wrote:Mono supplies standard libraries, a garbage collector, machine code generator and much more. Dumping Mono means implementing those things ourselves or cobbling together other open source components. With Mono already being open source under the MIT license and available on Mac and Linux (and even iPhone and Android via Xamarin compilation tools), doing that non-trivial extra work is not attractive.
In terms of shipping things without requiring a Mono install first, Mono provides tools for that too:
mkbundle: https://www.google.com/search?q=mkbundle
linker: http://www.mono-project.com/Linker
When we create a bundle with the minimum libraries, do we still get the advantage of the "garbage collector, machine code generator and much more"? Could I really just package "one program" with Cobra code that would benefit from all of this and run on Linux, Mac and Windows with the exact same code?
- MaximC
- Posts: 15
Re: Cobra instead of PHP and/or Javascript?
Yes, you get any std library classes that you use, plus the garbage collector. I'm not sure if you get code gen or not. I haven't needed to use mkbundle myself, but it's nice to know it's there.
Re: running on all platforms off one x86 binary, I doubt it. But then I don't know where you can get that anyway. For example, the Python community has a tool to make a Windows .exe, but that's not going to run on Linux (sans Wine). And Mac OS X uses application bundles ("Foo.app") with a specific directory layout, that no one else uses.
On a related note, I copied a Cobra+OpenTK bytecode-based .exe that was created on Mono+Mac over to Windows and it ran immediately and with hardware acceleration. I thought that was pretty cool.
So you can have a foo.exe which is bytecode based and run it on both Mono and .NET. Or you can compile your program down to native code for a specific platform like Linux, Mac or Windows.
In addition to Mono's offering, there are $commercial linkers for .NET that do the same thing.
Just remember: If we make a standalone Cobra, that means redoing a lot of the work that we currently get for free from Mono, .NET and JVM.
Re: running on all platforms off one x86 binary, I doubt it. But then I don't know where you can get that anyway. For example, the Python community has a tool to make a Windows .exe, but that's not going to run on Linux (sans Wine). And Mac OS X uses application bundles ("Foo.app") with a specific directory layout, that no one else uses.
On a related note, I copied a Cobra+OpenTK bytecode-based .exe that was created on Mono+Mac over to Windows and it ran immediately and with hardware acceleration. I thought that was pretty cool.
So you can have a foo.exe which is bytecode based and run it on both Mono and .NET. Or you can compile your program down to native code for a specific platform like Linux, Mac or Windows.
In addition to Mono's offering, there are $commercial linkers for .NET that do the same thing.
Just remember: If we make a standalone Cobra, that means redoing a lot of the work that we currently get for free from Mono, .NET and JVM.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 6 guests