I have worked with Django before and have recently seen the Play framework.
Is this the Java community's answer to Django? Any experiences with it? Any performance comparisons with other Java web frameworks?
Edit:Almost similar to this question, the responses, unfortunately don't say much about the framework.
Play! is a breath of fresh air into Java and bypasses all the Enterprise cruft that has evolved over the years. Even the namespace is just play not com.playframework. It is supposed to be an answer to Rails, Django etc and is MVC based. It is needed for Java to stay relevant in all but deep entrenched enterprise shops.
Play! reduces the overabstraction and painful configuration of old Java. It is a complete stack it does not rely or play to the old Servlet/EJB methodology like Restlet tried to do (making REST easier in Servlets). Play! is a great REST based Java framework that is a valid contender to other platforms MVC frameworks.
It is very RESTful and it is easy to bind a parameter to a java method. They have also made JPA much easier to use through their play namespace.
play.db.jpa.Model
public void messages(int page) {
User connectedUser = User.find("byEmail", connected());
List<Message> messages = Message.find(
"user = ? and read = false order by date desc",
connectedUser
).from(page * 10).fetch(10);
render(connectedUser, messages);
}
Python is used for scripting instead of builds with Maven which might save a few lives.
I haven't been this excited about a Java framework since Red5 or Restlet. A bonus is they have easy ways to get your app up on Google AppEngine as well using the Java version of GAE.
I have been using Play! now for a few months and in fact have come to love the framework. I struggled with Rails and Django a bit, mostly because I am really not a fan of dynamically-typed languages; however, there was never a really good web development framework for Java to compete with these. In terms of productivity, Rails and Django were the leaders for the MVC arms race that was going on. Play! is awesome, it's concise, scalable, powerful, and it has a great community that is growing all the time. If you're still really into using a language like a Python or Ruby, you can use Play! with Scala too. I am really trying to get into Scala right now because I think it has a great future and it's a lot of fun to use. Anyway, I would recommend giving it a try!
The Play! framework is a really good piece of software, and that the JavaEE bloated environment should be inspired from.
I moved from Java -> Django because of the fast cycle "modify file" / "reload browser", and the Play! framework makes me came back to my favorite Java language.
It could also be compared in some terms to what Grails and in general dynamic languages in Java (Groovy is used in Play!) are trying to import: simplicity, speed and reliability.
I am also a Django user. I've just visited the Play framework and skim thorugh its documentation. It has the simplistic design Django has been known of. It even has app engine support built-in. I'm sure many java developers will support it, and it only need some time to see cool plugins from the community.
We recently started using Play for building a webservice for various mobile applications. I come from a Java environment. I can tell you that the learning curve isn't all that steep--literally in an hour I had the webservice running with basic API already. One week later we were on Amazon Web Services. I definitely see a future for Play as it simplifies web development for Java developers.
Couple of things that I noticed however (asset versioning, etc.) still are not built into the framework, but i'm sure they'll be there in time. I would say it is definitely worth a shot using Play.
I come from a very strong java background. So my answer here could be a little biased.
Play finally brings to the java community what django has been for all these years in the python community, but just a way better.
Play is built on the jvm therefore inheritance all the goodies from a solid platform that has been proving over the years to be the most reliable and scalable one that allows to write and run applications at scale.
I want to say that I did try django. Its popularity among the web community made me curios and I wanted to give it a try.
Strangely I did not find it as easy to use as I had expected.
So many configurations. Too may libraries doing the same thing and often not play very well with each other. A way too much magic.
Furthermore, not having type safety makes very hard to manage and maintain
web application at big scale.
Don't get me wrong, I am pretty sure that people managed to do it, but in my experience I still find java/scala best suited for this, especially when you share the code base with a lot of other developers.
IDE support for Java it is unbeatable. If you implement TDD you will find yourself refactoring code and moving things around on the daily basis. And java IDEs give you all this power. With type safety and more.
My take away is that as long as you find yourself writing a simple CRUD application/prototype/toy without even thinking too much of advanced features and big scale then you can probably find some advantages on using python/django. Otherwise the whole java ecosystem wins hands down. And play is the cherry on top.
Related
I'm building a web application that needs high performance. I intended using Java EE but after researching about it, there are many negative comments about Java EE applications.
I'm thinking about the Lift framework, but it seems that Lift only support Scala, and I only know Java. Does Lift actually support Java? (I can't find any project example that uses Lift with java). I downloaded a Lift framework project application and there is a boot file in it, can we create a same boot file but for Java?
I'm pretty sure Lift is Scala only. If you're looking for high performance and Java then you should check out the Play Framework as it also has the benefit of not requiring a Servlet container to be deployed.
The Lift framework is Scala only. I want to note that in my experience the transition from Java to Scala was not that hard and now that I know it, there are many language features that make development easier and faster for me. You can take a look at this guide for transitioning between languages: http://www.scala-lang.org/node/960 to see if it might be something that might be right for you. From experience, I really enjoy using the Lift framework as it offers a lot of performance and functionality. The documentation is a bit lacking, but the community is great and makes up for that if you get stuck.
As for Java EE having negative comments, that is a bit vague. The Java EE spec includes everything from Servlets to JSF and EJB. Parts of the spec you will find in almost any web framework (including Lift) and others are more specialized. JSF for example has a lot of overhead, but tries to simplify a lot of the typical application lifecycle. EJB similarly tries to simplify the persistence layer through object relationship management (ORM).
High performance sites can be accomplished with most frameworks, but a lot of it will come down how you develop it. Also, because the framework supports it does not mean you need to use a particular component. Spring (http://www.springsource.org/) is a framework that many people have used on high performance sites, and is incredibly configurable (Supports EJB and JSF, but you don't need to use it). Also, Wicket (http://wicket.apache.org/) is a Java framework that offers a similar feel to Lift that might be interesting to you.
I worked with Lift only for a year now, and was never really interested if it would run from java (I wanted to learn new effective conceptions anyway).
So, I don't fully know the subject. But what I know for sure is that Liftweb has java methods almost everywhere to support java, too. So, you can build your app if not fully in java, then most part of it.
Prooflinks are like these:
http://main.scala-tools.org/mvnsites/liftweb-2.4-M4/net/liftweb/actor/LiftActorJ.html
Classes that add support for java by adding java-acceptable method names and such. These classes usually have a "J" letter at the end.
Anyway, I'd suggest to try out Scala, too -- it's great. And even if you use java only -- you probably will get used to Scala anyway, because you probably would want to read the source code sometimes.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am a .NET developer (and have been for a while now). I work for an organization that was just recently acquired by a larger company whose primary development language is Java. There are a few .NET developers, but the ratio of .NET to Java has decreased substantially now that the teams have merged.
That being said, I've decided it would be best for me to start Java development. However, most of the books I've seen so far for "learning Java" all take a very basic approach (what is a class, OOP principles, etc etc). I am comfortable with this part of development and don't need a primer (unless there are differences so profound that someone recommends the fundamentals from a Java perspective...).
Anyway, I'm looking for a book recommendation for Java development from a software developer's perspective that discusses today's techniques. For example, MVC architecture, application best practices (I am a web developer, this includes web services), is it worthwhile to work with JSPs or consider Ruby instead, etc etc.
A HUGE bonus would be "learning through doing". Something like Murachs, where I can step through a project from start to finish, and is light enough on fundamentals that I don't get bored. I'm hoping to walk away with enough basic knowledge to volunteer for some internal projects and grow from there.
I'm sorry if my question is needlessly broad, but I'm struggling to find a starting point aside from my Eclipse installation (I am doing this on Ubuntu, deliberately avoiding Windows).
Thanks for any direction or insight you can offer.
EDIT - After discussing with a co-worker, and reading Bert's great suggestion (all of them have been excellent, thank you all very much), it turns out the main focus is on EE, and Glassfish. They use NetBeans for development, since it is tightly bound to Glassfish.
This doesn't mean much to me, except that I think the parallel drawn is IIS/Web apps to Win32 apps. But perhaps it will help clarify some of the more open-ended questions in my OP.
Effective Java By Josh Bloch
It may not be "learning by doing" but it gets into the details of how to use the Java language effectively.
I would then complement it with Java Puzzlers by Josh Bloch and Neal Gafter
My best bet is to learn Spring based on your requirements:
MVC architecture, application best
practices (I am a web developer, this
includes web services), is it
worthwhile to work with JSPs or
consider Ruby instead, etc etc.
You can start by visiting SpringSource at http://www.springsource.org/
There are a few points I would like to make to you:
The basic Java language is rather small and C-ish. To my understanding C# and Java works almost identically here.
The Java runtime library is VERY, VERY BIG, and rather unlike C#. Very few people know all of the Java 6 runtime library well.
There are several IDE's in common use for Java. You will want to learn the one used by the rest of the team.
I would suggest having a brisk walk through the Oracle Java Tutorial, just to get the hang of the spirit and do some of the exercises, and then look at the common "Java for C# programmer" cheat sheets on the internet. Then do a lot of code, and then read Effective Java.
(For those who think they know Java 6 runtime well, please consider if you are familiar with RMI, the Rhino Javascript engine, and XPath in the XSLT implementation and all the rest)
Please look at the following thread:
https://stackoverflow.com/questions/75102/best-java-book-you-have-read-so-far
Ruby makes no sense unless you're writing JRuby on the JVM.
If you're writing web apps, you'll need to know JSPs written using JSTL (JSP standard tag library), servlets, HTML, CSS, and JavaScript. Download Tomcat from Apache - it's a servlet/JSP engine that will let you deploy web apps locally for learning. It has an HTTP listener built in, so you don't need IIS or Apache.
You'll need to know how to create and deploy a web archive (WAR) file. That's a ZIP file that contains the standard format for a web application.
I'd have a look at the Tomcat "first web app" docs to get a feel for it.
Once you have that, come back and talk about frameworks. (When you do, I'll recommend Spring.)
Here are some references I like. I'm sure there are better, but there are the ones I have read and can vouch for:
Java in a Nutshell is a classic summary of the core language. If you need more, there are books like Java for Programmers for programmers transitioning to Java (I have not read it).
Sun's Core Servlets and JavaServer Pages was a good book for Java servlets and JSPs. But consider that a lot of web tech is built on top of this (e.g. Spring), so this may be giving you foundation but not direct knowledge of the specific framework you will be using. Also a lot of web tech these days are client-side/JavaScript/AJAX-based, e.g. jQuery.
As for MVC, consider focusing on MVP instead. I been playing around with Google Web Toolkit to leverage my Java background to create client-side apps, but it is also a good way to get some idea of MVP - read Large scale application development and MVP Part I and Part II, and the GWT MVP Development with Activities and Places. However, GWT keeps evolving.
My last suggestion is that you narrow your focus - try to figure out what frameworks are popular at work and decide if you want to focus on a tier: front (e.g. HTML/CSS/jQuery), middle (e.g. Spring), or back-end (e.g. Hibernate). Once you figure this out, then post a more specific question(s) (e.g. what are the best resources for learning XYZ).
Just from my experiences with java (limited but I took a Web Dev course teaching JSP's) Any decent technology for it is usually 3rd party. However, from what I can tell when doing web dev I would use Netbeans, Netbeans has Tomcat built in especially in Ubuntu for easy debugging.
More on similar lines you can find answers from this post
https://stackoverflow.com/questions/3820437/life-after-head-first-java/3820449#3820449
The Java landscape is quite wide as you probably have already figured out.
There are hundreds of frameworks and tools that can be used for basically doing the same thing. To get an idea, you can take a look at this presentation written by Matt Raible, where he compares a number of Java web frameworks.
As someone else suggested, you should definitively take a look at the Spring Framework. It is widely used in the enterprise world. There are several good books about Spring.
If you want to get the basics of Spring MVC in a "tutorialized" style, you can take a look at this book. It doesn't cover the latest Spring version (3.0) and it is not a "perfect" book, but it should allow you to get the basics while running some examples.
Also, there are literally thousand of Spring-MVC tutorials on the web.
For instance, you can take a look at:
http://www.adobocode.com/spring/a-spring-web-mvc-tutorial
RESTful services are also quite popular these days. I have been working with the Resteasy framework from JBoss and I found it very easy to setup and work with. This book explains the REST architecture and uses Resteasy as framework for the examples.
I also recommended "Head First Design Patterns" from O'Reilly. It covers the most important patterns using Java and it will help you to see how the language can be used for patterns you may be already familiar with.
One more suggestion: you may considering "tuning in" on Java TV. It's a great resource with hundreds of Java tutorial videos. It covers a wide spectrum of technologies so you should be able to find something for you.
Sorry for asking this question, but I searched all Java-related questions, but I got more confused. I am still not clear what should I start with.
My main thing is building websites in Java, because someone told me that there are some machine learning or AI libraries available in Java which I can use in Java. So I decided to use that as it can reduce my work.
Now I don't know Java at all. Some people say the following are used to build websites, like:
Servlets alone can build a website
JSP alone can also build a website
Struts
Spring Framework with Hibernate
Seam
Java EE also for websites
I am confused. Where should I start from? Where does core Java fits in here?
I was thinking of perhaps learning Python as I know I have to learn Python only, not its variations.
So please guide me to one thing which can solve my basic purpose of using ready-made libraries of AI.
If I can do that with JSP then I will start with that.
But if I need to learn all of them, then it’s better if can start learning Python.
I have five months to finish the website.
I really don't know why there are many branches of Java for doing one thing.
To correct some misconceptions of yours:
servlets and JSP are Java EE
Seam and Struts can be used together with Hibernate as well
Spring MVC is a web framework. Spring as a dependency injection framework can be used together with any other framework.
there are many more options, like JSF, Tapestry, Click, Play, etc.
It depends on what will the site will be doing, but you can choose any.
Experience has shown that building complex HTML forms (especially validation) and Ajax functionality is hard to get right. You will most likely appreciate having a library to assist you with that. The same thing with database access.
Everything builds on servlets. Learn those in order to understand the libraries you will use.
I would suggest learning JavaServer Faces (JSF) with facelets. The easiest, while being powerful, is JSF 2 in Java EE 6. The easiest way to get started is to use NetBeans with GlassFish 3.
For static web pages, HTML alone is enough and if you want to make it more user-friendly and interactive, use JavaScript.
There are lot of frameworks you can use directly in JavaScript, like jQuery. Now if you want to make some more functionalities, like database interaction, then you will need either PHP, Java (JSP and Servlets) or .NET (there exist some more, but I’m aware of three only). Each of them have their library to interact with database.
Since you are interested in Java, go through Servlets, HTML, JavaScript, and JSP. Once this is done, you can look into JSF and EJB beans. So if you have knowledge of Java this will not take too much time, because the syntax is the same; the only difference is the concept.
So you will have a frontend (HTML, JS, and JSP) which will interact with the backend (Servlets and the database) which will be deployed in a Web container. To deploy, you can use an one of the available application servers, like Apache Tomcat, GlassFish, or WebSphere. To develop your application, you can use Eclipse as the IDE, which is one of the best IDEs I have used.
So decide your architecture and design, break it into components and start writing small applications first. Once you are experienced in small application, start writing an application where there are more things you have to care of, like load on database, availability, security, etc. For that, you can refer a very famous question on Stack Overflow, What technical details should a programmer of a web application consider before making the site public?.
The closest to core Java is servlets. No extra syntax, very minimal library, but no included functionality.
For building websites, the main thing is HTML and HTTP.
All technologies (including Enterprise Java or Server side Java) do the same—to understand an HTTP request and respond back with HTML. All that you mentioned do the same thing with a different level of sophistication.
Start with Wikipedia.org to know what technologies do what. If you are completely new to Java, go through the Sun tutorials, do sample programs, and get comfortable with Java packages, JVM and classes. (This might take a week or two).
To build websites using Java, you'll have to learn Java Servlets—everything else (JSP, Struts, JSF, and Spring(!)) are built on it. Get Head First books on Java and Servlets; they will be useful.
You can always build the page in Ruby or something that will give you a website very fast. For the AI stuff that analyzes the bought items for the recommendations, use something unrelated to the page that only takes the database to work with.
I would not mix the whole web page stuff with the AI computing. You can do the AI things that will take a long time and maybe should done on a different machine to have your webpage also responsive with C++ or Java in normal applications.
Choosing your front end technique because of later usage is a very dangerous thing. Using the whole Java EE concept and learning it from scratch will take you much longer than have a quick start with your page if you do it in Ruby or PHP.
You can then build the first version of the page and generate a user base. Start working on the AI stuff once you got some data with other technologies.
If your page has performance problems because your technology does not scale, you can always begin switching parts of the stuff out with a faster technology or maybe simply a bigger machine. Get your page running before you build it bulletproof for the thousand users you are expecting.
If you’re trying to build a website from scratch, with no prior knowledge, your best bet is to go with frameworks that provide a complete stack for web development.
If you aren't dead set on Java, you could probably start learning Ruby on Rails, which would be easier to start with (if so, go buy a Ruby on Rails tutorial which goes through all the necessary things for modern web development, from MVC to version control).
For Java, try:
Play Framework is very similar to Ruby on Rails. It will get you started very quickly, and hopefully (if you follow conventions) handle all of your peripheral needs.
Spring Roo is a very-fast-to-work-with framework, but it might get hard to maintain and extend later on.
These two are full web frameworks, that is, they handle database, MVC (presentation layer), configuration setting, etc... (I'll explain shortly). And could even ease your deployment process.
If you're going to go through any other route (using several frameworks together), you are probably not going to finish what you are doing in five months.
To understand why, and to clear some things you wrote in your question, you need to understand that modern web development (and enterprise development as a whole) is comprised of several different technologies:
Presentation: the term web frameworks has been more or less taken to mean frameworks that deal with this side of web development, i.e., how to create a web page (an HTML page). Most of the frameworks offer an MVC like approach (which you can read about elsewhere), and this is what most of the frameworks/technologies you gave sit in—JSP and Struts (which uses JSP) are examples of web frameworks. Servlets is a lower-level API that standardizes how to answer HTTP requests (which JSP and Struts sit on top of).
Persistence: being able to show a webpage doesn't mean squat these days if you can't save data to a database, and that is what the persistence frameworks do (they ease the way you can save data to the database). Hibernate is a persistence framework.
For Java there are also dependency injection (DI), which is what Spring DI is. It's tough to explain DI to people not familiar with the troubles of Java, so I won't try to explain it, but it's a very important part of modern Java development.
apart from these core technologies, there are also many items that you'll need to learn to actually deploy the application (unless your using services like Heroku or Google App Engine, which should simplify things), and troubleshoot it later (understanding how concurrency and HTTP works).
To address the other technologies you brought up:
I've never really touched Seam, so I'm not sure, but it looks like a collection of other frameworks (mainly EJB 3, which itself is a collection of APIs, and JSF).
Spring denotes a popular open source group (the SpringSource group) that provides various technologies, but most likely when you hear about it they refer to two things Spring's dependency injection (DI) and Spring's MVC (which is a web framework).
Java EE is merely a collection of high level APIs which other technologies implement (Hibernate implements JPA which is part of Java EE for instance).
I am wondering if anyone can shed some lights on the situation. I am about to start a project and trying to figure out what solution is best to go with asp.net or java jsp pages
I have personally worked alot with .net and am really happy with the framework and Visual studio as IDE I find it easy to work with and there is a massive community support behind .net, i can get alot done quickly
I have not every written anything use java jsp, there will be a learning curve here , so my experience is limited here. however after seeing jira i am very impressed with its capabilities, it has changed alot since the old days ( java 1.2 ) that i used to work with, and the fact that it runs under linux is a huge plus, so i am trying to decide is the learning curve, worth the price ?
so given the situation above what would you recommended?
Thanks,
Amir
JIRA is issue and bug tracking software; it can function with any development environment, so it has no bearing on your choice of development platform.
If this is an important project or has time or budget constraints, use the platform you are familiar with that works for you.
If you have the time and inclination to learn a new platform, there is certainly merit in that. More importantly though, who will maintain this when you are not around? Will it be deployed to an environment that is already .NET-centric?
Few apps are deployed in a vacuum (unless you work for NASA), so consider all of the peopleware issues as well as the technical ones.
If .Net is what you're used to and the only real advantage you care about in JSP is that it runs on Linux why not take a look at Mono?
http://www.mono-project.com/ASP.NET
Ya jira is in jsp and is a magnificent tool. But its not like you could not have developed something similar in ASP.NET.
Personally, i always go with a technology that i am confortable in. In a professional environment we have to deal with several other factors like time, teams knowledge in various technologies, deployment and maintainence.
you should concentrate on your core tech and do it in ASP.NET as you havent done anything in java before.
I have spent most of my web-development career in the Microsoft camp, but for different reasons I am trying to look at options.
Some years back I did a bit of Java/Struts development in eclipse, which was nice for its time but my memories of it are not close to what Visual Studio delivers today.
Some of the strengths of the MS stack as I see it are:
Ease of use. Free tools (express
editions), easy to set up, easy to deploy, loads of components and
support, even for cutting edge
features like ajax and jQuery.
Intellisense, so that the API
reference is there as you need it.
Size of the community. Things like www.asp.net,
with the free video tutorials,
samples, documentation etc. Free,
official and reliably updated
information from MSDN.
Enterprise scalable and decent
performance.
Fully object-oriented, (semi)compiled
languages, allowing for sound design,
patterns and practices.
There are of course weaknesses as well, like:
Pricing, once you go live with
anything semi-serious.
Vendor lock-in.
Total lack of cross-platform support.
I have spent some time this evening trying to get a grip on how things are outside of the microsoft world, and
I have found loads of PHP frameworks, Ruby on Rails and relatives, several Java frameworks and a few very odd alternatives.
Some of these seem very interesting, so I would like to hear from actual developers using the different frameworks, and try to find out how they compare to what MS has at the moment.
Which framework are you using, why is it great, what could be better and what kind of sites have you built using it?
Jeff & co made most of Stack Overflow in a few months using ASP.NET MVC. If you had to do the same using a non-MS framework and tools, what would you pick and why?
We have a pretty heavy investment in the Microsoft framework at the office and so I'm mostly doing ASP.NET MVC stuff now. If I were to pick an alternative at this point, I'd probably go with RubyOnRails. It has a very clean MVC implementation -- playing around with it made it pretty easy to get started with ASP.NET MVC when it came along. There's also a lot going on with improving testability -- particularly natural language-like testing frameworks coming out of the RoR camp with Cucumber, et. al. All the investment in testing makes TDD/BDD much more natural in that framework.
If I wanted to go opensource I would go with:
RAD web development: tomcat running Railo, a Java based open source CFML implementation because CFML is a good RAD tool. Railo performs well, is capable of clustering, is able to be extended through editing the source or adding your own extensions.
DB: MySQL for a DB backend because it performs well and just works.
IDE: - Eclipse + CFEclipse because that is what's available, although I want some improvements. Since CFML is a dynamic language you don't have Intellisense, just context help for the api.
OS: Any opensource unix based OS. Probably Ubuntu.
MVC Frameworks: Mach-II or Model-Glue because I'm familiar with them, although I'm open to checking out ColdBox.
I build web apps with:
PHP
Zend Framework
ExtJS toolkit
Aptana IDE
Disadvantages are the typical ones: lack of integration between the tools, weakness of debugging tools, complexity of deployment (although the deployment issue is true for pretty much anything except ASP when you're talking about windows servers).
I'm not too aware of ASP.NET, having only marginal experience with it, but the advantages as I would see them are cross-platform support, cheap hosting ability, architectural control (PHP is more low level, and Zend Framework is easy to buy into one module at a time, so you can more strictly control the behavior of each page).
I am using Django. It is easy to learn, very well documented and most of the brainy stuff happens in Python (assuming you like python). I develop all my HTML and CSS by hand using Aptana - gives better control but has nice helpful features.
Using many IDEs / editors you can get auto-complete based on the Django code-base (Netbeans, PyScripter, Komodo). You can then host on either Windows or Unix (Linux, Solaris, Mac).