Posted
by
timothyon Saturday August 27, 2011 @06:32PM
from the opalong-nothing-to-see-here dept.

phy_si_kal writes "Opa, a new open source programming language aiming to make web development transparent, has been publicly launched. Opa automatically generates client-side JavaScript, and handles communication and session control. The ultimate goal of this project is to allow writing distributed web applications using a single programming language to code application logic, database queries and user interfaces. Among existing applications already developed in Opa, some are worth a look. Best place to start is the project homepage which contains extensive documentation, while the code of the technology is on GitHub. A programming challenge ends October 17th."

In German too. So Germany, Austria, half of Switzerland and Luxemburg are already going WTF or laughing before they even check if itâ(TM)s useful.

(It's not. There is a reason there are different languages: The right tool for the right job. Trying to auto-translate e.g. JavaScript into SQL or regular expressions, is bound to result in a horrible frankenstein monster [which luckily is as slow as a glacier]. And for those languages where itâ(TM)s easy, like PHP, Python, Java, C++, it's not worth it s

I agree. This makes me think of stuff like Linq. SQL is a much nicer language for representing this stuff. Now, they could have added support for some kind of inline sql that could work on objects. Instead, they tried to shoehorn the functionality of SQL into C#/VB.Net syntax, creating something that is just more difficult to use. It's not that hard to learn 3 languages to do web development. Most web developers already know at least 3, languages such as SQL, PHP, and Javascript. Most serious web de

Among the major computer languages [tiobe.com] PHP [wikipedia.org] is Danish with a Canadian citizenship, Python [wikipedia.org] is Dutch, LUA [wikipedia.org] is Brazilian and Ruby [wikipedia.org] is Japanese despite its English name.

Even C++ would be Danish but Stroustrup was working at the Bell Labs when he invented it, furthermore it's an enhancement of C so let's say that the language comes from the US.

I can write complete AJAX-y webapps in Wicket or ZK, including database. They both store state of pages on server side, so AJAX becomes trivial (just rerender the page and send the difference in DOM trees using JSON).

Nope, it doesn't (note: I'm the architect-in-chief for Opa).
Java is used only in the compilation process to run the Google Closure Compiler as a sanity check on our JavaScript libraries. Thanks for the great work by the Google team, by the way, this saved us literally months of JS debugging.

It's an integrated solution. You write one piece of code, and the compiler manages the AJAX interface. So you don't have to write your app in two languages and deal with communication between the server side and client side: the language hides that.

It seems like a good deal in a number of ways, and I think for a new application it might be a good choice. However, there are some problems—they have chosen to define a new language, rather than extending an existing language, so you have to learn and be c

You write one piece of code, and the compiler manages the AJAX interface. So you don't have to write your app in two languages

Sounds like CGI.pm to me! I never went for that. With a code generator you have to be thinking about what it generates all the time, or else restrict yourself to the lowest common denominator... on every feature. And still have a brittle result.

Template systems for the dynamic parts win for a reason. And it isn't because of any shortcoming of Perl, Ruby, or that Aelfinn one.

Business data is stored in Oracle and in various IBM systems. So, if you want to be more than a toy project for funny student work, you can pull data from those. It's as simple as that. That is, of course, unless you are going to create yet another cool thing from scratch and do not care. As I said, a toy with such limited usability that it can only be characterized as a student fun project.

It's different in that network communication is more or less transparent - you write a single program, not two clearly separated client and server parts (and then those in different languages).

Simply put, it's a lot like Volta [wikipedia.org], except that, apparently, didn't get anywhere - even though the CTP was neat (it even let you do integrated debugging, like "step in" on client and it would get you into the corresponding server entrypoint). I think there's something like that for Java also. So this isn't exactly new,

Why yet another language, though, I don't understand. We already have plenty that could be readily used for something like that (C# 5 with "async" feature would be very handy, for example), or you could take one and add some minor extensions.

Well, that's simple: when we started working on Opa, most the languages available today and that could be used to achieve similar features were simply not available. For the automated and secured client-server distribution scheme, we needed some advanced static checking, which ruled out Erlang — or which would have required us to largely reinvent that language. For client-server distribution and for handling many clients, we needed some advanced concurrency mechanisms, which ruled out most other lang

