I have came from another question to this one:
How can one start with Java (JVM) ecosystem? What are beginner, intermediate and advanced knowledge-bases (bags!)? To be honest Java ecosystem was always a bit confusing to me, so it would be very helpful to provide some "reference references" and "defacto tutorials" for learning (curve!) JVM.
Note: I want to use JVM with Scala (or Clojure) but not Java itself.
I am a C# developer (WPF, Windows Forms, ASP.NET, Web Services, ... like that).
The Java Tutorial is a good place to start.
Update: you have enough questions for about a dozen posts here ;-) Honestly, you should do some research yourself (Google is your friend), then ask more specific, targeted questions; that would yield better results. (e.g. I don't think anyone can answer your question regarding Swing or JavaFX without more specific details about what you are trying to achieve.) I try to give a few pointers below, about areas I know to some extent.
for servlets and other web frameworks, here is a bunch of tutorials.
Tomcat and Jetty are both application servers.
there are a lot of different web frameworks, because different people have differing preferences, ideas and style, so many have created their own framework. It can be confusing, but at least there is choice :-)
for persistence, apart from JDBC, ORM frameworks are another strong option. I use Hibernate and I can recommend it; in a bigger project it can make your life much easier. Ultimately it depends on your specific project and constraints; there is no single right choice.
AFAIK Java has no equivalent of LINQ.
See also this post for further recommendations.
Java based web applications need to run inside of a web container such as Jetty or Tomcat.
You build your app and deploy it to the container which hosts the application at runtime.
Pure/plain JDBC should only be used directly by simple applications or integration layers that do not have access to the class model.
Most applications that I have seen have used some kind of Object Relational Mapping framework which models the entities as classes at a higher level than plain old JDBC.
Popular O/R frameworks include:
hibernate
toplink
datanucleus
cayenne
For web based development, you could start with AppFuse, see the quickstart guide.
AppFuse is a templating system that generates the skeleton of an application for you.
Then look deeper into what has been generated, and see what frameworks they are using.
AppFuse lets you choose between different technology stacks, so you could compare.
I haven't seen AppFuse support for Guice or GWT.
Guice is a Dependency Injection framework, others that could be used instead are Spring or picocontainer.
Another investigative approach that you could try would be starting with AndroMDA, which is a model driven architecture framework - you start with a UML model and then generate or forward engineer a working application.
AndroMDA also lets you control the choice of the underlying framework implementations by configuring different cartridges, once again you should dig deeper to see what they are using in the generated application.
If you are looking for a basic introduction, then the Java Tutorials are nice. To do other things like Java Web Development, then your going to need to consult google for the respective technology since they vary so widely.
One book though that I highly recommend taking a look at is Java Concurrency in Practice
Yeah, it is almost impossible for new guys to get started. This is going to drive away a lot of developers, and Java is in danger of not having constant new bloods. The old farts would love that, it's great for career security, and that's why they are making Java more and more complicated.
Related
I have a few questions to understand better Java's usage in context of web applications:-
Is Java EE web development suitable for small start-up (with less human resource) looking to develop an web application ?
What kind of difficulties may arise in Java EE web development, deployment & maintenance ?
What kind of things should be kept in mind/ considerations to be made when moving from PHP background to Java ?
Why Java web applications are not so popular today? ( or in case I perceived it wrongly, please list any major deployments beside linkedIn and ebay)
and Finally, What are some of the most important things to learn before starting web development in Java EE ?
Thank you
Generally the answer to the question of "what technology to use" is "the one which you have most experience with". However, Java EE is huge and clunky, and definitely not good for rapid prototyping, which you will be doing if you're doing a startup.
Personally I would recommend a more modern and dynamic environment. If you're coming from PHP, you should be able to pick up Ruby on Rails or Django (Python) easily. These two choices are in my opinion orders of magnitude better than Java EE. If you want to stick with Java, at least go with the Play framework then.
Is Java EE web development suitable for small start-up (with less human resource) looking to develop an web application ?
Yes, I worked in a startup where I was the only full time programmer.
What kind of difficulties may arise in Java EE web development, deployment & maintenance ?
The same as in any other web development shop. Of course, the problems have their Java flavor. For instance, one bug we discovered was caused by different minor version of JDK used on the live system than on our test system.
What kind of things should be kept in mind/ considerations to be made when moving from PHP background to Java ? Do not code the PHP way. Java's strength is OOP and its many libraries/ open source frameworks. Use that.
Why Java web applications are not so popular today? ( or in case I perceived it wrongly, please list any major deployments beside linkedIn and ebay)
I don't know why you think that, but Java is used everywhere. It is one of the few languages that Google officially uses. They use PHP as well, but it has a "lower" status.
and Finally, What are some of the most important things to learn before starting web development in Java EE ? Use Java's strong points which I mentioned above.
Updated after comment
I cannot make the choice for you. If you are in doubt and in a big hurry you should not go with Java. This is common sense. However, it is an opportunity for your team to learn and grow. Maybe there is a PHP/other client for Cassandra. I knew a former PHP programmer in a startup, who switched to Java. Not saying anything bad about PHP programmers in general, but he did all kinds of strange things, such as not leveraging the power of Java web frameworks and writing lots of procedural code mixed with HTML and SQL. Obviously there are lots of Java programmers who would do the same thing. The point is that your team will probably learn new ways to do things and benefit from it in the future.
Allow me to answer these from the perspectives of a developer/architect in a small start-up, experiencing a bunch of these issues.
What kind of difficulties may arise in Java EE web development, deployment & maintenance ?
How do you decide on which toolset/framework to use? Do you need an IDE? Which version control system and why? Do you want to develop at some place and deploy somewhere else, or develop directly on the server? Do you buy a linux box for this, or rent some cloud? How much do they cost, in terms of licenses and training?
What kind of things should be kept in mind/ considerations to be made when moving from PHP background to Java ?
How would your servlet send out an e-mail? It's much simpler in PHP. Need secure transfer of encrypted objects? Java is your friend. What about session tracking? Use cookies, or have a dedicated class do it? How do you access the database? Want to use hibernate? What other tools is hibernate dependent on? What are their costs (license+learning)? Can you use JDBC directly? What are the pros and cons? Which db to use to why.
Why Java web applications are not so popular today? ( or in case I perceived it wrongly, please list any major deployments beside linkedIn and ebay)
I am not sure if this is the case, but possible reasons could be the availability of .net and integration with C# based systems and Apple ditching Java from its SDK. But that is my speculation, don't quote me on it. I am developing a large scale system myself with Java 6.
and Finally, What are some of the most important things to learn before starting web development in Java EE ?
(This is my opinion) have a test or trial set up of the entire architecture. Is the GUI web-brower based? Is it an applet? Standalone application talking to a server? JNLP system downloading archives and JRE off the net? You will find some stuff do not work on Windows 7, some do not on Vista, W3C have deprecated the applet tag from HTML but Sun/Oracle asks you to use it, different browsers do not support contents of your style sheet, etc.
Firewall set up is another major challenge - you start using thread pooling using Spring libraries and your capabilities to use DBvisualizer to check on DB tables are gone! Now you need a DBA and a sys-admin to fix these who you do not have!
Personally I found the LAMP architecture (Linux-Apache-MySQL-PHP) the fastest way to go for smaller applications, but if you need heavier guns for your app (security, GUI with swing, multithreading, etc), replace the P in LAMP with a tomcat container. The hardest thing I find is to judge the value of a tool in the context of my application - I do not need a tool that generates Java files with getter/setter methods given a list of variables - to me that is yet another level of indirection, but then JUnit in eclipse is helpful for debugging.
Just shared some of my thoughts - hope this helps, - M.S.
For a startup an interesting choice could be the Lift web framework, which is used for developing "Java Web Applications" (although in Scala).
We've got an app that needs to run in a Java app server. I've got to develop a webapp to go with it. I've started reading about Ruby on Rails, and I really like the approach: MVC, convention over configuration, tons of stuff taken care of for you.
I may be dreaming the impossible dream, but are there any Java webapp development frameworks out there that work in a similar way?
Straight JSP is miserable, because logic and presentation are mixed. Simple template systems, like Velocity and Freemarker don't do the database stuff. I don't know much about Spring.
Everybody here knows Java, and we don't have time before the next release cycle to learn an entirely new language and library, else I'd plunge into RoR in a serious way.
Not impossible at all. It's already been done.
Here are a few Java-equivalents:
Grails http://www.grails.org/
SpringRoo. http://www.springsource.org/roo
Spring MVC. http://www.springsource.org/
All are products of SpringSource. If you're getting serious about Java web development, I highly recommend you check them out.
Grails was actually inspired by Rails, hence the name, so you'll see many similarities in features and paradigms between the two, including MVC, convention-over-configuration, and code generation. So if you're looking to get right into Rails-like development in Java, I highly recommend Grails. I should note that Grails has more features than Rails, some of which I think Rails should adopt. An example is Grails provides a service layer to handle all business logic. You could easily implement a service layer in Rails, but its convenience we all love, and because Grails includes it, it is more convenient. I've hopped between Rails and Grails once upon a time, both great frameworks.
Keep in mind that you can do Rails development with Java as well, via JRuby, which is not a bad option either. You get all the features of the Ruby language (v. 1.8), along with the ability to integrate and use Java libraries within your Ruby code.
SpringRoo is SpringSource's new code generator framework, so you can use it with the Spring framework to aid in agile/rapid application development.
Grails is actually built on-top of the Spring framework and Groovy. Groovy is Java-derivative which looks more like a scripting language and provides all the meta/dynamic programming goodness that you see in languages such as Ruby and Python. However, Groovy allows you to write Java code as well, so there's no need to learn it, not entirely at least.
Have a good look at the the Play Framework. I think that it's the best way to develop Java web applications at the moment. Certainly the quickest. There is no deploy cycle. Save the code and refresh the browser.
It comes with Hibernate and a host of enhanced functionality that streamlines the development process. Totally REST based and stateless.
Add in jQuery and it feels like web heaven.
I want to take the next step in java web development, I am hoping to get insight & feedback on: what my next steps should be and how best to take them.
While learning the basics of java web development, I put together a simple web app that performs simple accounting and financial calculations. The web app is on a single jvm, uses Tomcat, and has standard web functionality - i.e. login/logout, basic security, etc.
How can I make this web app more "enterprise ready" - distribute functionality of tiers over different servers/jvms, HA, balance-able, etc.
What do I need to know/learn? - i.e. EJB3 or Spring Framework (seems spring is better option), REST and/or SOAP, etc.
How would one recommend (books, websites, etc.) I learn the "requirements" (see preceding line)?
Thanks!
In my opinion, you should try different approaches for a same problem, so you could compare the pros and cons of different tools and frameworks.
For instance, try to build an application using EJB, and then the same application using Spring. Take the presentation layer of your code written with JSF and then rewrite it using Tapestry.
I think this will be very helpful to you, as you'll be able to make best decisions when choosing tools for your future developments.
A few things to consider, as food for thought:
How good is the error handling/logging of the application? For example, if the user tries to put in X in for a currency value, what does the application do?
What is configurable within the application from the user and what is in configuration files and what is in a database with regards to configuration? Do you have passwords encrypted within the application?
What patterns would used in building this application? Are there patterns you could see using now that you have a prototype?
Is this application ready to handle different currencies and languages?
What happens if someone leaves the screen for a few hours and tries to use a form?
What administrative functionality does the application have?
Does it handle the case where the user has JavaScript disabled?
What are the limitations of your application, IOW what can't it handle the way it is?
Have you considered trying to write a manual for the application?
EJB or Spring? gets asked quite a lot nowadays, here's a decent related question about them.
Have some real users using your application. You'll be amazed on how many "new" features/improvements can be performed in your app ( and the technologies you'll learn to satisfy those requirements ) by having real users using it.
I would suggest the following books/tutorials are a must for every Java developer:
Manning: Spring in Action - 2nd edition
Manning: Java Persistence with Hibernate
Core JavaServer Faces
Adobe Flex ( Adobe website video tutorials )
Effective Java
Apart from the standard technologies above you must be familiar with
Different testing frameworks , JUnit is a must
Build tools like ANT and Maven
Also you can build small projects by downloading trial versions of MyEclipse or Flex Builder.
I suggest that you create small java experiment projects for each new framework/library that you want to learn.
I've had good success using maven to help me quickly and consistently create java projects that I use to experiment with one technology at a time, such as Spring, Hibernate, etc. I use maven's site life cycle to record notes about what I learned and to document how to build and run each project. So, now I have 20 or so projects that I can use as baseline projects, one for each framework, to build upon.
Also, I prefer buying and reading books rather than relying on google and websites to learn new frameworks. Seems that I'm able to learn a lot faster this way.
I also suggest that you write web apps that you, yourself, would want to use. Or write a web app that solves a problem you've been having. I've found that I learn a lot more this way rather than simply copying and pasting from examples in a text book.
Hope that helps,
- Dave
Spring or Tapestry would be good options for new learnings. Does your app use any web services? If not work those in. Work with other application servers like JBoss and Weblogic and note their nuances with java. I'd also recommend learning Maven and work that into your build/deploy process.
Have fun,
Mike
You could vastly reduce the time taken to build your apps by learning some Test-Driven Development.
Try learning JUnit - it's becoming a core skill now, even in unagile shops.
If you're focussing on the web, try out Selenium - which has a Java controller to drive your tests from Java test cases.
After investing a bit of time in TDD will pay off no matter which frameworks or apps you work on. If you learn to test drive your code, you'll end up with smaller, cleaner code and less debugging.
You might look at AppFuse, which is a bundle of Java things together.
Or, you might take a look at a few more technologies to play with and add in:
Version Control - SVN
Tools - Ant or Maven
Framework - Spring, Seam, Struts
ORM - Hibernate or iBatis
Test Driven Development - JUnit, Emma
Continuous Integration - Hudson
I'd also read the Pragmatic Programmer and/or Code Complete.
Allow me to state that "enterprise"-ready does not necessarily imply scale-out solutions, many, many enterprise Java applications are running on larger systems requiring long-running-systems skill of their own.
I recommend mastering the Java language and runtime, understanding how bytecodes and loading traverse the JVM vs. focus on any given framework.
Speaking of frameworks and if you really have the time, try recreating an application framework yourself. Try and re-invent the wheel. IMO it is an excellent lesson in why frameworks themselves exist and teaches one to employ the features instead of always trying to work around them.
One more thing, never forget the database. I don't care what that looks like Oracle, MySQL or NoSQL, but become also an equal master at the data store.
I am a fan of big agile software development methodology and love to develop web pages using Django and RoR. However, it creates a big constrain as there are really very few Django or RoR developers to hire.
For a new web project, we will be hiring developers and even though I would love to see these employees using such tools, sadly it will be either impossible to find related developers or even if we find them(virtually impossible for my country), we will be very dependant on them.
Also time is a big constrain thus considering "finding clever programmers and letting them learn these technologies" is not an option.
Under these conditions, I would like to hear common Java or .Net alternatives and why would you suggest them.
I can think of Spring, Hibernate, Stripes, Struts and Wicket for Java
Also Microsoft ASP.NET MVC looks really promising.
EDIT: I Need to mention that I won't be an active developer for this project but act as a manager.
Regards
If you want Java, Spring, and Hibernate with RoR-like "convention over coding", why not try Grails? It's based on Java, Groovy, Spring, and Hibernate. You'll be able to get a lift similar to RoR for web-based CRUD apps.
ASP.NET MVC is quite promising. It "borrows" a lot of its ideas from the Rails framework and community. I am a ASP.NET (MVC)/C# developer primarily, but had the opportunity of doing some Rails development before I moved from traditional ASP.NET WebForms to ASP.NET MVC. After doing development in Rails, I found it quite easy to make the transition to ASP.NET MVC.
Also, I haven't done any web development in Java, but since there are so many web frameworks to choose from, you may not find enough Java developers to build out and ramp up a team quickly enough, all with experience in the same Java web framework.
web4j might be what you're asking for. However, it is not that popular and your developers will have to learn the framework too. I think it will be faster than learning a new language though.
I believe that building a framework in java or .Net that resembles RoR or DJango is very difficult. This because the languages designs are so different. Also because Java and .Net target the enterprise market, which usually requires more robustness.
Agile development really has nothing to do with what languages or tools you're using. Of course, certain tools and methodologies make it easier (MVC tends to make it easier), but my suggestions would be as such:
Go with ASP.NET MVC. It borrows a lot of the good stuff from Rails, and provides some powerful tools that will make developing ASP very friendly to everyone involved.
Use an agile planning tool. I suggest Skinnyboard, as it allows you to do true agile planning.
Don't fret about the tech! Agile is how you manage the project, not the technologies that the project is using.
You're asking how to develop webapps fast with enterprise frameworks vs RoR.
My initial answer is you can't expect to develop webapps in .NET/(Spring/Hiberbnate) as you would for RoR. Lots more setup, lots more to learn and understand at a deeper level. Lots of configuration.
I don't see php here. I assume a lot more people use php. Why not look at php and symfony. Symfony derives its fundamentals from RoR.
If none of the above fit the bill I'd go for Spring/Hibernate/MySQL/Tomcat. We developed multiple largescale web apps with that stack in an agile Scrum/Sprint scenerio
For Java, VRaptor has a controller+view implementation similar to rails actionpack, and uses a DI Container based on Spring. Also has some nice integration with Hibernate/JPA, XML/JSON serialization using XStream, helpers for Integration Tests and a pretty nice documentation.
Haven't tried it myself, but Play! Framework for Java looks very promising. RESTful architecture, MVC and a neat admin interface (like Django) built in.
A platform based on Seam/Hibernate/JBoss sounds exactly like what you're looking for.
Seam is the web framework, Hibernate is the object relational model, and JBoss is the server container.
After coming up with a database schema, you can even use seam-gen to reverse engineer it and do your "scaffolding."
It's flexible, enterprise level, and free to work with.
Furthermore, Java developers are everywhere.
I have pretty big background of .net, and I've decided that i want to port one of my websites to Java. (now with the asp.net MVC craze, I've figured I'd better learn a more mature approach to MVC).
i've downloaded eclipse (easyeclipse distro to be exact, and am ready and willing to develop my first website in java).
i've programmed j2me application before, so i know the language and some of the framework.
can someone guide me? any advice?
Although I'm not very aware of "asp.net mvc" is all about, I would suggest you to take a look at Spring it may be interesting.
Probably is too complicated at the beginning but when you get the concept it turns out very easy to follow.
Spring has 5 core modules ( which I don't remember exactly ) but they were like:
AOP
ORM
MVC
Core
( some other I'm missing here )
The MVC part uses a lot of annotations to make life easier. There's a very big community around Spring.
Here's an introductory article about spring.
Java has a ton of frameworks you can choose from. The technology stack that I use for my Java development is either:
Spring for IoC.
Hibernate for the data layer.
Struts2 for the MVC framework.
I have also swapped out spring and used Guice for the IoC.
Spring also has MVC, but I tend to like Struts2 better.
I'd recommend looking at Grails, it lets you become comfortable with all the java libraries and frameworks like Spring, SpringMVC, Hibernate, SiteMesh, and so on but gives you a much better DSL for web applications and much more concise code with the Groovy language (think of it as Java with dynamic typing, blocks, closures, and so on).
If you'd rather stick to pure Java I'd recommend looking at the Stripes framework and the following book:
http://pragprog.com/titles/fdstr/stripes
If you interested in web applications specifically, I would recommend using MyEclipse http://www.myeclipseide.com. Basically, this is a version of eclipse with all the web server integration and functionality built in. I've been using it for a few years and it's much easier to develop with than with plain vanilla eclipse. Depending on how much your going to use it, you have to decide whether the $55 annual subscription is worth it for you.
I'm a little confused. does spring framework actually a full blown framework? doesn't Java already have a framework? (by framework i mean all those misc libraries).