Development of a Web Application(CRM) in GWT - java

I am student. Currently, I am experienced with Core Java and very introductory Servlets and JSPs concepts.
For my summer internship, I have a task at hand where I am to develop a social CRM for a small startup.
I am very new to web development, I have no prior experience in this field, I am familiar with the technologies involved though, however I want to start off now and develop a good project in the summers.
I want to base my project on Java, I am considering using GWT for all client side AJAX work along with a J2EE server.
Would this be a right decision on my part? What is the learning curve involved with GWT? Can I really start off with something like a small CRM without doing nothing more than a HelloWorld previously?
Need some suggestions as to how should I kick start my work and progress quickly with concepts and my project as well.

If you want to develop a good project, like you say, then I believe this is a very fine choice. It's certainly not the easiest one (you could probably hack something quickly with PHP etc.), but I'd say that it really pays off.
I would suggest to follow the official tutorial and the remainder of the official documentation (stay away from the "Editors" framework for now though, it's madness at the moment.)
If you already have a solid background in Core Java, and if you get the right picture of how GWT works (eg which code is transformed to JavaScript / when HTTP requests will occur / ...) I think you can absolutely do it. Make sure to get some solid HTML/CSS and a little bit of JavaScript background first.
I must add, that I would personally not go the Roo route (sorry #jgrabowski) - especially not at first (probably not ever, even though Roo is probably a very good tool, if you like such tools.)
Understand the GWT technology,
create a few very simple prototype apps (just for fun),
then learn to apply best architecture practices, and improve your code.
And maybe you'll find, that a different architecture may even work better for your app (Just as an example: In the case of the largest application I'm currently working on, the generally-suggested MVP architecture would simply not work very well, at least not the way it's usually presented. So it's sometimes better to form a good solid understanding first, instead of blindly copying "best practices". Then you can make an informed decision, and develop a good project!)

You can start playing with Spring's Roo and generate GWT skeleton of your application. Then you can analyze it, try to understand it, improve it (and even remove Roo from it afterwards:-).
Roo is able to generate well architected GWT application that is inline with current best practices, so I believe it might be good start for you.

Found an excellent source for exploring GWT in depth.
I would stronly recommend the book "Google App Engine Java and GWT Application Development", as of now the book is quite updated on GWT, GAE and the APIs.
https://www.packtpub.com/google-app-engine-java-and-gwt-application-development/book

In recent months the GWT Activities and Places pattern has matured.
The example covered at http://code.google.com/webtoolkit/doc/trunk/DevGuideMvpActivitiesAndPlaces.html gives a broad introduction to the pattern. The downloadable sample will lead demonstrate how to 'slice' your application into Activities and Places. This pattern will take away some of your 'architecutre' concerns - you can just go with the flow and do it the A & P way.
Note, however the intro page and the demo code are very light on UI. Separate to your architecture planning you'll need to get up to speed on laying out a GWT app - but that's also covered well in the GWT articles. As #Chris-Lercher suggested, create a couple of UI prototypes that you're happy to throw away to get you started.

Related

Is there some risk in make an online dictionary without CMSs, Struts or things like that?

I'm involved in a project at the institute where I study that consists in build an thematic online dictionary. I'm thinking in make it from zero, constructing an MySQL database and using it with servlets and jsps. I'm not professional and that's my first experience with a real project, so I'm afraid that this way may, in the future, cause problems such as difficulties in maintenance, for example. I know that there are many CMSs, but I would to use this experience to put all my theorical abilities in practical. Yes, I've time to waste. What I need to know is: the fact that I don't know things like Struts or Spring precludes that I make a functional system?
Thank you.
If you are willing to learn new technologies and break you head for a few hours in the beginning learning and applying it, then no, not knowing spring or struts does not preclude you from creating a functional system. Maintenance is a whole new ballgame/discussion. Even the best programmers in the world cannot create a zero maintenance system. The only thing you can do is learn the system well enough (and be prepared to make the learning on going) so that you can put in the best guard rails around it and also be able to debug issues. Now, if this system that you are planning on building needs to be a professional grade system, then I would recommend hiring/getting someone who has built web applications in the past and can maintain it. That person can help carry you until you can take over. If this is a smallish project which can live with a few initial issues/downtimes (which you can work on to improve), then I say go for it.
The best way (IMO) to learn is to take a sample application, deploy it and start reading code. See if you can trace the request from the browser (I am assuming your application is a web applications) into the framework, to your controller/models and back to the view. Grab a sample spring mvc application (for e.g. http://static.springsource.org/docs/Spring-MVC-step-by-step/) and see if you can make sense of it.

Deciding among with Java technologies should use - beginner

I am not new to software developing, but in the last years I was almost completely involved with web applications development, most likely to PHP with MySQL/PostgreSQL.
Now I am changing focus. I would like to start programming for desktop applications, with Java. The decision about language was motivated by the following reasons: it is a mature language, has space into the market, it is multiplatform, full of resources, and has some very nice IDEs (I am using netbeans 6.9).
I am not new to OOP concepts (or most of them at least), but Java has a huge gamma of solutions (technologies, frameworks and so on), and I am getting lost with that. Can't decide what is the most appropriate solution to adopt and learn from.
That said, let's get to the point. I will describe the software targets, some things I has adopted so far, and expect someone to give me some trail to follow filling the messy points.
My application is a small business application. Usual stuff about products, sales, cash management. It needs to run into a small office, with some computers (not a fully standalone desktop application). Not every user can do everything. Some would have privileges to access financial stuff, others only sell, others only fulfill products, and so on.
Per above highlevel definition, we know that it will operate like a client-server application. One server will be installed into just one machine, all others will just have the client. I am using HSQL as backend for persistence.
Would like to use Swing to build the UI (to keep theming based on the OS). Possibilities for the client include sending email (not directly, but through some already-set email client [Thunderbird, Outlook]) and printing (to any available printer in the network).
For this I am using Desktop API.
Alright, finally we got were I am loosing the grip: which framework / technology do you recommend to make development quick (pre-built forms based on the available tables), and as modular as possible?
As I said, different users would have different privileges, but instead of just checking and disabling, I would like to keep modules separated. In different packs, or something like that.
EJB? BlueJ? JavaBeans? OSGi? Swing Application Framework? I'm kinda lost with those. Any help will be appreciated.
If you're lost, keep it simple.
For the kind of desktop apps you describe, you'll need Swing and JDBC. If you switch to web, substitute JSPs written using only JSTL and servlets. You'll have to know HTML and CSS to write JSPs. You can embellish those with JavaScript as needed.
You'll go a long way with just those.
The others you mentioned are just noise until you become more comfortable:
EJBs are for enterprise scale apps. You get to leave a lot of complex stuff like threading, object pooling and lifecycle, etc. to an app server and concentrate on expressing your business logic in distributed, transactional components called Enterprise Java Beans. Not necessary to start.
BlueJ is a beginners IDE designed to shield folks from the complexities of Java. I wouldn't recommend it.
OSGi - modular deployments for web apps. Not necessary to start.
Swing App Framework? I'm not familiar with it - I don't write Swing. If you mean Spring, I think it's an excellent framework, but not necessary to start.
This is a bit off-topic, but I think it should be said anyway.
My application is a small business application. Usual stuff about products, sales, cash management. It needs to run into a small office, with some computers (not a fully standalone desktop application). Not every user can do everything. Some would have privileges to access financial stuff, others only sell, others only fulfill products, and so on.
You are attempting something very ambitious here. There are countless existing applications for doing this kind of thing for small business, some of them household names. What makes you think that you can can do better? What makes you think you can compete?
The fact that you are new to Java makes this doubly ambitious.
My advice would be:
If you have dreams of making lots of money out of this, forget it. You are >10 years too late.
If you are doing this for some client, your company or yourself to use, they / you would probably be better off using an off-the-shelf business application.
If you are doing this for "the public good", you labors would be more fruitful if you joined some existing open source business application project.
If you are just doing this "for fun" ... go for it. (This doesn't strike me as a "fun" project though ...)
Starting off with java, swing desktop app is normal... I must say though that the components included in the default, i never liked, i thought they were too ugly. https://substance.dev.java.net/
Is a look and feel lib for java.
So do your app, think it through though and make sure you have some sort of design in mind.
Its easier and often faster if you have an idea of where you're going visually than if you just start coding and hope you reach somewhere you like.
Get paper and pencil out,scribble little notes and drawings of your GUI.
You don't necessarily need frameworks and the lot, if your app will need to store data then look at the JDBC driver to connect to mysql, or have a look at embedded databases such as HSQLDB...

Writing a web application gui. Which technology should I use?

I would like to write a somewhat complex web gui application.
It will be used to edit certain content by displaying panels and allowing the user to drag items to edit the content.
The explanation is somewhat abstract, but the point is that i'm looking for a modern gui writing technology, the more standard it is the better odds of me finding information and samples to using it.
I've been using JavaFaces to write some simple web pages and have taken a look at RichFaces for purposes of writing the app described above.
I would love to hear recommendation of similar technologies (For example - What was used to write this website?)
Thank you!!!
Update: Thanks for the answers so far, Since I was asked for more clarification I'll try to explain the use of the app:
It will be used to edit a complex script. There will be one panel with the actions of the scripts (The phases) and the other panel will show the content of the currently selected action. To each action type there will be a different set of attributes to modify.
You will be able to reorder actions by dragging them to a new location (Kinda like powerpoint slides organizer or flickr photo organizer) and also copy them that way.
The content of the action attribute panel will be able to display various types of content such as html text and buttons and all kinds of stuff.
Hope that helps. Thanks Again!
Update2: After reading this StackOverflow Thread I'm leaning towards RichFaces for it's vast support and standardization.
It seems you need a RIA. The Java worlds offers the following options:
Google Web Toolkit - a powerful RIA technology, which will require you to go through a steep learning curve. Nice component frameworks are SmartGWT, gwt-ext and ExtGWT. In my opinion all of them have some drawbacks, but in your case you might not observe them.
RichFaces - quite powerful as well, and since you have JSF experience, I'd recommend this.
ZK - never used it and I don't like some aspects of it (at least a while ago when I last checked it), but it's still an option.
Echo3 - similar to GWT in the way of development, but very different in the actual result. I'm not sure, however, whether it's still in development
JavaFX - if you are adventurous, and your application won't be used by the open public, try it.
ASP.NET MVC was used to write this site.
To your question: you should use the technology you like. If you've used to Java, you may wish to explore various MVC frameworks for that. Or you can try out new unfamiliar to you (yet) technologies.
Take a look to GWT and SmartGWT. Together are quite a powerful combination to write RIA webapps.
An interesting framework that I would be glad if I had the time to look deeper into is Cappuccino. Look at 280Slides for an example.
Flex is also nice open source option to create Rich Internet Applications. If you would like to stick to the JavaScript then you can use JQuery, YUI etc
There is also one very interesting thing called Vaadin check it http://demo.vaadin.com/sampler/
ICEfaces is one possibility. Demos here.
I used richfaces including drag and drop functionality, realy nice to offer good usability.
If you like the Java Web Technologies take a look at zk. It promises the same things as ICEFaces. I don't know if it can live up to that promises but IceFaces coul certainly not for me.
ZK should enable you to build your web app like a common swing app.
I'd suggest that you do not invest into technologies/frameworks which are based on integration of browser side ajax capabilities with server side frameworks if you'll need advanced functionality in the browser.
What is advanced and what is not is a completely different topic of course, but just to give you a heads up, as you start facing more and more complex UI requirements, you'll discover that the connectivity to back end framework (like JSF) will become more of a problem than a capability. Especially with things like JSF lifecycle, and most of the server side frameworks being based on the idea of an HTTP post (for client-server communication), you'll have issues.
An example: you'll be requested to develop a very specific UI widget that has drag and drop capability. If the Ajax-jsf integration framework of your choice does not contain this widget, your problem is born at this point. You'll start looking for ways of injecting data into existing channels, and it will get messy.
To avoid further speculation, let me just repeat that if you are sure that your chosen technology setup will give you 90%+ of the capabilities you'll need, that is ok. If you end up developing too much custom stuff, then consider an integration between a powerful client side (javascript or flex or silverlight) layer and a simpler server side layer (resteasy etc) Initial development may not be as fast as the other options, but if you'll need flexibility, this will end up being a much cleaner setup. I'd suggest you take a look at DOJO, and ExtGWT .
Cheers
Seref
It looks like XHTML + JavaScript could be enough for the dragging & dropping functionality you describe. This means you can use just about any web framework of your choice. If you need frequent asynchronous server calls (AJAX) then GWT is the most standard Java framework I think, although it has its peculiarities. Personally I like Wicket because it does not use XML configurations, relies heavily on code and has a nice community around it. Wicket also offers good AJAX support btw.

recommendation for choosing a new web development stack

I work in a medium to small team ( 10 people ) developing and supporting several web enterprise applications.
We have a dozen of them built with a house-made framework with asp-classic working against ms-sql server.
We are evaluating the migration to a new development stack.
We'd like it to be open (free) and simple.
I've been looking around the java web frameworks, but all of them seem to be extremely overbloated for our needs (with the possible exception of http://www.playframework.org/, which I couldn't study yet...)
We are thinking about porting our own framework to this new stack, rather than adopting a whole new stack that we are unaware of ...
so far now, we though about the following possibilities
plain java - jsp - jsf
groovy - gsp (no grails at all)
jruby (no rails at all)
we feel really comfortable working with dynamic languages (well, as dynamic as classic asp can be) and with a lean and understandable framework...
I see no small and simple web frameworks for java, like there are for php or ruby...
I really like groovy, but I see no web implementations outside of grails... Besides the language documentation doesn't seem to be quite complete (I might be looking in the wrong place, perhaps)
php could be an option, but I think it would be hard to advocate for it in my current work...
any other option, advice, pros and cons?
thanks a lot
--
edit
some related link Can anyone recommend a simple Java web-app framework?
I'd suggest you take another look at Grails. It does use hibernate and spring under the covers, but for most situations, you don't need to know the details of those frameworks. There's a large community and lots of documentation/blogs/mailing lists for support, as well as a thriving plugin community with over 300 plugins solving pretty much any need.
If you're still put off by grails, you could look into the play framework. I don't have any experience with it, but there has been some traffic recently around it on hacker news and the like. I know it uses groovy for the templating language.
I cannot recommend anything, but strongly recommend that you consider these things:
Rapid development. Basically you want to save a page file, and reload it in the browser. Instantly! It can be done, do not settle for long deployment times.
Plain, readable text files!
Convention coding instead of explicit coding - big XML files will eventually drive one or more developers insane. The less, the better.
Good tool support (just having syntax coloring may be a big help)
Consider the long term support of your choice. You are basically remarrying with your software - will it still be maintained in 10 years? By whom? Will you have alternatives (JSR's are great - look at the amount of servlet engines)?
And WHEN you choose - get the source code for it, and ensure that it builds correctly. It will never be easier than now, and some day you WILL need to fix something inside. On short notice! (You may even consider allocating resources for donating documentation/patches/time to the open source project you are building your business on).
EDIT: A few more things:
You want to be able to verify things at compile time. One of the things that make it possible to build cathedrals in Java is that the static typechecking prevents a lot of nasty runtime errors. "Oh, THAT method? Well, it's not here, sorry. Boom!"
You want good error reporting. Built in! Try throwing a NullPointerException deep, deep down and see what 1) the user and 2) the developer is told about it. Anything that requires going to a log file to get the details WILL cause calls at 3 AM eventually.
Look into scalability from the start. Any non-trivial customer will need to and the world goes to multicores, so you might as well think about it already now. What will you do when all the magic pixie performance dust has been used and it just isn't enough: The application requires more than a single box.
And read this: http://www.pragprog.com/titles/mnee/release-it
You're forgetting about the other major player in this field: the LAMP stack (linux, Apache, MySQL and mod_perl). All components are free, there are many books available on LAMP development and each of these components, and there are vast numbers of libraries and components already available.
Apache: the Definitive Guide
Learning Perl: by SO's brian d foy
Practical mod_perl
If you are afraid of Grails and need Java, try Stripes and read the excellent Stripes book (http://www.stripesbook.com/blog/). You can buy the eBook pdf for $23. The book covers the framework in amazing detail. Stripes is a very strong, lightweight MVC framework that deals with all the common problems of web development (templates, url mapping, form validation, security, internationalization, testing) but it won't automagically create the database layer for you unless you want it to by using Stripernate. You can also use Groovy with it. You can use it standalone or with Spring.
I've had great success in simple web projects using Spring MVC with JSTL JSPs. Spring MVC is a framework that can be kept pretty darn simple (1 additional XML file used for configuration). You can eschew all the fancy options and just specify a set of JSPs that you want to associate with view names, then forward to those views by specifying their names in the controller.
Spring MVC can also easily scale up and be as complex as you need, letting you switch from JSTL to JSTL with Tiles, or Struts, or JSF, or Wicket. It can also handle complex web flows using the Spring Web Flow project. But for most projects I just keep it simple -- build a JSTL JSP, create a controller that provides the objects that JSP needs, and associate them by having the controller return that view. Once you get the project set up and you're familiar with the configuration, it takes maybe a couple minutes to wire a new page into place.
If you like Groovy but don't like Grails you could try Gaelyk, which is a lightweight Groovy framework. However, AFAIK you can only use Gaelyk if you're hosting the app on the Google App Engine
If your apps won't be hosted on GAE, and you really don't want to use Grails, another option is to use Groovlets, Groovy template servlet, GSPs.
However, personally I think it's a big mistake to dismiss Grails. It really is a great framework, and you can go a long way without knowing much about Spring and Hibernate. One of your complaints is a lack of Grails documentation. I think you must have been looking in the wrong place, because in addition to all the books available, there's a very extensive reference document and a lot of other documentation available on the website. Finally, there's a very active mailing list.
My platform of choice is JRuby - Rails (3) because of its very rich and powerful ecosystem, but mainly because:
* very easy to use
* many MANY libraries
* fast support via IRC
* deep documentation
You can also check out Scala + Lift Web Framework ( imho best static typed language, nice framework )

Does it make sense to use a framework for a simple java web app?

I've done lots of java web development using jsps and servlets, and I have found this approach to be straightforward and flexible. Some of the groundwork involved though - such as managing database connections - is rather tedious, and it takes a fair amount of work just to get a new web app off the ground.
I'm therefore considering using a framework for the first time, but my impression of frameworks is that they're mostly used for large J2EE applications and involve a lot of complex configuration. What I'm looking for is something simple that (after the initial learning curve) will enable me to get up and running with a new web app as quickly as possible.
So my question is - does it make sense to use a framework for a simple java web app?
Note that I'm not asking which framework to use (if indeed a framework is recommended), as it has already been asked here.
If you don't use a web framework you'll usually end up writing one - poorly.
It makes a lot of sense. My team has spent the better part of five years with our open source stack and no matter and we have a "seed" project (works like appfuse) that we use to create all new web apps. Even the simple two pagers from the pov of maintaining the app, it looks like every other app, just smaller.
The short is you won't get any return on the investment right now, but you will as the project evolves and you maintain it.
Yes, I would use a web framework for the following reasons:
Increased navigation capabilities and controls. Even though you may not need them, they are there for you to use should you require them at any time
As others have indicated, apps grow over time and you will feel the need for the framework at some point in time in the future. When you need to add additional pages and navigation
Features that allow you to plug into other frameworks such as security and DB access frameworks. Spring is a prime example in the Java world. You never have to use Spring but it plugs in so well with Struts, Spring MVC, Hibernate, Acegi etc. It ends up saving you the hassle of doing all of the plumbing on your own.
Support!!! Good frameworks almost always have a vibrant community to support them and ask and answer questions.
It may seem like too much hassle initially but definitely saves you much time in the future
I'd say it actually matters quite a lot which framework you go for. Something like Spring MVC is fairly unobtrusive in your code and allows you existing stuff to run quite a lot as-is. Other frameworks have much more specific ideas about how you should do things.
Yes it does make sense. Apps can grow and change and might require something a framework can provide easily in the future.
For example at my workplace we have simple jsp / servlet app. It needs to be rewritten just because of what I explained above. If someone would have taken the time to just get the framework setup we would be in better shape today.
Yes it makes sense. However implicit in your question is that the wrong (for you) framework can be more pain than it's worth - and that's true. There is a world of difference between some heavy J2EE framework and something light and cheerful like grails.
What's the alternative? Rolling your own? Embedding all the navigation and logic in the JSPs?
I agree with those who say that a web framework is worth it. There are literally hundreds now (e.g., Struts, JSF, Spring, Wicket, etc.). Pick one that suits you.
There are two kinds of applications:
1) the kind that you throw away and never use again, and therefore should not worry about modularity, maintainability and clarity.
2) the real kind.
It may sometimes seem that your app may never have to grow, scale, or service a larger feature set / user base than you currently are planning for....I assure you, that perception is always wrong.
Frameworks, specifically things like Struts for MVC in Java, Spring for MVC and Dependency Injection, Hibernate for Object-Relational Modeling are all extremely valuable tools that lead to modularity, maintainability and clarity in your code. So, to answer your original question.... Yes, emphatically.
No it doesn't unless:
you don't have any java experience
in your team
you are doing just a prototype that
must be ready in hours
you don't trust your developers
enough to let them write your
application
you don't plan to let your
developers learn and improve
Danger in using frameworks include but not limited to:
you'll get all framework defects on
top on your own
you'll be unable to do realistic estimates until you
know perfectly the framework
your team won't learn how to program a
web server
you'll find your team passing more
and more time on google instead that
solving problems by writing code.
The only thing that is worst that choosing a open source framework is having a separate R&D team in the company who should create the "big complete ultimate company framework".
but my impression of frameworks is that they're mostly used for large J2EE applications and involve a lot of complex configuration
Not necessarily true. The good frameworks are built to scale well so that they will take you from small apps to very large apps. Many of the frameworks today are moving towards zero configuration so you will find them easier and easier to use.
You are right that it does take an initial effort to learn the framework itself but that investment pays for itself in the very first application you build. And meta frameworks like AppFuse makes it even easier to get started since it pre-configures the frameworks for you.
Frameworks make sense for most applications. It may be necessary for you to build your own or adopt some other framework. The most important questions is the granularity of your data structures. What I mean by this is do you need to just enter data or do you need to parse, compile and execute dynamic code?
If you think of a frame works as a gauge and to the left is an all ready existing frame work open source or closed and to the right is all custom framework then super impose your code on top of that frame work where the level of complexity increases to the right. The farther right you go the more of a stuggle you will have with the frame work (IMO).
However, you can also slowly migrate from existing to custom framework.
There is also the question about your business. If you work for a business that does not look at software as it's core compentency such as a bank or hospital then you need to way that into how much of a frame work you want to build.
Bottom line a framework of some type will always be useful.
Using a framework may add some overhead to your web-app development due to the learning curve. However, depending on the framework you choose, you may be able to realize the following benefits:
Scalability
Maintainability
Clear Division of your model (e.g. MVC)
Out-of-the-box components(SessionManagement,authentication,etc )
Third party plugins
Modularity inherited from the framework
Many others.
Besides, the learning curve is a variable factor. Some frameworks may be easier to learn than others depending on your skills.
It definitely makes sense to look into using a framework even if for no other reason than it'll give you a new area of knowledge. If you've got the time to invest in learning a framework then you may well find in time that it's easier and faster to use that for new projects no matter how simple they are.
Also, if I could vote for SamBeran's post then I would. Getting started with a framework will involve several moments of "oh great! I don't need to write all that boilerplate again!".
I'd say use one - like you said, it's rather tedious to get stuff up and running for even a simple java web app. If the framework helps you get the job done faster and provides the services you need, I'd say it makes sense.

Categories