Well, looking through the docs more closely (rather than just the chat example), it sure does look a lot like a dialect of ML to me now, so my earlier comment on "taking an existing language and adding extensions" was redundant. Well, thank God it's statically typed - I'm a bit tired of all the dynamic typing around lately, esp. when its evangelists bring forth arguments which made sense with Java, but don't anymore when you have pervasive type inference.

One thing there that made me wary is the built-in database. So far as I can see, it is essentially just a hierarchy of typed key/value stores?

Well, it is a bit more sophisticated than that. The database is a (typed) graph, so wherever a relational database or a key/value store would store keys as references, the database can store pointers, for instance. This is very powerful and this covers most cases. We also have plans for multi-field look-ups, joins, etc., much of which is actually implemented (but not activated in the released binaries/default config), but finalizing it will have to wait until we find some time and manpower.

I don't know about you but I've never really liked the look of programming languages that use colons. Semi-colons are OK but two dots, one on top of the other? That's just craziness! And "do" statements remind me of BASIC... yuck.

Actually, the colons give me a Pascal vibe. The indents remind me of Python. So, I've got a language that looks a bit like Pascal and Python, runs in Java and generates HTML + JavaScript. The documentation must be a fun read.

Probably the most important implication of AGPL is that it requires you to provide a way for your users to download the sources of the application. In fact Opa facilitates that by automatically enriching the server (in release mode) to serve the source code of the application at a special/_internal_/src_code URL.

But this is not the end of the story. We believe in free software (hence the AGPL license) but we also understand that it may not be very suitable for commercial users of Opa. Such users will be able to obtain a private license (paid). This will allow them to keep their sources closed if they wish to do so and will provide us with funds to further develop and improve Opa — win-win situation:). If you are interested in more details about obtaining such a license, do not hesitate to contact sales@mlstate.com, where we will try to answer all your questions (including pricing).

Probably the most important implication of AGPL is that it requires you to provide a way for your users to download the sources of the application. In fact Opa facilitates that by automatically enriching the server (in release mode) to serve the source code of the application at a special/_internal_/src_code URL.... We believe in free software (hence the AGPL license) but we also understand that it may not be very suitable for commercial users of Opa.

Whether I'm a commercial user or not... why would I - or anyone - ever want web visitors to be able to grab the SQL username and password I'm using in the back end?

Whether I'm a commercial user or not... why would I - or anyone - ever want web visitors to be able to grab the SQL username and password I'm using in the back end?

Are saying that people actually write username and password in the source code ?

Thats a no no.

Use a configuration file containing secret information so you can protect it. Don't hardcode parameters that might change.Put the SQL information needed in a configuration file that you read before opening the database. Then its easy to changedatabase,

Whether I'm a commercial user or not... why would I - or anyone - ever want web visitors to be able to grab the SQL username and password I'm using in the back end?

You are doing it wrong. Please turn your geek card. Seriously. This is one of the stupidest things I've ever seen, typically done only within the bowels of them most incompetently written software ever. Configuration parameters of any kind are never, ever, ever, ever put in code. It's like Jesus Christ man, this is shit that is taught in in freaking sophomore-level programming classes (seriously.)

Oh please, you're just being difficult. If you want an entirely closed-source application, you can pay them the licensing fee. If you want to go the open source route, but don't want to reveal your passwords, don't put them in the source code: store them in the database.

Oh please, you're just being difficult. If you want an entirely closed-source application, you can pay them the licensing fee. If you want to go the open source route, but don't want to reveal your passwords, don't put them in the source code: store them in the database.

And how, pray tell, are you supposed to get the password out of the database without the password?

