Architecture Report

  1. Introduction
    1.1 Glossary
  2. Technology Overview
  3. Logical Architecture
  4. Physical Architecture
  5. Key Design Decisions
  6. Prototype
  7. Demonstration
  8. References

Documentation Main Page

1. Introduction

This report is based essentially on the architecture of the system, describing the main components, platforms, tools, libraries, programming languages, and so on.

The purpose of this report is not only to describe the choices of the team regarding the mentioned fields, but also to explain why those choices where made.
The project is essentially web based, thought it will also be developed to web mobile and mobile platform. The web application and the mobile platforms were decided very carefully and the team elected Ruby On Rails (RoR) and Android.

In this report it its described the route made by the team, first regarding the choice of the platforms and languages, followed by the logical architecture describing the high-level logical structure of the software system. After this, the high-level physical structure of the software system with UML deployment and component diagrams are described, followed by the key design choices made by the team.
At the end are the user stories chosen for the prototype, a script describing the future presentation of the prototype, and finally the references.

Index

1.1. Glossary

Below is a simple explanation about the terms that appear throughout this report that may rise some doubts.

MVC - Model-View-Controller is an architecture of software that splits the representation of the information that is presented to the user from his interaction. This model consists of applying data and business rules on one side, and the controller which converts the input to comments for the model or view on the other one. A view, in this case, is an output representation of the information, for example a char or a diagram.

REST - REpresentational State Transfer is a style of software architecture for distributed systems such as the World Wide Web. REST has emerged as a predominant Web service design model. Some of the key goals of REST include scalability of component interactions, generality of interfaces, independent deployment of components, intermediary components to reduce latency and enforce security and encapsulate legacy systems.

Index

2. Technology Overview

This chapter describes the technologies chosen to implement the team's idea. The description made regards their appearance on the developers' world, why did we choose them and how they can add value to our project in the end. Additionally, when it is justifiable, the chosen version is referred.

Version 3.2

Ruby on rails, often shortened to Rails, is a web application framework for the Ruby programming language. It provides developers a very intuitive, yet powerful way of implementing complete projects from scratch. Rails is a full-stack framework, meaning that it gives the web developer the ability to gather information from the web server, query the database, and render templates out of the box. As a result, Rails features a routing system that is independent of the web server.
It is also important to refer that, at the moment the web application is optimized for Firefox.

Version 2.3

Android is an operating system developed towards mobility and functionality on smartphones and first presented in 2005. Recent studies show that it is the most used mobile platform and has also been offering developers a very strong growth on number of users, thus keeping its dominant position when compared with other mobile operating systems such as iOS and Windows Phone.

Sales share
Figure 2.1. Worldwide Smartphone sales (%)

Regarding the android segmentation, one of the disadvantages of this operating system is actually the big number of versions that are currently in use around the world. Since this system is thought to be frequently updated with new features and keep old users updated at the same time, many of the features we are using to develop the mobile side of our project are available across almost all API. Although according to Google(c) statistics the version 2.3, Gingerbread, is currently the most common version among users and that's why we chose it to be our target system. We do, although, support any of the newer versions.


Figure 2.2. Android versions segmentation

With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous.
In our project Ajax is used across all the web platform, from user input verifications to useful tips as form auto-complete (for example in the search fields)

JavaScript (sometimes abbreviated JS) is a programming language that is widely used to give sophisticated functionality to web pages. It is also used occasionally in non-web-related applications—for example in PDF documents, site-specific browsers, and desktop widgets. JavaScript uses many names and naming conventions from the programming language Java, but the two languages are otherwise unrelated and have very different semantics.
For example, the project uses JavaScript to validate many inputs from the user, such as his password. JS is also used to trigger tooltips and other functionalities.

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language, i.e., it's visual layout. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.
CSS 3 is divided into several separate documents called "modules". Each module adds new capabilities or extends features defined in CSS 2, over preserving backward compatibility. Work on CSS level 3 started around the time of publication of the original CSS 2 recommendation. The earliest CSS 3 drafts were published in June 1999.
The project uses the front-end framework called Twitter Bootstrap. This framework allows us to implement gorgeous interfaces while simplifying the customization of the platform. On the other hand, bootstrap also includes a framework to create user friendly advises and warnings using JS, in a particular situation, for example, when the user doesn't fill a required field.

Index

3. Logical Architecture

Here is represented the logical architecture of the system using a UML diagram. It represents the high-level logical structure of the software system in a horizontal decomposition.

Index

4. Physical Architecture

This section documents the high-level physical structure of the software system (machines, connections, software components installed, and dependencies between the components) using UML deployment diagrams and component diagrams.

Deployment Diagram

The deployment diagram models the physical deployment of artifacts on nodes. To describe a web site, for example, a deployment diagram shows which hardware components exist (a web server, an application server, and a database server).

Component Diagram

The component diagram describes how components are wired together to form larger components and/or software systems. They are used to illustrate the structure of arbitrarily complex systems.

Index

5. Key Design Decisions

Recurrent mechanisms like authentication and authorization, error handling, transaction processing, security, etc., are significant decisions about the organization of a software system. Therefore, their definition is very important for the system's architecture.

To solve most of these problems we decided to use Ruby on Rails (RoR). As already mentioned, Rails is a web application framework running on the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started, and allows to write less code while accomplishing more than many other languages and frameworks, leading to a tremendous increase in productivity.

