I just recently started with object oriented programming, using java. Before I was programming in old visual basic which wasn't object oriented and in old php which wasn't object oriented ..
Now my question : Where can I learn about webservices and object oriented programming through concrete examples? (real life examples not hello world type)
I read all of the articles which I could find on wikipedia, google etc. Does anyone have 1st hand expirience from switching to object-oriented programming , of course I'm more interested in success stories :D
Thank you
You should treat learning about webservices (and what exactly do you mean by this?) and OO as two seperate subjects. Both are orthogonal to each other. Learning object orientation is independent of learning how to deliver services over the internet.
With regards to learning OO this might help.
With regards to web services - you'll need to provide a bit more colour - are you looking to develop web applications? If you are looking to develop a webapp there are a bewildering array of java web frameworks to chose from (wicket, tapestry, spring, struts, grails, aribaweb, the list just goes on and on). If you're just starting out with Java & OO you might overwhelm yourself by diving straight in to a webapp framework. I'd suggest learn some Java & OO first, then play around with the Java Servlets/JSP pages, which should give you the basics, and finally pick a framework like grails or tapestry to learn.
If you don't need a webapp and your just accessing/exposing another service over the web then you have most of what you need for network IO in the core J2SE stack, with the addition of possibly some XML/JSON parsing libraries. Java also has a full blown Web Services API - but it's may well be overkill for your needs. You could implement a simple http webservice by simply using Tomcat and Servlets and reading/writing the request response as xml/json.
The two are entirely different beasts. I would suggest looking at existing frameworks that help you implement web services with Java. For instance you can look at the Spring Framework Web Services project which makes it trivially easy to create web services if you already know Java and Spring. But you can look at their code to see how they did what they did.
You can also consider this article that explains using struts2 framework to develop web services.
Apache CXF comes with a slew of examples of web services for a variety (SOAP, REST, etc) of protocols, transports, etc. The examples include inheritance issues that come up in service design (i.e., OO), not to mention CXF itself as a giant example of a Java system.
Go to Axis2 site, they have published very good example (Stock update ) .
This Axis2 is a SOAP engine.
Related
First am not sure if this question fits here well. However couldn't think of a better place to get help. I've been tasked to list the Pros and Cons of each of these {JAX-RS, Playframework scala, MS Web Api}. I've done some research but couldn't conclude as I've not used all three to great extent. Have used playframework to create simple REST app. Have read the Web Api tutorials but have not implemented anything. Did research on JAX-RS but haven't implemented anything either. Also most of our developers are familiar with C# and introductory Java. I am more inclined towards playframework due to Scala,Akka,no server restart and scalability etc but not clear about the cons. One thing am sure is JAX-RS is standard Java EE and Web Api is standard MS stuff. Below are some of the app requirements:
Purely REST backend.
Proper authentication and authorization.
Online secure payment {Paypal etc}
Single front-end for both mobile and desktop
{angular/backbone/knockout..}
Allow users to subscribe as companies or part of companies.
Be able to connect to different databases without App restart.
Code maintenance and readability. Other members should be able to pickup without hassle.
Scalability
This is a partial answer because I worked only with playframwork 2.0 and JAX-RS.
Playframework is a MVC framework, you can use it to create some REST services but it's not focused on this kind of applications, so at least in version 2.0 it wasn't easy to add complex behavior like interceptors, etc. and you should manage authentication by yourself, I don't know if this has been improved in most recent versions of play framework.
JAX-RS is a specification to create REST services, there are several implementations like
Jersey, RESTeasy, Restlet between others. So JAX-RS implementations are built specifically to provide REST services in java. Most implementations have support to several authentications mechanism like OAuth, etc.
In my experience, JAX-RS is better to provide RESTful web services, and the code generated is in general more maintainable than the code generated in playframework, also playframework has a lot of things that maybe you don't need to use, but it will be loaded in memory when you start the server anyway. Akka it's a cool technology, but you can use it if you want it in any JAX-RS implementation.
If you want to build REST services using Scala, you could try Scalatra http://www.scalatra.org/
If you prefer java, take a look at http://dropwizard.io/, it's an embedded server that has Jersey (An implementation of JAX-RS) and a lot of cool things to provide RESTful web services, like metrics, etc, also it's easy to learn. If your team doesn't have an advanced java knowledge, this is a good option.
Playframework is great if you want an easy to learn MVC, specially for non java programmers but definitively it's not the right tool to build RESTful webservices based applications in my experience.
I don't know "anything" about WebServices in Java and eventually I need to do some REST work in Java and well I want to strart learning it this weekedn d:) So my question is do I need to first learn Java web services before I can learn REST webservices? what are the prerequisites stack of knowledge I need to learn first? and your suggested resources.
Thanks
The Java Web Services stuff only have a small relationship with REST services.
Both are "remote services" for the web, so they share the same kind of problems: object representation, security, error handling, etc.
But you don't need to learn the complexities of WS-* like service definitions (WSDL), SOAP... and a large list of stuff.
The small relationship between REST and WS in Java, comes when you want to "automatically" convert objects to XML or JSON. Because Java REST frameworks based on JAX-RS can do that by using JAXB (Java XML Bindings) an object conversion framework used also in the Java WS framework. But you don't need to use that object conversion stuff either.
Some JAX-RS compatible frameworks -like Apache CXF-, can be used also to do JAX-WS (the Java standard API for WebServices). But note that general services frameworks like CXF, have to deal with other complexities (like support for different transports) that you don't need to learn.
What you need to learn first?
Java Servlets: You don't need to be an expert on servlets, but REST services are mounted over the Java servlets infrastructure and knowledge about it will help.
Dependency injection (DI): When you start doing REST resources that access to databases or other services, you'll want to pass some collaborator objects to do that. Most of the frameworks resolves that problem by using DI. For example most of the JAX-RS frameworks can be used with Spring or Guice.
TIP: I found lots of people that uses Spring or Guice because.. tutorials shows that is the correct way to do it. But they don't know what are trying to resolve, and end with complex unmaintainable stuff. My recommendation is that before using any DI framework, first learn the concepts behind them.
(Optional) A little bit of JavaScript and AJAX. If you plan to use the REST services from a web page, is good to learn how they are going to be used.
Edited: To include a mention to Apache CXF, and use the term JAX-RS instead of Jersey that is a specific implementation.
There's a good summary of the Richardson book here: http://martinfowler.com/articles/richardsonMaturityModel.html,
I'd like to play with Java/Flx and build RIA with Java as backend and Flex as frontend and if it would be necessary mayby some website (i don't know which framework right now, probably Spring + some Jquery)
But at the begining i'd like to know which technologies should i use. Now i'm ASP.NET (MVC2) + WPF and a bit Silverlight programmer and after about 3 months, while i's developing asp.mvc website, i've learnt many interesting things about building modular and extensible applications (MEF and Prism), about architecture (DI, IoC frameworks (ninject, Castle WIndsor, StructMap), EntityFramework as ORM, NHibernate)... I wish i'd know them all before i've started my adventure with .NET, now my website would be quite different :)
So here i'd like to ask You- advanced java/Flex programmers what should i know if i want to start develope really good, enterprise and flexible application...
Right now i've read some informations about Hibernate as ORM, Java Spring as web framework, BlazeDs to connect spring and Flex, and... I have no idea how good programmers cope with IoC Containers in Java/Flex world. Are there any frameworks? Something like mentioned above Ninject, Castle Windsor etc?
Where should i start if i'd like to build extensible applications. Divided on modules which can be developed by separated programmers' groups. Is there something like MEF or Prism for Java? Or mayby there are some other, better ways. I read something about OSGi (used in Eclipse) but i don't know is it a good way to create extensible application?
Thx in advance.
generally speaking I would go with
I will answer your question short, with general issues, not drilling down too much.
I don't want to confuse you at this stage.
Flex
MVC framework (RobotLegs, Cairngorm)
Modularity (Potomac or custom)
building application correctly
Java
Hibernate
remoting with flex (AMF and friends)
I think to get you started, this is great.
Also, just to agree with #flextras, I think if you already know .net, you should stick with it at first, learning flex is hard enough, learning flex and Java together is harder
When working with both, I would also
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.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm looking to start developing for the web using Java - I have some basic Java knowledge, so that's not a problem, but I'm at a loss when it comes to deciphering the various technologies for use in web applications.
What options are available to me? How do they work? Are there any frameworks similar to Django/Ruby on Rails which I could use to simplify things?
Any links which could help with understanding what's available would be much appreciated.
Java frameworks come in two basic flavors. One is called the "Action" Framework, the other the "Component" Framework.
Action frameworks specialize on mapping HTTP requests to Java code (actions), and binding HTTP Requests to Java objects. Servlets is the most basic of the Action Frameworks, and is the basic upon all of the others are built.
Struts is the most popular Action framework, but I can't in good conscience recommend it to anyone. Struts 2 and Stripes are more modern, and very similar to each other. Both are light on the configuration and easy to use out of the box, providing very good binding functionality.
Component Frameworks focus on the UI and tend to promote a more event driven architecture based on high level UI components (buttons, list boxes, etc.). The frameworks tend to hide that actual HTTP request from the coder under several layers. They make developing the more advanced UIs much easier. .NET is a component framework for Windows. On Java, the popular component frameworks are JSF (a standard) and Wicket.
As a rule, if you're creating a "web site". that is something more akin to presenting information (like a blog, or a community site), the Action frameworks work better. These sites tend to be simpler, get bookmarked often, require "pretty URLs" etc. This is generally easier to do with an Action framework.
Component frameworks are much better for things like back office applications with lots of UI elements and complicated workflows. You'll find, particularly with tooling, that these style of apps will go together faster using a component framework. But component frameworks have more complicated request workflow, sometimes relying on hidden state, lots of POST actions, etc. Many have "horrible" URLs, and sometimes create pages that are difficult to bookmark.
Both frameworks can be used for both tasks, just some are more suited to the task than others.
None of these frameworks directly address persistence, but many have extension modules or idioms that work tightly with JPA/EJB3 or Hibernate.
Your basic java web technology is servlets. Servlets let you write Java code that responds to various HTTP events (doGet, doPost, doPut, etc). They're generally used for controllers in the MVC architecture.
Link: http://java.sun.com/products/servlet/
JSP lets you write HTML with embedded Java instead of the other way around (in servlets). JSP has been extended via JSF to incorporate more recent architectural advances. This is in the same line as PHP and ASP. This is the view portion of the MVC architecture.
Link: http://java.sun.com/developer/technicalArticles/GUI/JavaServerFaces/
A lot of more complex applications utilize Enterprise Java Beans (EJB) for session management, clustering, etc. This isn't a web technology, per se, but you see it go hand-in-hand when dealing with more complex webapps. Alternatives include frameworks such as Spring.
EJB: http://docs.jboss.org/ejb3/app-server/tutorial/
Spring: http://www.springframework.org/
Also, you'll want to familiarize yourself with ORM technology (after servlets and JSP/JSF). The leading ORM framework is currently Hibernate. This lets you map SQL tables to java objects and interact with them accordingly. This is more advanced stuff so save it for when you're trying to get your head around EJB/Spring, etc.
Link: http://www.hibernate.org/
edit: I forgot to define ORM. It stands for Object Relational Mapping/Mapper (whatever version of "Map" you feel like using :)
Start with JSP backed by logic in Java classes. Or use servlets.
The advantage of using JSP and Servlets is that you gain knowledge of what all the frameworks do under the hood. And that understanding is crucial to figure out how to do X in that particular framework.
Furthermore, JSP is very easy. You can easily see what you're doing and very easily see it when you mess up the view with business logic.
And quite a lot of frameworks (Struts, Spring MVC) use JSP as their view technology. It's a natural first step in web development using Java.
I don't know if there's anything quite as nice as Django for Java, but Spring has a light-weight web framework built on J2EE
http://www.springframework.org/about
A flexible MVC web application
framework, built on core Spring
functionality. This framework is
highly configurable via strategy
interfaces, and accommodates multiple
view technologies like JSP, Velocity,
Tiles, iText, and POI. Note that a
Spring middle tier can easily be
combined with a web tier based on any
other web MVC framework, like Struts,
WebWork, or Tapestry.
something like grails ?
there is also the projects from spring
You'll need to start with servlets and JSP. There are many web frameworks in Java and all of them are based on these two technologies.
You could try Jboss Seam : http://www.seamframework.org/Documentation/GettingStarted
If you are using Eclipe as your IDE there is good integration via Jboss Tools or you can use the Seam-Gen tool that comes with Seam. This allows you to define a database table (or tables) and with a few easy commands, build an entire runnable web project from it. It's a nice way to get the ball rolling.
Also Java Server Faces
http://en.wikipedia.org/wiki/Java_Server_Faces
This is a very open-ended question. The short answer is "yes" there are frameworks, libraries and standards to do everything from writing things at the HTTP request level up to content management systems in Java.
You can also use other languages (e.g. Python, Ruby, etc) on the JVM for that matter.
For some of the Java-only technologies, investigate JSP/Servlets, Struts, Struts2 (which is the updated version of Webwork), Spring MVC, Tapestry, web4j, Wicket.
There are other frameworks built on the JVM but use languages other than Java such as Grails.
To get started I would download Eclipse (latest version) and Tomcat. Create a new web application in Eclipse. There are guides that can get you started.
Start with learning how JSPs and Servlets work, these are a bit low level and aren't really a framework, but will let you get up and running quickly. From there investigate and choose your framework.
Spring MVC is pretty easy to get set up and going. I'm certain there are others.
If you already know Ruby On Rails, you can use it with JRuby and deploy to a Java server (like Tomcat) with Warbler.
In pure Java, Wicket has a good approach and is getting quite popular.
Before studying those frameworks, why not study first where it all started? Try programming with servlets first, so you could a peek at the core of most of those java web frameworks. It would help you understand J2EE better.
J2EE is the standard. You can use this to build apps with Java Server Pages, Servlets and EJBs.
Struts is also a very popular framework that uses JSPs and Servlets. Its a bit tricky to get setup but it is a very good option for mid size sites.
http://en.wikipedia.org/wiki/Struts
In general Java is more component-based, i.e. you don't have frameworks that do it all for you (you'll probably have to pick a database access framework yourself, for example). For Data Access I'd recommend Hibernate or iBATIS.
For the front-end there are literally hundreds of frameworks around. Investigate JSF, Wicket, Struts 2, Stripes - whichever one you use depends on your specific needs as they all have different strengths.
And for a business layer I'd recommend the Spring Framework, which is very comprehensive and has a great reference guide / tutorial :)
I learned Java in college back when it was in version 1.1.5. I recently started trying to program for the web, but it didn't make sense until I read Head First Servlets and JSP. There are way more things involved in web development with Java than I ever realized, and without this book, I would have quit and just used PHP.