You might want to look at the original post, and RTFA (a href=http://opalang.org/#slides=1>in particular, this slide). The "application" is a single executable, containing everything needed to run, including the data store. An additional problem is that the resulting application is itself a server, not code called by a server, so each instance of your app needs to have it's own port. Not very useful at all compared to today's setups:

But the reason for having a database password in more conventional systems is that the database server is separate from the application and therefore can't assume that it's trusted without some sort of authentication. If the database is integrated there's no need for a password in the first place.

Am I the only one scared by the new trend of "languages that compile to Javascript"?

Coffeescript, Opa, there were some more.

I understand first compiling to Asembler and only then to machine code. I understand early C++ compiling to C. Various languages to bytecode...But really, while I love Javascript for many features it provides, creating yet another layer of indirection on top of it seems to serve only one purpose: boost sales of faster hardware...

There are guys doing this at my company, and the reasoning for it is that web developers know JavaScript. They don't necessarily know the back end language that is used to generate web pages (Perl, Java, PHP, etc...).

Rather than have web developers spend time learning the back end, they display a blank div and use AJAX to request the data that they want. Then they can create the web page in JavaScript. I am not sure that this will be good way to go, but I do understand why the business wants to explore t

I think you missed what the parent was talking about. He didn't mean implementing more things in Javascript, he meant allowing developers to use non-Javascript languages to generate Javascript. It's so people don't have to use Javascript or learn it, not the other way around.

What you mention, the pattern of generating pages using AJAX, is still fairly new. I use it a lot for data that is updated in real time, and some websites are using it for static data as well. I very much like it for cleanly separat

It depends on how cleanly it maps to Javascript's concepts. I don't really see almost anything in the core Opa language [opalang.org] that doesn't map reasonably well to JS. It shouldn't be particularly slower than JS by itself.

OTOH, I've seen one line of Coffeescript create a dozen of JS lines. Sure it means writing faster. But the problem with writing faster is that you spend the same amount of effort to create the same amount of lines of source, and suddenly you have five times as much of actual runtime code.

Integrating everything into one thing seems like a poor idea. Sure, it makes it a little easier for the dev, but in the end, you are just learning 5 times the amount of Opa when you could learn each thing. Not only that, but can one thing really do all those tasks the other things do, and do it as well? Even if it can, it's harder to keep all of those on a level, you can't replace those parts if you find something better. It just seems to me that splitting things down into the parts seems like something we should be doing, not reversing. I also really don't like the whole compiling to JavaScript behaviour. Maybe just because I don't like JavaScript.

Integrating everything into one thing seems like a poor idea. Sure, it makes it a little easier for the dev, but in the end, you are just learning 5 times the amount of Opa when you could learn each thing.

Well, that's not quite true. Having the same language for database manipulation and for in-memory manipulation is a huge time-saver. Having the same language (indeed, the same piece of code) for server-side validation and for client-side validation is more efficient and less bug-prone. And you have only learnt one thing.

Not only that, but can one thing really do all those tasks the other things do, and do it as well? Even if it can, it's harder to keep all of those on a level, you can't replace those parts if you find something better. It just seems to me that splitting things down into the parts seems like something we should be doing, not reversing.

Ok, on this, you may have a point.

I also really don't like the whole compiling to JavaScript behaviour. Maybe just because I don't like JavaScript.

Well, that's part of the point: with Opa, you do not need to write any JavaScript.

Caveat I'm part of the Opa team. Well, worse than that, I'm the archite

No idea whether it's viable long-term, but I thought it's really interesting. It does way more than GWT does, for example. It's also statically typed, yay.

Here's some example code from the tutorial [opalang.org]. This is a chat room [opalang.org]. Apart from CSS, this is the entire soure code required to create the chat room server. Yikes. Had to get rid of the comments to appease the spam filter, unfortunately.

Why is a new programming language required to "make web development transparent"?

Opa automatically generates client-side Javascript and handles communication and session control. The ultimate goal of this project is to allow writing distributed web applications using a single programming language to code application logics, database queries and user interfaces

Wt [webtoolkit.eu] does exactly the same but in C++. You develop webapps like desktop apps: widgets, ORM, etc. No need to care about Javascript, HTML, etc. Compilers available on all platforms. The result is a single binary which includes an embedded HTTP(S) server.

While I agree with what Opa wants to achieve, inventing a new programming language for that end is unnecessary and, in fact, will become a burden: they will need to maintain both the language and the library. But actually the value lies in the library, which is the one that needs to deal with HTTP, Javascript, AJAX, etc

You're the debian packager for Wt, so you must know Wt much better than I do.
However, both projects are very different and you should probably have a real look at Opa before popping up on every story about Opa (followed by another comment by someone else saying the link was useful, history repeats;).
Opa is high-level language for writing web apps.
Wt is a toolkit for writing web components in C++.
There is an order of magnitude between the length of application code in Opa and in Wt. Wt handles everythi

Wt is also for writing webapps. My main gripe with Opa (which I have looked into:-) ) is the need to write HTML, XHTML, CSS, etc With Wt, I do not need to care about that. I do not even need to care about the browser supporting AJAX, SVG, or whatever. Wt takes care of everything.

