Our upcoming sample project focuses on application frameworks and compilers.
Ruby on Rails (ROR) is an application framework written in Ruby.
ClojureScript is a compiler which emits (generates) JavaScript. The ClojureScript compiler is written in Clojure.
Our project will focus on a couple of customizations.
- We'll define database integrity rules in the database server (versus the application code).
- We'll verify our JavaScript client code, marks nodes, removed from the document, as available for deletion. In other words, we will verify that after we remove an html element from the document, it's underlying object is empty. We will verify the web browser's garbage collector removes the nodes from memory.
As with projects other projects in this series, this project is primarily a learning device. We will build a useful application. However, the main benefit is, to learn technology.
Business Requirements
One of my hobbies is visiting libraries, used book stores, and reading. I want to carry a list of books, authors and categories (E.G. science fiction) with me on my mobile phone. I'd also like to refer to book reviews. Many folks who work in libraries or book stores are great sources for book and author recommendations. Communicating your prior reviews helps folks recommend new books and authors.
Application Architecture
Server will run on a Local Area Network (LAN). That means, access is provided by my LAN. We won't implement application layer authentication and authorization for the initial release.
Our application provides two user interfaces (UI and user experience (UX)).
- Full size web browser. Supports create, report, update, and delete (CRUD).
- Mobile web browser. Supports reports.
Data Model
The applications entities are:
- Author
- Book
- Category
- Review
Entities have the following constraints:
Author
- must have a first and last name.
- has 0 to many books
- first and last name is unique (E.G. we can't have 2 authors named Mark Twain).
- first and last names are limited to 25 characters each.
Book
- must have an author
- must have a title
- author and title is unique (E.G. we can't have 2 books with a tile of Huckleberry Finn, written by Mark Twain).
- title is limited to 50 characters.
- a book may have 0 to many categories.
- a book may have 0 to many reviews
Category
- must have a title
- title is limited to 50 characters.
- title in unique (we can't have 2 categories called Science Fiction).
- a category may be assigned to 0 to many books
Review
- must have a rating (an integer).
- must have a body (a text narrative).
- must have a book id
- the default value for rating is 0
Our application also contains an entity relationship:
Book_Category
- must have a book_id
- must have a category_id
- the combination of book_id and category_id is unique (E.G. we can't have Huckleberry Finn categorized as humor twice).
Data Integrity
- Author
- If we delete an author, we must delete any books, reviews, or book_categories related to that author.
- Book
- If we delete a book, we must delete any related reviews or book_categories.
- Category
- If we delete a category, we must delete any related book_categories.
Ruby on Rails default database.
ROR's default database is SQLite. Our project uses foreign key constraints. Thus, your SQLite installation must be built to support foreign key constraints.
In subsequent articles (see below), I'll detail how to enforce the date integrity rules using ROR and SQLite.
The article "Leveraging Ruby on Rails" details my server implementation using Ruby on Rails Version 4.
The article Leveraging ClojureScript details my mobile client implementation using ClojureScript.
Open for work (contract or hire).
Drop Lorin a note. Click here for address.
Please no recruiters :)