Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practice for creating Web Services

To preface I am new to web development. I am looking at creating a core set of RESTful web services around a valuable document library of sorts (initial CRUD abilities). In doing so I am theoretically creating a perfectly re-usable and scalable back-end to be used by unanticipated applications in the future.

My question centers around the best practice for doing this. My initial requirement has me also creating a unique front end. Would I make the front end and back end completely separate projects to enhance the re-usability. It would increase overhead.

Looking at using GWT, Restlet, and the Java EE technology stack if this influences the setup at all.

like image 988
Holograham Avatar asked Mar 28 '10 18:03

Holograham


3 Answers

Most important is design a clean Java API - independent of REST, RMI, or whatever protocol you want to use. From a clean Java API, you can support any access method.

Unless you have a use case for these other access methods, don't build them now. You can build it when you need it.

The easiest interface to add initially is a web based interface where your web app runs in the same JVM as your core API. I'd do this if this works for your use case. Building a separate console application that accesses your core API via a REST (or whatever) protocol is a lot more work..

like image 71
Marcus Leon Avatar answered Sep 27 '22 22:09

Marcus Leon


Martin Fowler wrote a very nice article about the basics of REST short time ago: Richardson Maturity Model. Found it very helpful to understand the principles of REST.

like image 30
Dominik Avatar answered Sep 28 '22 00:09

Dominik


If you want to use REST based backend services, you should use the RestyGWT project which allows you you to use a GWT-RPC programing style to access your JSON based restful services.

The nice thing about using REST based JSON services over traditional GWT-RPC services is that those services can then be used by other clients or even in mashups more easily.

like image 22
Hiram Chirino Avatar answered Sep 27 '22 22:09

Hiram Chirino