GWT kind of thing in .NET - java

Is there is any alternate of GWT in .Net. GWT is basically an API from Google which allows you to code in Java and when the application is deployed, the GWT cross-compiler translates the Java application to standalone JavaScript files that are optionally obfuscated and deeply optimized.
For more details visit :- http://en.wikipedia.org/wiki/Google_Web_Toolkit

You may checkout Script# but to be honest with you those kind of things don't get enough attention in the .NET world as this might be the case with GWT.

From a quick google: jsc, SharpKit and Script#.
However as JavaScript becomes more ubiquitous (and it will node.js etc) it may be worth investing the time to learn to code JavaScript natively.

I don't think so. There are some projects that try to do cross-compilation of C# to JavaScript (ScriptSharp, SharpKit), but I don't think it's the right way to do it.
I would suggest investing the time into embracing the web as it is and trying a MVC-like web framework (KnockoutJS, AngularJS, EmberJS, BackBone).

Related

Google Web Toolkit Sample Applications

I have googled some time now trying to find a good sample application that is written with the Google Web Toolkit (preferably with Eclipse). I'm looking for a full web application with a database and stuff like the following program on codeplex which is written in ASP.NET and has a login system:
http://mvcmusicstore.codeplex.com/
I found some other sites but they do not contain the exact details that I need:
http://code.google.com/p/gwt-examples/wiki/project_MySQLConn
http://code.google.com/intl/nl/webtoolkit/examples/
I want to learn GWT because I think it has some great advantages.
Generate (good and cross-browser compatible (>IE6, >FF~2.0, >chrome1)) JavaScript at the server-side for the client that will save CPU cycles on the server
Use Java at the server (instead of C# with ASP.NET) which is free to use and deploy, and is a good OO language
Program and test in other OS's than windows (LAMP server, free :) )
Out of the box HTML5 support which can be used as a replacement for flash/silverlight animations to save bandwidth
Eclipse has a visual designer plugin (GPE) where you can put widgets on and works like WPF/Silverlight where I have already some experience with
The widgets are great and I expect them to work like the WPF/Silverlight equivalents (stackpanels, grids etcetera)
Google uses it (so it must be great :P )
Some disadvantages in my opinion:
No good support for VS2010 (super IDE of course)
Not as many users as ASP.NET or PHP (?) so less good code examples to find
Not many I think? Maybe some little debug difficulties because of the generated JavaScript
Please criticize this as much as possible ;)
GWT projects are almost identical to other Java-based web applications. Client side has the major differences (and limitations therefore) of course, but everything else is pure Java. Maybe it would be better to start off by learning Hibernate, servlets and such? Find out the best techniques for You and then dig into GWT.
EDIT: I found a really detailed GWT tutorial http://www.vogella.de/articles/GWT/article.html

Creating Windows Metro style apps with Java?