Just what we need, more sites spewing out poorly-designed client-side script badly rendered by any number of JS browser implementations. Like many others, I do everything possible to block JS...why does anyone think the future lies in more client-side code?

Dear Creators of Opa - Honestly, what were you thinking? Opa is basically another crack at the same approach that ColdFusion tried years ago, and failed at. Opa isn't Object Oriented, meaning that developers working in an OOP language (Java,.NET, Python, PHP, Ruby, Perl, etc) will have a tougher time making the transition - it also means that Opa can't implement or support standard Design Patterns, which is a huge mistake IMnsHO. The sample code on the Opa site shows a mix of Opa functions, database interaction, markup language, CSS, Javascript... what a mess. Haven't we all learned that clean separation of functional application concerns is the only way to write scalable, enterprise-class programs yet? Opa doesn't appear to support any database beyond it's own build-in, slightly obfuscated one, meaning it will gain no enterprise/business traction. As much as I like to see new programming languages succeed, I have to agree w/ a lot of the other posters on/. - Opa is dead on arrival.

Thank you for your considerate feedback.<sarcasm mode="off"/>. While we understand very well the drawbacks of Opa not being Object-Oriented (at least not in the usual meaning of the term), there are several reasons for this choice. The first and most important of these reasons is that experience from 15+ years of experienced developers writing scalable systems with Object Oriented Programming Languages, and concluding that OO is not the right paradigm for the task, and that other paradi

So they're targeting javascript. This is going to be, uhm, not the most efficient approach.

What should happen, imho, is for W3C to develop a (non-garbage collected, as in no garbage collection) low level language, which can serve as a platform for other languages, like this one. Current compiler and virtualization technology can easily and efficiently translate such low level language into something native. And as a result, we could have a much richer web environment, and we'd not be dependent on that one s

I don't mind making any and all my code available to others. And I understand the "give-back" qualities of GPL. But a GPL language that makes every program written in it have the GPL License?!? Good grief. I am laid back about the whole License Wars, but AGPL gives me pause.

I probably won't even bother learning a little bit of this language to understand it's good qualities. Plus I've never cared for indentation defining blocks.

How does opa handle multiple threads of execution? Any decent server nowadays just needs to have multiple threads of execution, sometimes even thousands of them to work in a non-blocking way. Opa seems to be "non-blocking" (I read from the tutorial), but you have non-blocking and non-blocking... One version simply uses one thread and an event-loop (aka non-preemptive multitasking). This is not truly non-blocking, as large I/O operations in one task still prevent other tasks from working. And does opa allow

Hmmm, fibers may not be the right tool for making low-latency (highly responsive) multi-user applications. The problem is that when one fiber is doing a lengthy task, the other fibers are sleeping until the first fiber yields. That's why the popular web-servers go through all the trouble of spawning multiple threads instead of just using an event-loop approach (using select, epoll and kqueue). Sure, you will not have any additional context-switching overhead that way, but today low-latency is what counts.

Even if the fibers are small, they may invoke kernel calls which take a long time to complete (for example a large I/O operation). How do you ensure that other fibers can continue their work in such cases?

Further, the smaller your fibers get, the more overhead you introduce for context-switching, right? Because I can imagine that after execution of each fiber you need to do some scheduling (even if the current fiber remains active). Is this context-switching faster than the kernel can do it?

