Friday, April 13, 2012

Saas Course: Architecture of SaaS Applications (Chapter Two)


SaaS Architectures and patterns

Architectures and different patterns has been introduced in Unit2 at multiple granularity. The bookware uses altitude as an analogy to represent the levels of SaaS Architectures, but I have chosen a different metaphor (mileage) for simplicity. I hope it will be not annoying. The 3-tier architecture is predefined because of the necessity of horizontally scalable system, but the applied pattern, the MVC (Model-View-Controller), for web application is only one possible solution to separate responsibilities, isolate the user interface components from the business logic. It is very ideal for view-centric web applications, but there are also other possibilities such as 

  • Template View pattern for web applications with mostly static content (used by PHP and Django) 
  • Page Controller pattern can be used for a small number of distinct pages by giving each page its own controller (used by Sinatra)
  • Front Controller can handle all incoming request to generate a collection of views (used by j2ee servlets)
Rails is a very scalable framework by considering the presentation- and logic-tier, but not the persistence-tier based on traditional relational databases. The persistence storage is a critical point of a shared-nothing architecture so therefore relational and non-relational databases (NoSQL) are combined for better scalability.


Download the Full-Size Visual Map for Free

Creative Commons License

SaaS Course (Architecture of SaaS Applications) Visual Map by Csaba Thamm is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Based on a work at www.coursera.org/course/saas.

In the 3-tier shared-nothing architecture the components in a tier do not communicate with each other allows adding further computers to each tier independently. The statelessness of HTTP allows the presentation and logic tiers to be shared-nothing, since all requests are independent, any server in the presentation or logic tier can be assigned to any request.


Routes

We can get a list of defined routes if we type 

> rake routes

      movies GET    /movies(.:format)          movies#index
           POST   /movies(.:format)          movies#create
 new_movie GET    /movies/new(.:format)      movies#new
edit_movie GET    /movies/:id/edit(.:format) movies#edit
     movie GET    /movies/:id(.:format)      movies#show
           PUT    /movies/:id(.:format)      movies#update
           DELETE /movies/:id(.:format)      movies#destroy

The :id token represents the primary key (ID) of a model instance and the optional (.:format) token allows a route to request resources in an output format (for example GET /movies.xml requests an XML document).
In a Web app, two interactions are required to create or update a movie, because before we can submit a form, a form must be presented to fill it up. Routes connect URIs to specific controller actions. When an URI matching a defined route is received, the correspondent controller action will be triggered.

RESTful Rails

REST stands for REpresentational State Transfer. REST is an architectural style. Using REST it's not required to use HTTP protocol, but most of the time it will be used, because it is simple and HTTP has four basic operation (GET, PUT, POST, DELETE) to make CRUD operations. By using PUT the server get data for overwriting resources. If you execute PUT more times, your resource will be always replaced. So PUT can be used to update resources.
By using POST more times, the server will create always new resources.
Services and APIs follow this principle are RESTful.

Resource manipulation in Rails:

Operation
SQL
REST
create
insert
POST
read
select
GET
update
update
PUT
delete
delete
DELETE

A RESTful interface simplifies participating in a SOA architecture, because every request is self-contained so interactions between services don't need to establish an ongoing session.

Concrete example with operations on an e-commerce site:

Operation
non-RESTful
RESTful
login to site:
POST /login/csaba
POST /login/csaba
Welcome page:
GET /welcome
GET /user/301/welcome
Add item ID 254 t cart:
POST /add/254
POST /user/301/add/254
View cart:
GET /cart
GET /user/301/cart
Pay:
POST /checkout
POST /user/301/checkout


Template Views

Rails provides a built-in "PHP-like" templating system, it calls erb (Embedded Ruby), but it is highly recommended to use rather HAML (HTML Abstraction Markup Language), a beautiful lightweight markup language to simplify the generation of views. 

Template with ERB:










in HAML:



Sunday, March 25, 2012

Python study notes (String, List, Dictionary)

Compare the properties of String, List and Dictionary

String List Dictionary
'devpage' ['devpage',12] {'CsaByte':30, 'Susan':28}
Sequence of characters List of elements Set of pairs
immutable mutable mutable
s[i] - i.th char in s p[i] - i.th element in p d[k] - value associated with k-key in d
s[i] = 'a' - error,doesn't work p[i] = 7 d[k] = v

Friday, March 9, 2012

Split string using XSLT 1.0

I hadn't got lots of prior experience with XSLT so far, but now I take part in a c++ project, part of a large scientific project, should create a simple report from xml data and display it in a browser. XSLT is a declarative language that describes well-defined rules to transform a source tree into a desired format (xhtml, xml, plain text, etc.) and it works pretty well, till the transformation logic is not too complex. If you want to split a string into parts with a given delimiter, it's not a problem at all with tokenize() in XSLT 2.0 and XPath 2.0, but as far as I know there is no free XSLT processor for c++ supports standard 2.0, so I created an own template for splitting strings into a table: 


My dummy xml looks very simple:

Any delimiter can be used by given at the parameter separator. Numerical data can be formatted with parameter numformat.

Template usage:
After transformation with Xalan XSLT processor, result is shown here:
x y z
1146.00 -626.28 16.16
1759.50 -494.00 55.54
400.35 -97.17 .05
1919.96 148.49 631.89
674.07 564.22 49.21

Visibility Flag 1 Flag 2 Color
visible on off orange
invisible off unknown white
visible on on RGB(128,30,230)

Sunday, March 4, 2012

SaaS Course: Engineering Software is Different from Engineering Hardware (Chapter One)