I know how to create small desktop applications in Java. I want to know, can I make Windows Metro style apps in Java? Because on the web only C++/C/C#/JavaScript etc. are mentioned. If yes can you please give me some reference for a quick start. If not which one will be easiest language to start?
You can only create metro style apps with C#, VB, JavaScript and C++. There is currently no support for authoring metro style applications with Java.
You cannot make metro style apps with Java.
For the other part of your question, regarding starter's guide and which language is easy, MSDN has a starter's guide which helps building new metro style apps, this, this and this should be helpful.
And which language is easiest, well it depends on the developer, someone who has been developing .NET or WPF or Windows Forms applications maybe more comfortable with he familiar environment and may prefer developing using C++ and XAML or VisualBasic, depending on what he has been using before, while someone coming from web development may prefer javascript.
For new developers, i would recommend using C# and XAML, but again it is my choice, and not everyone will agree with it.
Here is another link which points to guides at MSDN, and adds some additional detail.
I believe you will not be able to use Java and WinRT. The best option for you to try is C#, because this is the language that is closest to java, in my opinion.
WinRT is still based on COM, so you should be able to access it from Java using something like the Java-COM bridge. Using that would probably be quite hard (you'd have to use strings for method names etc.).
If you wanted to use WinRT comfortably from Java, that would require modifying the Java runtime and possibly also the compiler to make them aware of WinRT types.
Actually you can quite easily write a metro style web application by using a CSS library like this one: http://metroui.org.ua/
With this CSS, it is possibly to generate plain old HTML with Java on the server side (e.g. via a servlet) and then reverence the CSS classes.
I did this by using the org.apache.ecs library (it's very old but it works pretty good).
C# and Java are similar, but with different Frameworks. Look into developing Metro Style apps in C#. Remember to sign up for a developer's license for Windows Store Apps!
You could write your app in Java and cross compile into JavaScript using GWT. We do this successfully with a couple of Windows (Phone and Desktop) apps. Additionally, the code can be shared with your iOS and Android ports.
here what i found in sourceforge.net
http://sourceforge.net/directory/os:windows/freshness:recently-updated/?q=slibrary
this is the most close ui to metro theme i saw.

Google Web Toolkit vs Straight Javascript for reasonably large & complex application?

I've got a web conferencing client written predominantly in Java/Swing with some JNI native modules for stuff like: video, audio, and desktop sharing. In total the client is about 400k lines of Java code not including native modules.
We are investigating a long term plan for migrating away from Java/Swing and toward HTML5/Javascript for the client. As of right now, browser support is shaky/non-existent for some of our needs such voip, web cam video, and desktop sharing. So in the short term we could perhaps ship a browser plugin to do these things along with HTML5/JAvascript to do everything else.
For something of this complexity (basically a rich desktop client being ported to the web) what would make more sense: GWT (Google Web Toolkit) or straight Javascript using a JS library such as jQuery ?
EDIT: There are currently 5 developers working on this project.
If you have programmers with Java background, there are plenty of reasons why to use GWT:
powerful statically typed language also #client side
rapid development (!!!)
tools! IDEs, PMD, FindBugs and gazillion other. Also configuring Eclipse with Google plugin is just piece of cake, unlike many other frameworks.
permutations for various browsers are already handled by GWT itself
your JavaScript is optimized - handled by GWT
you STILL CAN use plain JavaScript if you want (however GWT is designed the way you don't have to)
GWT is really scalable. Your Java back-end will stay true Java, so you can use whatever favorite powerful java libraries
client side development is quite robust and Swing-like, not too hard to find a programmer to fit there
And many others. Honeslty, JavaScript is still quite slow (okay not to troll - language doesn't have "speed", but you get me). It doesn't matter if you are using jQuery or GWT. Face it, it isn't going to perform as fast as thick client. So why to sacrifice your comfort :)
Take the google wave product as an example. It was merged from plain old javascript to GWT to support more rapid development, especially considering the many developers concurrently working the project.
In my experience, manually hacking a site of what you're suggesting with jQuery would be an awful lot of work which most likely will suffer from refactoring issues, difficulty to reuse code, and probably end up with alot of code that will be really hard to grasp for any new developers coming into the team.
Don't get me wrong jQuery is really great javascript tool; but when writing complete applications in it, it quickly becomes unmanageable. That's at least my opinion.
From my experience, GWT is great for developing web applications where the intent is to mimic the look and feel of a desktop application. The fact that your team already seems to have plenty of Java/Swing experience would make this migration path easier than directly moving to a pure-JavaScript solution.
Using pure JavaScript to build a desktop-style web application, you'll be finding yourself searching for or using a lot of libraries/toolkits/plugins/widget builders (even with the use of jQuery) just in order to get the basics down. These basics can easily be provided by GWT.

What are the options for developing powerful browser hosted UI in Java?

I am interested to widen my horizons and wish to learn what are the options for developing a powerful browser hosted UI in Java. All I know is .NET based solutions, specifically Silverlight, which I find extremely powerful, although not without some regretful omissions as compared to its elder brother - WPF.
So, to rephrase my question. Are there mature Silverlight alternatives in Java?
Thanks.
P.S.
I am not starting the war of Java vs .NET, so please do not raise the benefits of Java against .NET in general. I am interested in a specific area only, anything else is put aside.
Please, do not bring Adobe AIR, flex, HTML5, etc... The questions is about Java.
The question is about Java, but front-ends for the web are almost never written in pure Java.
GWT - that's where you write pure Java which is then translated to javascript and html automatically
JSF - you reuse rich components to create your pages. Still there's html and javascript. This resembles the ASP.NET model
Vaadin - heard of it, never used it. Seems promising
ZK - Same as above.
jQuery - yes, this has nothing to do with Java, but is very powerful tool for creating rich UI
Flex - easy integration with Java back-ends. (I personally don't like Flex, but it's a viable option)
(I specifically omitted JavaFX, because in my opinion it is not yet mature)
You know, having rich applications in the browser using Java has existed since, say, 1999 : applets, that's what they're for.
They were long far from beautiful. However, with the recent apparition of JavaFX, they can now have a very nice look.
The closest thing to Silverlight in the Java world is JavaFX. I haven't worked with it myself though, and I don't think I've randomly come across any sites using it in the wild... which means your users are less likely to have whatever plugin is required... and you're likely to be cutting out most mobile users too. (I believe there's a mobile flavour of JavaFX, or at least one planned, but you really want to find out whether it exists on iPhone/Android/(whatever your target market is).
Personally I would probably try to stick to HTML 5 and JavaScript, which can still be pretty rich. (That doesn't necessarily mean writing all the UI by hand, of course - projects like GWT and jQuery are your friends.)
Open Laszlo is worth a look they have a nice interactive demo section too.
The OpenLaszlo platform consists of the LZX programming language and the OpenLaszlo Server:
LZX is an XML and JavaScript description language similar in spirit to XUL, MXML, and XAML. LZX enables a declarative, text-based development process that supports rapid prototyping and software development best practices. It is designed to be familiar to traditional web application developers who are familiar with HTML and Javascript.
The OpenLaszlo Server is a Java servlet that compiles LZX applications into executable binaries for targeted run-time environments.
I'm not sure if it fits your demand but have you looked at the Google Web Toolkit? It compiles Java to javascript and some colleges have made nice UI's with it.
I've used GWT before and more recently Vaadin which I would recommend. You can give it a go at a demo sampler here. I am currently using it to create custom portlets for the Liferay CMS/Portal and I am pretty happy with it.

I want to make a "Web 2.0" application without using JavaScript directly

I'm a full time Java developer of around 4 years, professionally. I'm a GWT fanatic. I love Java. Here's the problem: In my free time I often fall victim to the verbosity of my favorite tools for doing "heavy" development. I also often fall into the trap of obsessively engineering my software. I'll end up with the most beautiful unfinished implementation, ever.
So, here's what I normally work with.
GWT - I use this for dynamic UI and web layout. I love the ease of re-use and it has taught me to absolutely hate javascript. I really can't even bring myself to do much HTML/JS anymore.
Hibernate - POJO to Database, easy-peasy. What i really need from this other than the mapping is that it allows me to have an application that works across multiple databases.
Spring - Mostly security. I've written my own custom LDAP bits for a project.
XML - I've used dom4j and other implementations, including xstreamer. I'd like to use JiBX for XML transport. The problem with this is that I need XML messages that conform to a specific standard rather than being autogenerated. Object->XML->Object are also common enough that it can be a performance bottleneck with large messages (250KB+).
I tried Lombok for a little while and liked it but had occasional issues with it and then I blew up a partition and lost all that work. I don't really feel like doing the same thing again (half the fun was in learning how to do it, now that I know... meh). This taught me why other people want to reduce the explicit code and replace it with an implicit system.
I've been looking into Grails but that runs me into the JavaScript problem (you know, that I don't like it) pretty quickly. I could use GWT with Grails on the back end but I get back into the problem of getting deep in the weeds with GWT. It has also occurred to me that there might be a way to have Grails tags in GSP that are made up of GWT widgets. I'm not really sure how I feel about that.
Another problem I have with Grails is that validation logic before form submission is separated from validation constraints after submission. I don't see how they can be unified (yet) to produce "pretty" front-end validation. I went out of my way to start a JSR-303 compliant validation project for GWT to help solve some of this problem for GWT and really liked the results. It isn't finished but I still find it useful.
So, help me find a better way!
TL;DR - I want to have a Database (and Database-Independent) to GUI solution that allows for dynamic web programming all in one language. Failing that, as close to one language as possible.
TL;DR is TL;DR - I hate JavaScript now, help.
EDIT: I know that it is techincally impossible to do "Web 2.0" development without JavaScript. I'm just trying to not be the guy who has to write it. (Getting a tool such as GWT to do it for me from a language I do like, for example.)
Just learn JavaScript.
Resistance is Futile
...and you will be assimilated.
PD: I'm an ex JavaScript enemy. Now it's my favourite language.
You can certainly develop an entire Web 2.0 project without coding Javascript using GWT (we have), but at the end of the day you still have to know HTML/CSS & Javascript.
This might sound like a stupid statement, but it's not once you consider that GWT is not a perfect abstraction, nor is it designed to be. It wasn't written in Java so that you didn't have to ever code in Javascript again, instead they did it because Java has better IDE's, is statically typed and makes maintenance a hell of a lot easier.
So yes, by all means go with GWT (and check out the new OOPHM, because it's AWESOME) but don't forget that you'll always need an understanding of the underlying frameworks of the web, if you want to develop for the web.
Have you heard of Echo?
It doesn't provide the database part of the problem, but it would work well with any database that you can work well with.
Echo is a platform for building
web-based applications that approach
the capabilities of rich clients. The
applications are developed using a
component-oriented and event-driven
API, eliminating the need to deal with
the "page-based" nature of browsers.
To the developer, Echo works just like
a user interface toolkit.
The latest iteration, Echo3, features
the ability to write applications in
either server-side Java or client-side
JavaScript. Server-side applications
run in any Java Servlet Container and
do not require developer knowledge of
HTML, HTTP, or JavaScript.
You might want to take a look at some of the AJAX powered JSF libraries. IceFaces and RichFaces are both solid.
Been there, done that. I was a GWT developer for 3 years... I started using it in v1.1! GWT is fantastic, and works really well for small applications. But the development comes to a crawl once you it a moderate application size, even if you divide your application in sub-modules.
It is also quite ironic that a UI framework has such limited UI creation tools. :)
Personally I bit the bullet and learned javascript. It isn't as bad as I thought. Especially with jQuery. :)
Obviously there is no perfect framework. But just the fact that GWT has been out for 3.5 years now, and it still largerly ignored in the Java world should tell you something. Since you're doing this on your free time, I would recommend learning the most popular framework: Struts. You'll see its limitation, and also why it is so popular. Of course, you'll need jQuery for that 2.0 functionalities. :)
Take a look at JRapid, a rapid development platform for Java developers. It generates very powerful Ajax enabled UI without the need of coding.
Not sure if you would like this , but have you heard about Haxe?
You might not like it but its AIO (all in one) solution (sort of).
I can understand your dislike of JavaScript and it certainly has its problems but I think your fighting nature at this point.
Web 2.0 is strongly based on JavaScript for a good reason as it provides the ability to perform tasks on the client machine without requiring page loads.
I'm sure there are alternatives but if you want the look and feel of Web 2.0, you will end up doing a lot more work with little reward. JavaScript is the accepted and functional tool for the job.
I'd say stick with GWT and just drink more of the Koolaid. It's a completely awesome development model that seems to be lost on those who haven't tried it.
If you want to improve your GWT experience, jump to the bleeding edge (I work off trunk, it's quite stable) and use the other Google originated projects like GIN, gwt-incubator and Guice. Especially watch Ray Ryan's GWT best-practices Google I/O talk: http://www.youtube.com/watch?v=PDuhR18-EdM
As for the "framework" part: forget 'em. Just use normal servlets and let GWT take care of the RPC for you. Servlets are a pain when you have to deal with JSP and you're own AJAX calls, but when they're only implementing asynchronous app logic, it's not that bad at all. Guice Servlet makes it all quite easy. You can still use a JVM hosted language to write your servlets if you want.
GWT has an incredible advantage over other JavaScript frameworks in that the layer of abstraction it provides allows for major future advances without any changes to your code. If the GWT compiler and browser detection scripts can take advantage of new browser features then you benefit from a simple recompile.
The big annoyance I see in your requirements in XML... hopefully that's just for integration with a 3rd party service and your client-server communication can just be GWT-RPC.
I don't use javascript or ajax, in medium-large application they create a lot of problem with compatibility, because moving some part of code inside client, create security breaches and problem with different browser.
I use only HTML(5) and CSS2/CSS3, and I have a lot successes.
I use this 2 ways:
using "puzzle-techinque". Write a lot of small and simple template (or tiles) to create the big page. I use only JSTL and Spring tag, with Rich/Prime/Ice-faces I encountered a lot of problem with rendering, page building and flow controller, so I discarded them.
using my custom library to parse HTML pages. I create template with my custom grammar, put inside the parser and write on output stream. This is the best way.
If you say me your preferred language and context, I can help you to perform JS-free.

Categories

Resources