RestExpress API Application Layers

Here’s a quickie video describing the application layers of a RestExpress application when one of the Maven Archetypes is used to create a new RestExpress project.

http://youtu.be/ZFqjvNiB-hY

To summarize: Visibility or “awareness” goes down. Meaning that a layer can call (or know about) the layer immediately below it, but an application layer cannot call the layer above it or a layer deeper than the next immediately lower.  In other words, if there’s database orchestration code in the Service Layer or Controller, that’s poor design.  And conversely, if there’s HTTP header, request or response manipulation in the ServiceLayer or Persistence Layer, that’d be bad.

Layer #1: Controller/HTTP Layer

  • HTTP layer where requests, headers and responses are manipulated and processed.
  • Handles serialization of request body to domain model.
  • And deserialization from domain model to response.
  • Makes call to only the Service Layer (layer #2).

Layer #2: Service Layer

  • Business logic.
  • Calls methods on domain model to orchestrate business logic and domain functionality.
  • Calls Persistence Layer to store and read domain model instances.
  • Returns domain model instances to the Controller/ HTTP Layer.

Layer #3: Persistence Layer

  • Sometimes call DAL (data access layer) or DAO (data accessor object).
  • Called Repository by Eric Evans in his Domain Driven Design (DDD) book.
  • Creates an interface to perform queries and database operations.
  • “Serializes” and “deserializes” domain model instances to/from the database.

Instant REST Services with RESTExpress Q&A

This is a follow-on to my last two posts, Introduction to REST (Revisited) and RESTExpress Overview and Tutorial, with this short video being the Q&A after the presentation.  In it, the video talks about authentication, authorization, and some of the RESTExpress features around sorting, filtering and performance.  It’s a quickie, but it’s always nice to understand what others are asking… and some answers to those questions.

[youtube http://youtu.be/z5u4rZTK8o0]

RESTExpress Overview and Tutorial

In my last post, Intro to REST (Revisited), as well as discussing the six constraints of the REST architectural style, the video discussed the background for the Java Rest Service Framework, RESTExpress and introduces a sample project.  The video below is part two of the presentation, where we dive in and create a real, working service suite using RESTExpress around a blogging system that uses MongoDB for its back-end store.  The reference implementation demo’d during the presentation is available on GitHub and supports linking, pagination, filtering and sorting of collection results returned (for blogs, entries, and comments).

This video goes into a bit of depth on how all that gets accomplished in your service suites with a minimum of coding.

[youtube http://youtu.be/hHDO6soGehc]

 

If you haven’t heard, RESTExpress is a lightweight micro-framework (along with some other micro-frameworks) that support rapid development of highly scalable, high performance REST services supporting JSON and XML payloads.  It is an active open source project that is gaining momentum.  You can get more information at the resources below:

Introduction to REST (Revisited)

I get a lot of questions around RESTful practices and I see a lot of confusion out there in REST API land about what REST really means, is, and how to implement it.  Last November 2012, I talked at the Pearson Technology Summit in Denver, Colorado.  The talk is entitled “Instant REST Services with RESTExpress” but spends some time during the first have to revisit the six REST architectural constraints.  While the lapel mic was giving me troubles and causing some noise on the recording, the content is definitely understandable.  Enjoy.

[youtube http://youtu.be/XcNDRr5zaI0]

 

The Six Constraints of the RESTful Architectural Style are:

  • Uniform Interface
  • Stateless
  • Client-Server
  • Layered System
  • Cacheable
  • Code on Demand