After I read the first chapter and studied video lectures, I gathered the all relevant information and created a visual map to present holistically the key concepts as I mentioned before in my previous post.





The relationship between the three foundation of the book (SaaS on Cloud Computing, Highly Productive Frameworks, and Agile Development) has been identified and highlighted to improve your understanding and ability to think critically about it.
SaaS Course (Software vs. Hardware Engineering) Visual Map by Csaba Thamm is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Based on a work at www.coursera.org/course/saas.

Sunday, February 12, 2012

I enrolled to Udacity Course "CS101 - Building a Search Engine"

Nowadays there are many good opportunities to take free online-courses to develop your skills and competencies. Educating yourself is very simple if you have interest to certain subjects and if you are self-motivated, as me. If not, than you should maybe start with the "8 mental steps to self-motivation" by Ian McKenzie to learn how to motivate yourself continuously.
There’s is nothing more powerful for self-motivation than the right attitude. You can’t choose or control your circumstance, but can choose your attitude towards your circumstances.
/Ian McKenzie/
I have enrolled to Udacity Course CS101 - Building a Search Engine by Professors David Evans (University of Virginia) and Sebastian Thrun (Stanford University) that will be started at the end of february. This course will run for 7 weeks, so I think I will get enough information about basic fundamentals of search engines, understand how the page ranking works and get a basic knowledge in python. Of course I want to complete the course successfully. It is not so easy getting a successful final grade, if you study after work.
A short syllabus of this course:

Week 1: How to get started: your first program 
Extracting a link 
Week 2: How to repeat 
Finding all the links on a page 
Week 3: How to manage data 
Crawling the web 
Week 4: How to solve problems 
Responding to search queries 
Week 5: How programs run 
Making things fast 
Week 6: How to have infinite power 
Ranking search results 
Week 7: Where to go from here 
Exam testing your knowledge


My goal with this course is NOT to build my own unique search engine and develope a performant individual rankings-algorithm, because it's meaningless, you cannot compete with google, but as a software engineer it worths to expand my knowledge and improve my self-learning discipline.

Saturday, February 4, 2012

I enrolled to "Software as a Service (SaaS)" Course at Berkeley University

If you want to be a better software engineer, it is a good opportunity to take online courses on foreign universities. Some weeks before I've just came across free online courses at Berkeley University and the Software as a Service topic is very trendy in software engineering nowadays so I have signed up. A week later a great textbook for this course was available in amazon.com. I've started reading this book, and made a tag cloud of buzzwords used in course material. This course based on the highly-productive Agile development method for SaaS using Ruby on Rails web application framework.


Before class starts, I want to try preview the first three chapters of the lecture textbook to become familiar with technical terms and base of topic. I plan to use Pomodoro Time Management Techniques combine with Concise Learning Method (CLM) and Visual Mapping Techniques for summarizing large amounts of information that helps to enhance my productivity.

Sunday, January 29, 2012

OOP 2012 Conference in Munich


OOP conference provides a platform for developers, architects, and project leaders to get an excellent overview of the state-of-the-art in modern software engineering. Last week I got a Free Pass Ticket for the second day of OOP2012 Conference from my colleague so it offered a really good opportunity to participate in some lectures on cutting edge techniques. The motto of conference was "Sustainability – Empowering the next generation".  On the way to Munich my train is delayed much because of the snow chaos, but I was just arriving to the introductory presentation by Jutta Eckstein. She presented the main topics as Agile processes, modern Web- and Cloud architectures, new trends and techniques

First keynote by Sebastian Welter about project Watson

Searching in internet is easy, but to get the right and reliable answer for our question is much more harder. Today 80% of information on internet is unstructured and a good portion of it only text information. We can interact with computers via Google, Wikipedia, Voice, GPS, etc. but not with natural languages. Watson is a question-answering supercomputer built by IBM T.J. Watson Research Center in Yorktown. Watson can answer for natural formatted questions by fragmenting interrogative sentences and it search answer candidates in 20 Mio documents, Wiki, IMDB, etc. and make evidence-based estimation and answer-synthesis. In 2011 the supercomputer Watson - powered by 10 refrigerator-sized racks of IBM Power 7 Systems - was the big winner against Ken Jennings on the U.S. syndicated game show Jeopardy!. IBM Watson is a 80 teraflops system with 15 terabytes of RAM, and 2,880 processor cores. The key technology and adoption was presented as well.
IBM Watson is based on the following technology:
  • UIMA (Unstructured Information Management Architecture)
  • DeepQA Project
  • Special search technology
  • Natural Language Parsing

Trade Exhibition

After this very impressive keynote I visited the Trade Exhibition where I got valuable informations and prospects about Agile software development, Requirements Engineering and several interesting topics, current trends and products. I gathered various useful gadgets as scrum standup-ball, poker-cards, agile team calendar and agile beer mats for my agile team collegues. As a book addict I visited all book publisher and I bought two great books: 

Drawbacks of Free Pass Ticket

Unfortunately I had a few negative surprises:
  • Free Pass Ticket doesn't permit access to conference sessions
  • No slide presentation for  attendees with Free Pass Ticket
  • No lunch, only candy bar for Free Pass Ticket participants

Second keynote by Ralph Langner

On the afternoon I could take part in the second keynote by Ralph Langner about computerworm Stuxnet that probably targeted Iranian nuclear facilities. The attacks seem designed to force a change in the centrifuge’s rotor speed to destroy the centrifuge and set back Iran's progress in operating the FEP (Fuel Enrichment Plant). With reverse engineering a decrypted code part was also presented.

I will book an early-bird ticket next year to be able to participate also in lectures, but inspite of the prohibition of conference sessions it was a great experience for me.