Another point for Rails on the key design decisions is it's philosophy:

Another recurring problem that is solved with rails is the system's organization. At the core of Rails is the Model-View-Controller architectural pattern (MVC), being a mean of representing, sharing and reusing knowledge, providing:

REST is another architectural pattern for web applications and Rails uses it: organizing the application around resources and standard HTTP verbs is the fastest way to go.

To solve the authentication, authorization, logging, and security problems, Ruby on Rails provides a very simple HTTP authentication system that works nicely in these situations. For example, using the http_basic_authenticate_with method in the controllers it is possible to block access to the various actions (add, delete, etc.) if the user is not authenticated. RoR also has some clever helper methods, for example against SQL injection, so that this is hardly a problem.

"Ruby on Rails is a breakthrough in lowering the barriers of entry to programming.
Powerful web applications that formerly might have taken weeks or months to develop can be produced in a matter of days."

Tim O'Reilly, Founder of O'Reilly Media

Index

6. Prototype

In order to develop an application prototype that explores and validates the architecture and technologies selected, the following user stories were chosen and implemented:

Link para imagem

Link para imagem

Link para imagem

Link para a imagem

Link para a imagem

Link para a imagem

Index

7. Demonstration

Demonstration Script

Good afternoon, my name is Rui Valente Maia and I'm one of the elements of the Booksharing team. Yes, I said Booksharing (and by the name you got that our project is related with books and sharing) but you are all probably still asking yourselves "What is Booksharing?". My role here today is to explain you what Booksharing is and show you all a live demo of the core of the project working already. So, Booksharing is basically a service that allows you to share your books for a fee. Yes, I'm talking about those books you got on your shelves getting all full of dust and that makes your mothers complain whenever they decide to clean the whole room. With Booksharing you'll be able to rent your books to people who want them for a period of time and those people will pay you to have them for that amount of time. I bet you're all already asking a lot of questions to yourselves and I'll try to answer them all in the next 4 minutes.

Link para imagem

So, let's start! Booksharing already allows you to register. So you just click right there in "Register" and you just have to fill some information in and you'll be fully able to use the service. If you don't register you can actually still see the books in the first page that appears. But if you register or are already registered, you can already login, like my colleague is gonna show you now.

Login
Link para a imagem

Register
Link para imagem

Well, we are logged in and you can see in the top-right corner of the page. We've been redirected to the first Booksharing page and we can see all the books here. If we want, after logging in, we can check-out/edit our personal information. As you can see, there's some extra information for you to fill-in (like the address and the phone number, for instance) in order for you to be able to rent books. You can also edit the other information you just created.

By now we don't have that many books in the database, but let's imagine we had some thousands, or even some tens of thousands. Finding the book that you want to rent in the first page would be a task nobody deserves. If that happened you'd probably prefer to hear your mom's complaints. That's why we got an advanced search, as you can see, where you search for everything that you can imagine (even by a range of price!), so no need to hear your mom complaining anymore, since it's an easy and complete task to search in the system. And because you're so annoyed with you're mom's complaints whenever she cleans the room, let's search for a book that your mom would probably love and well, if she did, it would make your life much easier.

You'll search for "The Lost Art of House Cleaning: A Clean House is a Happy Home" and you'll rent it in order to borrow it to your mom, and probably you'll tell her that you got it from a BookSharing user that had the same complaining problems that your mom did, and that since she read that book her life got much better. So you search for it, you rent it, you pay it and voila, you're life problems will be all solved and maybe your mom will start liking Booksharing too.

Link para imagem

But let's imagine you didn't. Let's imagine you actually went to your mom and said what you just did and she didn't like the idea. Now she's upset with you! Now she'll complain even more! So, you wanna fix it. You wanna rent a book for her to learn to control better her anger and frustrations. And that's when you actually search the real masterpiece and best-seller.

So, this time you'll have less money because you already spent it in the book that was supposed to make your mother calm down and did the opposite thing. And then, that's when you realize that your mother doesn't need a book to learn how to clean (she actually does it really well) but she needs to learn how to control her anger. And that's when you search for it. And you rent it. And you pay it. And you give it to your mom, she cries out and says she's sorry, you both give a huge hug and she starts reading the book. And again, you tell her how Booksharing solved your problems for only a few euros. And you'll have a new cool story to tell.

Link para imagem

Feel free to send your suggestions to our e-mail: and join us in our Facebook page. Feel free to ask me whatever you want to ask in the end of this class. Your suggestions are surely precious to our concept. We're all really excited about Booksharing and we'll make sure in the next presentation we come here with an even better story. See you next time and thank you!

Index

8. References

  1. Ruby on Rails, obtained on October 2012 from http://guides.rubyonrails.org
  2. Ruby on Rails API, obtained on October 2012 from http://api.rubyonrails.org/
  3. RubyMine, obtained on October 2012 from http://www.jetbrains.com/ruby/quickstart/index.html
  4. Rails Authentication with Devise, obtained on October 2012 from http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/
  5. Rails Foreign keys, obtained on October 2012 from https://github.com/dwilkie/foreigner
  6. Bootstrap, obtained on October 2012 from http://twitter.github.com/bootstrap/index.html
  7. CSS and JS, obtained on October 2012 from http://reference.sitepoint.com

Index