A Note On Java Culture And A RESTlet Tutorial ~ Fri, 22 Mar 2013 00:12:28 +0000
My first real experience with web development was based on PHP. I opted to learn it over Perl because it was more popular at the time and its syntax is very similar to C. One of the things I liked most about PHP was the excellent manual on the official website. The tutorial at the start of the manual was all I needed to get started, and the rest was a great reference. It did, however, take a long time to learn what constituted bad practice with the language. But, I digress.
Nowadays I find that I have to work with Java as a web development platform. The major third-party platforms we use at work are almost always written in Java, or at least against the JVM, so it's basically what I am forced to deal with. Before being forced to deal with the Java platform in this manner, I didn't think much of it at all. In fact, I would usually deride it. There are some tools written in Java that I liked, and used, but overall I just wished it would go away. But that attitude has been changing.
Let me backtrack a little. I mentioned that most of our third party software is developed in Java. Well, most of our in-house software is not. No, most of our in-house software is developed in .Net. I thought I wouldn't mind working with .Net, at first. C# is actually a rather nice language, and the .Net framework has a lot of useful libraries. But then I tried to do web development in .Net. I have never seen a bigger mismatch of technologies than .Net and the web. The .Net name is a total misnomer. It was clearly designed for traditional application development with web development tacked on after-the-fact.
So, I was primarily a PHP web developer in a .Net house that has to manage some Java web applications. Clearly, something had to give. Well, as I spent more time with the Java applications, and learned how they are developed, I started to like the platform a little more. It became clear to me that the Java platform is much better suited to web development than the .Net platform. Thus, I have been trying to learn how to properly do web development with the Java platform.
Notice that I said "trying" -- it hasn't been easy. The Java platform comes from a corporate environment. As such, the knowledgable developers of, and community around, the platform are steeped corporate ways and thinking. This means it is very difficult to find good, free, information on the web, but very easy to find a million overpriced books. Not only that, but all of the innovation has happened in the free spaces like PHP, Python, and Ruby (gee, I wonder why?). So you'll find a lot of stuff implemented in Java, because the folks working with Java would like to play with the new toys, but no documentation for the Java implementations. This means there are hundreds of ways to get started in Java web development but no clear path.
Anyway, as I mentioned a few posts ago, I had a new idea in mind for a project at work and came to the conclusion that it would be best done in Java. Mostly because I can't stand .Net more than Java, and because I need to learn how to properly develop web applications in Java for some third party stuff we'll be dealing with at work soon(ish). This project was to be a web API, and I wanted it to be a "RESTful API". So I started researching Java APIs.
I started out trying to use the Spring framework because it is the basis for pretty much every major web application developed in Java nowadays (including the third party stuff I'll have to deal with soon). But that is an exercise in frustration. So I decided to try something else just so that I could actually accomplish something. Thus, I came across the RESTlet API. Again, the API is very poorly documented, but it looked rather clean. So I read the book and found myself really liking the API.
It's worth noting that the RESTlet site, at the time of this writing, has been updated with a much better tutorial than when I started learning the API a month ago. Evidently the site was, and still is, really, undergoing some major updating. So it is possible to get started with the API without using the book, now.
However, I still think the tutorial is lacking. It doesn't really show how to use the API. It imparts some information that you really should know, but it doesn't help the person that just wants to "write a damn application." So after getting basics of the API figured out myself, I decided I would write a tutorial.
Before I link you to my tutorial I should briefly discuss the format of it. I hate it when a tutorial is basically just a link to some source code. But there really isn't a better way of introducing this topic (unless you want to write a book). So my tutorial is mostly source code, but I did it a little differently. The tutorial itself is in the comments of the source code, with an overview of the technology, and how things are put together, in the text only part. Additionally, the source code isn't tucked away in some damn zip file you have to download or just in a web browsable directory. I put it in a Mercurial repository and hosted it on BitBucket. So it is browsable, easily updatable, and you can see the history of the tutorial.
Without further ado the tutorial -- https://bitbucket.org/jsumners/restlet-2.1-demo.
I hope you find it helpful. And if you can think of any way to improve it, feel free to send me your suggestions via a pull request.
Comments
JavaOne India 2013 returns..!! said (2013-04-08 07:17:13 GMT):
Java is a very easy to use language once u get a hold of it.... if anyone is a beginner in java then they should attend some interesting java focused conferences which gives a huge knowledge abt the language nd very interesting, easy tips nd tricks which are very useful... few of the famous java conferences are Javapolis (devox), JavaOne, and recently i received a mail from oracle regarding their JavaOne conference.. They have many interesting sessions lined up fr this year... you can take a look at their sessions related topics here: https://www.regpulse.com/javaone2013/register.php?pcode=737266&src=4003&Act=1 I myself hoping to attend several sessions about Core Java Platform; JavaFX, Java Embedded, and Java Card and many more.
James Sumners said (2013-04-08 12:23:09 GMT):
Surely you understand that is another symptom of the problem and not a solution?