We have lightweight threads can be preempted any time they are not in (Opa) kernel mode, and rely on asynchronous I/O (epoll/kqueue/completion ports) to achieve non-blocking I/O. Does this answer your question?

Could you explain this a little further? In my understanding, the epoll based approaches are all synchronous, non-preemptive. That is, in such a method you wait in an event-loop for events, and when an event arrives, you perform some action, effectively keeping other events in the queue. This means that if one event triggers a lengthy computation, then other users of the system may experience non-responsiveness.

I was just thinking: this is exactly what we need! Yet another programming language. And even more "web apps". Yay!

You're not getting it. Don't think of web apps as some separate application layer, think "web". This is where its going, its already there to be honest. If you're not prepared for that simple fact you're in for a bumpy ride as its only going to get more "webby" in the future. And a new language that ties all that in a more comprehensive way is going to be a good thing.

Yes, and if Javascript weren't so bloody limited, that would be a great solution. Why, oh why, couldn't they just have embedded Scheme, which has all the wins of Javascript, and none of the limitations? Sigh.

Is there any reason that a language like Java, C#, C++, Python, Perl or Ruby, or with the appropriate framework and compiler couldn't do the same thing that Opa is aiming to do?

On Hanselminutes, Scott Hanselman interviewed a guy who made the statement "Javascript is the machine language of the Internet", alluding to the fact that it is better from a productivity and performance perspective to develop in a lot of other languages (C# in this case) and have compilers that know how to create optimized, minimiz

A framework would simply provide useful constructs to use in the language the framework is built for... the heavy lifting would have to take place in a separate compiler. I do not see a reason why such a compiler could not be created for any other language.

I think you're misunderstanding the concern. If I build my code using GCC, then GCC itself may be open source under whatever licence, but my code is mine to license as I wish. If you follow the link I gave above, you'll find that the Opa guys think that not only Opa itself but also anything you write with it should be forced open (by their definition of open, which is different to almost anyone else's). That's the kind of policy that gets abrupt from corporate lawyers saying "Put this within 50 miles of our network and you're fired". It's also incompatible with many other popular OSS licence policies.

That license is less bad than the QT Free license (mid 90's). Which basically said you had to give your application away, or make source available or you needed to use the commercial QT. As an aside, this was the whole problem with KDE. While KDE (GPL) qualified under the QT license just fine. QT didn't qualify under the GPL. Thus the opinion of Debian legal was that no one but the KDE foundation could legally distribute KDE since a licensee (but not the copyright holder) cannot

There are two reasons that GCC does not cover that kind of code. One is that the mere act of compilation (a mechanical translation of the code from one form to another) does not implicate copyright. The other is that GCC includes a specific exception for standard header files and things that it compiles or links into your code as a result of the language features you use. The Opa developers explicitly reject [opalang.org] that approach.

Actually compilation may impact copyright. You need to be licensed for various media. So for example if you have a music license for casette that doesn't permit CD redistribution. The courts do not look upon purely mechanical processes as not creating a new derived work.

Compilers on the other hand almost always explicitly state they aren't invoking those rights. GCC makes sure all libraries that are distributed standard (i.e. dynamic) are LGPL. But... there are GPLed 3rd party libraries and they would cr

Uh, what? I'm guessing you posted as AC because you didn't want to get modded down for posting flaming bullshit. Let me guess, you're a Perl developer who's still pissed Perl* doesn't offer a comparable framework and still won't accept the fact that Perl 6 will likely take another 5 years and all the shiny new functionality has been available in Ruby since you first heard about it. Rails is still very alive and well and is used in quite a lot of major sites. Rails 3.1 has some really nice improvements as we

In those 30Mo you have just everything (the web server, the database engine, the scheduler, the page engine, the session engine, your webpages source, css, the generated js, etc) ! It's a standalone binary that just works on your server without having to install anything more. Did you check the size of the LAMP / Java / Ruby packages?

I would love to see some eCom or other complex sites written in opa to convince me that this is a viable alternative to Ruby, Java, PHP, etc.

MLstate did launch an eCom-like site : http://jetleague.com/ [jetleague.com]
And I just check the binary on our server: 17Mo (yes, I guess it has been upx-ed)!