Creating a Web2.0 application with Maven(or other build tools) - javascript

Background:
I've been building web apps and web sites for many years, but each time I tend to start from scratch as each project has different requirements. However, this has me building my workflow from scratch as well. At this point, I'm about ready to settle on something a little more standard.
But what exactly is that standard? Being a JAVA developer by nature, I'm drawn to tools like Maven. And I've seen some work in the community for better Javascript support in Maven (javascript-maven-tools, javascript-maven-plugin, and others). But is this the best way to do it? I tried for a while to find a good WEB2.0 client/ajax-app maven-archetype to no avail.
I'm going to want to use tools in my workflow including JSLint [[http://www.jslint.com]], JSUnit [[http://jsunit.net/]] for testing, Documentation with things such as JSDoc Toolkit [[http://code.google.com/p/jsdoc-toolkit/]]. Compression and Framework inclusion would be nice too.
So, at this point, I'm even stumped at the the basic ways to start my app. What should a directory structure look like? For a pure client/frontend app (so no controllers, etc), do i just have a single webapp directory?
I guess I'm at that point where I'm questioning "my religion" with webapps. And after talking to everyone I know, I figured it was time for me to open it up to a hive-mind far smarter than my own.
Note. This is a question I also wrote
about in general on my site at
[[http://blog.jbjonesjr.com/?p=283]]
, but no one every cares about it
there.
Thanks for the help, I look forward to your thoughts.

I've started a couple of plugins (this and this) on Codehaus that facilitate the use of Maven for building JavaScript applications following Maven's goal oriented approach. I want to do more of this including the provision of a Surefire-compatible unit testing plugin and a minification plugin that leverages assembles. Take a look at what I've done so far and feel free to help out!
I'm also considering providing a JavaScript DSL for Maven using Polyglot Maven. A colleague kindly pointed out that JavaScript programmers will probably want to express their poms using JavaScript, not XML. In addition they probably won't want the learning curve of Maven. A JavaScript DSL could facilitate that.

Related

Embedding other programs in an Electron app

I have recently begun working with JavaScript and have learned of the Electron framework. I am very interested in this framework (and the whole web technologies for desktop use concept). My programming capabilities could be best described as hobbyist. I have written a few small games and apps for my own use, and have a number of shell scripts to help me automate some of my workflow in Linux. My question is, is it possible to use an Electron app that is powered by a language other than JavaScript? For example, I have a bunch of Python scripts (and recently, some Haskell and F# ones too) to help me with my statistics, calculus, and accounting courses in school. I don't mind running a bunch of different scripts to do what I want but lately I've gotten the idea of potentially making some of them available for general distribution. But my scripts are, as I mentioned, written in several different languages, most of them functional languages and none of them in JavaScript. Is it possible to wrap these scripts into something like an Electron app? If not, does JavaScript have any features similar to a functional language? How would one go about creating a JavaScript library or framework to fullfil this need?
I am aware of platforms like SageMath and GNU Octave, but the whole point is to create something of my own.
I would appreciate any thoughts or suggestions. Thank you.
The short answer is there's no direct/easy way to do what you want.
But you have some options.
There's a Electron compiler, but it works only with Javascript based languages like TypeScript and CoffeeScript.
You can, of course, develop a local web application and communicate with your Electron UI using HTTP requests, here is an example using Python.
You can also use sockets for interprocess communication: https://www.npmjs.com/package/electron-ipc-socket
And you also has the option to just start a child process directly from your Electron Application.
Hope it helps and don't make you more confuse :)

If I plan to use Node, is it a mistake to jump right in to a CoffeeScript framework like Zappa?

I haven't used much JavaScript since the early 00s, and I'm starting to see that my current app is well suited for Node.js. But as a ruby developer, coffeescript looks like it will be more my forte. But I'm concerned that if I jump right into a framework like Zappa without having spent any time with bare bones Node.js, that there will be some holes in my understanding. Is this a valid fear?
To a certain extent yes. Zappa is a very new framework in very active development. I wrote an app in it in July and since then the framework has undergone two backwards incompatible updates. In an environment like that it is often helpful to be able to understand what the framework is doing behind the scenes.
Also since coffee script allows you to mix in JavaScript libraries (and Zappa itself does that) their documentation will provide examples in JavaScript - so you have to be able to speak JavaScript fluently.
On the other hand, experience with Node itself is not that essential, since Node provides a rather minimal API, which is for the most part well abstracted by Express.js (also a component of Zappa). Most of what you need to know about Node can be learned in an afternoon.
TL;DR Not knowing coffee and JS perfectly may be a problem, not knowing Node not that much.
If by "Ruby developer" you mean "Rails developer," Zappa may be the shortest leap for you to make. It provides a lot of "magic," the way Rails does. That's good in some ways (it takes less code to execute a conventional web app), and bad in others (it can be hard to figure out where things are happening, e.g. where is a particular HTTP header being set).
So is it possible to be a good Rails developer without knowing Ruby's core HTTP library, or Rack? Sure. And similarly, you can probably be a good Zappa developer without learning much about Node's HTTP library, or Connect/Express. I expect that'll become more true as Zappa matures and its documentation expands.

Frameworks, design patterns, and libraries for building an HTML5/javascript tablet app

I would like to build an HTML5/javascript news reader for tablets. I know HTML, javascript, and CSS pretty well, and I am a proficient programmer in Python and Java. I understand generally how I would go about building this app, but I want to know if there are any frameworks, design patterns, or libraries in general that I should take advantage of to avoid doing everything from scratch.
Thanks so much for your help.
Browser compliance:
Modernizr, DOM library of choice, ES5 shim, etc. Will deal with making sure you it just works across devices and browsers.
Overall structure:
You may want to structure your codebase, either roll out your own micro framework or use existing ones like backbone, agility, spine, knockoutjs
Micro libraries:
Need some specific functionality? Go to microjs and check your not re-inventing the wheel. Or check NPM for whether it already exists.
Server side things:
There's the general unit testing frameworks, source control, server side frameworks, build environments, packagers, minifiers, etc. That you need to take care of.
I'm pretty sure there's a mobile version of jQuery. Not sure what the feature differences are besides some optimizations for touch-based interface, but jQ is pretty well-established and future developers are likely to be familiar with it.

Starting out with rails. Suggestions for SDKs plug-ins etc?

I have 6 years of C# programming experience and I'm looking to broaden my horizons. I'm going to build a simple web app to demonstrate knowledge of Ruby on Rails so I can get my foot in a place that might want a Rails programmer. It's the hot new thing, so I want to be marketable.
Anyway, I have been playing around with solr and tomcat and I want to use solr as a search engine for a products database. This means that I will be using some java (tomcat and solr) and for the web app I will be using MSSQL because I'm using Windows. A friend suggested that I look into jRuby because if I'm going to be working with tomcat, it makes sense to put it all on one webserver. I want to use Eclipse as my editor. I hear that rails programmers typically use prototype as their java selector tool but I really like jQuery (or even mootools). I have also heard that jRails is something that ties jQuery to my ruby application.
Given that I use tomcat in conjunction with jRuby using Eclipse as the IDE, what would you suggest I use for handling javascript/ajax and what are some useful plug-ins, software, or tips you have for me that can help me get started on the right foot with ruby on rails?
I would stick with jQuery for your JS/ajax. My perception is that the RJS/Prototype is falling out of favor to jQuery but that could be just me. Where jRails would fit in is if you want to use RJS to generate JavaScript from Ruby code. My personal preference is to keep all of my JavaScript in application.js and keep it unobtrusive.
Some plugins I like are Authlogic, Nifty Generators, Paperclip, ssl_requirement, subdomain-fu, and QueryTrace.
A couple good resources for starting out are Rails Guides and Railscasts. I think it's a good idea to learn the language itself before learning the framework, but I'm sure it's possible to develop a simple Rails application with minimal Ruby knowledge.
As for your application stack, I would recommend reconsidering deploying a Rails app to Windows. Even developing a Rails app on Windows will likely be painful. If you can, I'd get a VM (or old machine) running with Ubuntu and use MySQL. If you're looking for a full text search on Rails you could use Thinking Sphinx - here's a Railscast if you're interested. I'd also give a gentle nudge into trying a Text Editor instead a full blown IDE - I like TextMate on OS X and gedit on Linux.
I also had a Microsoft background when I decided to learn Rails. There was a lot for me to take in - Not having the framework pretend the web is stateful (asp.net), learning a new language, learning a new framework, getting stronger css/html/javascript skills, new OSes (OS X and Linux for me), learning new databases. Overall I'm very happy I did. I'm a better developer for it.
If you want to be marketable, I'd start with learning the lowest common denominator, the default Rails stack, to get broad appeal. Then maybe consider acquiring some more niche skills to raise your value to a subset of potential clients/employers.
That pretty much means targeting MRI 1.8.6/7, Rails 2.3.4 (consider learning at least HAML and rspec in addition to erb and test/unit) and MySQL in an Apache *nix world.
I wouldn't recommend learning much about deploying to a Windows stack - the target for servers is overwhelmingly Linux or perhaps some other *nix flavour. For development web server purposes, Mongrel works fine on Windows.
Build on Windows by all means - I do, without too much pain - but be aware that the visible part of the Ruby/Rails community (the people who mostly develop the libraries and frameworks and most of those who write about it online) are predominantly OSX or Linux users, so there's often a delay in the trickle-down to Windows users, especially where OS interaction is called for or where there are compiled elements to libraries. Also, I'm reliably informed that Rails startup is much slower on Windows. I don't want to confirm it personally - I might get upset.
MSSQL works fine with Rails, but I'd be cautious about using any platform-specific features for reasons mentioned above: you're unlikely to find a site that will be happy to deploy to a mixed Win-*nix environment. The MSSQL ActiveRecord code may also not be quite as hardened as MySQL or SQLite - the one bug I ever found in any version of any Rails-related code was in there. That said, if you don't use any MS-specific features you'll find porting easy. But then if you don't use any extra stuff, why not skip it completely? There are enough differences (the query "optimizer" in MySQL for one takes some getting used to) that you're probably better off learning the platform you're most likely to be targeting.
As for Eclipse, it's obviously a mature development environment but I'm not sure how good the Rails plugins are (and as a hostage to Lotus Notes I'm allergic to using Eclipse any more than absolutely necessary). If you can't live without an IDE (and I'd recommend that you try - you'll learn more) then there are several SO questions that cover the alternatives.
Using Solr in your project doesn't require that you have a Java stack for running the actual Rails app. There are quite a few Ruby libraries out there that would help you easily interface with the Solr backend. A few to look at:
solr-ruby – This is the official client library included with the Solr distribution. It's lower-level than some of the other alternatives, but gives you some good flexibility in accomplishing what you need to.
rsolr – Another lower-level library that looks like a replacement to solr-ruby. At first glance it appears to be more frequently updated.
sunspot – I have not used this, but it looks like it's currently the most popular Solr => Ruby object mapping library. The acts_as_solr library was once an option, but I think that it has since fallen out of favor.
I agree with the other posters that you would want to target a C Ruby / *NIX environment, but if using Tomcat/JRuby helps you learn this faster, go for it.

ExtJs Vs Ext GWT Vs SmartGWT

I am going to start a new application which mainly consist NavigationPane, Grid, Toolbar. Layout should look like this demo page http://www.gwt-ext.com/demo/
I am quite confused which one to use in terms of writing less code, more performant, etc..
Could someone tell the pros and cons of all these technologies.
All the while I coded in javascript, so that way ExtJs seems to be the easy one for me to code. But I am curios to try GWT Ext, Is it true that it could do a lot just by writing few lines of java code.
For eg: To achieve the layout ( given in above gwt ext demo url), which one should I opt ExtJs or GWT Ext.
I read SmartGWT is relatively slower than GwtEXT. Does it have any advantage over GWT EXT. I am also looking for hibernate based data modules ( as my application is going to have many database calls). Anyone of SmartGWT or GWTExt has support for such modules. I came to know that smartgwt doesn't offer all of smartclient enterprise version functionalities, that we are allowed only a few of smartclient features. Will it be an issue?
Your response is highly appreciated.
The GWT-Ext main page now says
"GWT-Ext is no longer under active development and has been superseded by Smart GWT. Assistance will be provided to existing users of GWT-Ext looking to migrate to Smart GWT."
so why would anyone use it?
To write the least code, use SmartGWT Pro. It provides a wizard that allows you to just pick from a list of Hibernate entities you've created, and instantly you have the ability to perform all CRUD operations on that entity, no code required. Then you can add business logic.
The wizard:
http://www.smartclient.com/smartgwtee/showcase/#tools_hibernate_wizard
The link about is just screenshots, but there are several Hibernate samples in the showcase. See especially the Master-Detail Batch Load and Save sample.
As far as performance, real-world performance of most enterprise apps is dictated by how often the application has to contact the server. In this area SmartGWT has a large lead because of features like Adaptive Filtering (see the Featured area in the SmartGWT showcase).
Almost all reports we receive of SmartGWT being "slow" are due to having Firebug enabled. Disable Firebug and performance is fine, so normal end users will never perceive slowness.
About 6 months ago, we studied whether we would use ExtJS or GWT-Ext for an internal application. We wanted the back-end to be J2EE standard frameworks (struts, spring, hibernate for persistence, etc.). We ended up choosing ExtJS because it seemed to us that GWT was not stable enough (too many changes in the API that is still recent), and Ext-GWT was always lagging behind in development.
application which mainly consist NavigationPane, Grid, Toolbar.
Well, this tells us a lot about your app, doesn't it :)
I think it comes down to how good you are at either Java or JavaScript. They are quite a different languages you know :) But if you are well-versed at both but only used Ext JS, then picking up Ext GWT (or GWT Ext, if you meant that), shouldn't be such a great deal. And if that application you are planning is going to be as simple and small as your description of it, then it's probably a perfect opportunity to try out something new.
I use GWT-Ext and it is quite good especially if you don't mind tweaking things with JSNI to customize the already existing Ext widgets it is incredibly powerful. Unfortunately development is stagnant, so my future projects will probably be either in SmartGWT or Ext-GWT. SmartGWT is written by Sanjiv Jivan (same guy who wrote GWT-Ext) and it has most of the widgets we need. I must say most of the skins are quite dated except the Enterprise skin which looks good, but you can always roll your own skin.

Categories

Resources