Difference between revisions of "Tutorial exercises"

From mi-linux
Jump to navigationJump to search
Line 132: Line 132:
 
==Tutorial week 10 - Web 2.0==
 
==Tutorial week 10 - Web 2.0==
 
* “Web 2.0 is more of a social or business evolution than a technical one.” Discuss this assertion with respect to the common technologies that Web 2.0 applications employ.
 
* “Web 2.0 is more of a social or business evolution than a technical one.” Discuss this assertion with respect to the common technologies that Web 2.0 applications employ.
 
  
 
Web 2.0 is more of a social development than a technical one. The web has become not only a place to find information on a certain subject but to find someone and share any number of things. The web has and web 2.0 use the same hardware but in different ways. Sites such as MySpace and YouTube are sites which contain uploaded content from normal users. These sites are simple in theory but without the support of users these sites would be worthless and empty.  
 
Web 2.0 is more of a social development than a technical one. The web has become not only a place to find information on a certain subject but to find someone and share any number of things. The web has and web 2.0 use the same hardware but in different ways. Sites such as MySpace and YouTube are sites which contain uploaded content from normal users. These sites are simple in theory but without the support of users these sites would be worthless and empty.  
Line 138: Line 137:
 
Web 2.0 relies on programmes that update a server full of information from multiple users like YouTube. Weblogs, wiki’s, forums and mash ups are three different ways that Web 2.0 is used. If you wish to use a Web 2.0 site and learn more about Web 2.0 then visit http://en.wikipedia.org/wiki/Web_2.  
 
Web 2.0 relies on programmes that update a server full of information from multiple users like YouTube. Weblogs, wiki’s, forums and mash ups are three different ways that Web 2.0 is used. If you wish to use a Web 2.0 site and learn more about Web 2.0 then visit http://en.wikipedia.org/wiki/Web_2.  
  
 +
* Web 2.0 is also known as the ‘collaborative web’. Describe which technologies make this possible, and indicate how these technologies are supported in Rails.
 +
 +
The technologies that collaborate together to form what is known as Web 2.0 includes Web Content Syndication ([[RSS]], Web Feed), Messaging Protocols (XMPP/Jabber), and Server Software (Apache),  among others.
 +
 +
Ruby supports the use of RSS feeds by acting as an object orientated library, that parses, creates, downloads, and caches RSS's. Examples of RSS feed code can be found at [http://www.rubyrss.com/ www.rubyrss.com].
  
* Web 2.0 is also known as the ‘collaborative web’. Describe which technologies make this possible, and indicate how these technologies are supported in Rails.
+
The [http://www.xmpp.org/ eXtensible Messaging and Presence Protocol] (XMPP) is the messaging protocol formerly known as Jabber. XMPP uses XML code, and can be used for Instant Messaging (including file transfer) and Voice over IP applications. [http://home.gna.org/xmpp4r/ XMPP4R] is an XMPP library project to provide frameworks for creating applications and scripts in Ruby. As it is coded in Ruby, it is object orientated, making it easier for the user.
 +
 
 +
The [http://www.modruby.net/en/ ModRuby] project is currently in development, which aims to integrate Ruby with the server software package Apache.
  
 
* Web 2.0 and XML go together like ‘bread and butter’. Discuss this assertion with reference to RSS and AJAX. How do these technologies contribute to the Web 2.0 approach?
 
* Web 2.0 and XML go together like ‘bread and butter’. Discuss this assertion with reference to RSS and AJAX. How do these technologies contribute to the Web 2.0 approach?

Revision as of 23:59, 11 March 2008

XML and Web Services >> Tutorial exerices

Tutorial: Week 2 – MVC & Controllers

  • Describe the roles of the model, view, and controller in the MVC design pattern as applied to web application development. Illustrate your answer with examples of each component.

MVC is an architectural pattern used in software engineering, however it is often used in a web applications. When designing an ecommerce web site you will be able to split it up to three, the model would be actual content of the page for example a database which will keep record of all the goods. The view would be the actual HTML page where the user will interact with and finally the controller is the code which gathers data to generate the content for the page for example getting the customers order (shopping cart).

Wikii.jpg
  • Describe what is meant by ‘URL rewriting’ and list the main advantages of its use. Explain why the use of controllers eases the process, and how it aids in creating RESTful applications.

A rewrite engine is a piece of web server software used to modify URLs before fetching the requested item, for a variety of purposes. This technique is known as URL rewriting. Some benefits derived from a rewrite engine are:

Making website URLs more user and search engine friendly. Preventing undesired "inline linking" or "hot linking" Not exposing the (web address-related) inner workings of a website to users

**This is incomplete - someone please answer question part 2 - how do controllers ease the process of url rewriting, and how do they aid in creating restful applications. You can remove this when you edit the answer

  • Describe the basic principles of the REST architecture (Fielding, 2000). Explain, with examples, how to implement a RESTful web application using Ruby on Rails.

REST: Representational State Transfer. It is refer to a collection of network architecture principles that outlines how resources are defined and addressed. Principles: •Application state and functionality are divided in to resources •REST architecture requires that applications use a simple, limited and repeatable set of verbs to perform actions on data and resources •All resources share a uniform interface for the transfer of state between client and resources consisting of well-defined operations and content types supporting code on demand.

Systems which follow Fielding’s REST principles are often referred to as “RESTful”. Ruby on rails is a free web application frame. It has application server built in and these application servers provide authentication, authorization, state handling, error handling, logging and performance which can be used to implement a web application.

Tutorial: week 3 – Models & ORM

  • Describe the characteristics of object and relational models that give rise to the problem known as ‘impedance mismatch’. Suggest two solutions, and describe one in detail, with examples where appropriate.

Impedance mismatch is a situation that arises when attempting to combine an object oriented software model with a relational database. Both the area of database design, and the area of software design have developed in completely separate ways, and as such, the differences between them can cause problems.

Objects in OO programs have identity, behavior and state whereas relational databases do not, this fact means databases and oo software need to "map" the data to each other, which in turn may cause slowdown. Also while Object Oriented programs use encapsulation to hide the way the programs work, mapping this implementation data to a relational database makes the database fragile as it has the potential to reveal the way the underlying software works.

One solution to solving impedance mismatch is simply to use an object oriented database system instead of a relational database, however, in reality this is often not a valid alternative as most databases used in the real world are relational.

Another option is to use a process called "object relational mapping". This is a technique used to convert data between incompatible type systems in relational databases and object-oriented programming languages. If object relational mapping is used, it is possible to use objects as tuple attribute values. This means that custom data types (such as a programmer created data class) can be used within a relational database. This technique essentially "extends" that of the relational database using DB adapters to wrap and encapsulate the database access. In ruby, the ActiveRecord design pattern is used to implement this.

  • Describe the ActiveRecord design pattern and explain how it is implemented in Ruby on Rails.

Active record pattern is a design pattern that is used in many enterprise applications.

Active record is about accessing data in a database. A database table is put into a class, this means that an object is assigned to a row in the database table. When an object is created, a new row is then added to the database table, when it is saved. Objects when loaded, recieves its information from the database. Also when an object is updated, the row that it's connected to in the database table gets updated aswell.

The Ruby on Rails ActiveRecord is implemented by object relational mapping - This means that data and logic are put together in one package. Object-Relational Mapping is a technique for changing data between unsuited systems in relational database so that it can be used in the programming languages.

  • Discuss the advantages and disadvantages of Rails migrations as an approach to model maintenance. What techniques does it provide to deal with different database cardinalities?

== Rails Migrations == The advantages of rails migrations are; 1) No SQL knowledge. 2) All changes controlled via rake. 3)creat two versions in migration - file "self.up" which is for new versions and file "self.down" for rollback. 4)Migrations can modify and populate a database.

The disadvantages of rails migrations are;"I stress there wasn't many i could find!" 1) Only supports primitive data types e.g integer.

Technigues rails supports scaffolds and automatically creates basic maintainenarece pages. Technigues that represent different cardinalities are e.g M:N relationships.

Tutorial: Week 4 – Views & Templates

  • List and explain the benefits of the View component of the MVC paradigm. Discuss why templates are commonly used as a central part of the view component.


  • Describe the function of a Template Markup Language in a template system. List the main requirements, with examples, of suitable candidates for such a language. What are the main factors that decide whether the language should be programming language based, or independent?

Template Markup Language is the language used in templates. Template Markup Language can be programming language specific or independent.

Main Requirements: 1) Must be able to define variables. 2) Must support variable substitution. 3) Needs flow control directives to specify conditional content.

Examples of Template Markup Languages: Python, JavaScript, Ruby(erb)

Main factors that decide which kind of language to be used:1) Familiarity 2) Flexiblity 3) Support availablity.

  • Ruby on Rails provides helper methods to reduce the dependency on code embedded in templates. Explain the reasons for this provision, giving examples of helpers and how they might be used.

Tutorial: Week 5 – testing

  • Define the terms testing, error and test case – explain how these definitions relate to web applications and the differences between testing traditional software applications and web applications.

Testing is a means to evaluate the quality of an application by finding bugs/defects so the problem can be fixed. In other words, it is a process to find any weaknesses in the work product. An Error can be considered to be a deviation from the expected value. The term test case means a set of test inputs, execution conditions, and expected results developed to test features of the application.


  • Describe the Ramler (2002) test cube and how it can be applied to web application testing.

Ramler states that the three dimensions (quality, feature & phase) can be combined to form a cube. The three dimensions form the axes of the cube.

The quality dimension includes four characteristics: 1. Functionality 2. Reliability 3. Usability 4. Efficiency

The feature dimension includes three categories: 1. Functions 2. Content 3. Infrastructure & Environment

The phase dimension includes three steps: 1. Specification & Development 2. Testing & Installation 3. Operation & Maintenance

The points of intersection in the cube can then be used to include the appropriate tests at the correct points. Certain tests may appear in more than one point in the cube as each test may cover more than one quality aspect. The cube can be fine-tuned to the specific application being developed, and each category can be further split into other sub-categories. For example, the Functionality characteristic of the Quality dimension can be further divided into Suitability, Accuracy, Security and others. This process can be extended to all characteristics of all three dimensions, forming a solid test plan. A sample cube is shown below.

Cube.jpg

  • Describe the specifics of web application testing, explain which elements could be automated and suggest possible tools that could be used for the process.

Tutorial: Week 6/7 – Comparisons

  • Web frameworks are a relatively new approach to agile web application development. Discuss the concepts involved in creating a framework, illustrating your answer with examples of a real framework.
  • Compare and contrast two web frameworks that you are familiar with. Give examples of components that are utilised to illustrate your answer.
  • Discuss the design patterns that are used as the basis of web frameworks, highlighting any compromises or issues encountered in the implementation.

Tutorial: week 9 – XML

  • Discuss the advantages and disadvantages of XML as a data exchange format in comparison with one other commonly used format.
  • There are two mechanisms available to constrain an XML file. Compare both and discuss the advantages and disadvantages of each approach.
  • Explain how to create an XML file using the Rails framework, and describe two applications for such a file.

Tutorial week 10 - Web 2.0

  • “Web 2.0 is more of a social or business evolution than a technical one.” Discuss this assertion with respect to the common technologies that Web 2.0 applications employ.

Web 2.0 is more of a social development than a technical one. The web has become not only a place to find information on a certain subject but to find someone and share any number of things. The web has and web 2.0 use the same hardware but in different ways. Sites such as MySpace and YouTube are sites which contain uploaded content from normal users. These sites are simple in theory but without the support of users these sites would be worthless and empty.

Web 2.0 relies on programmes that update a server full of information from multiple users like YouTube. Weblogs, wiki’s, forums and mash ups are three different ways that Web 2.0 is used. If you wish to use a Web 2.0 site and learn more about Web 2.0 then visit http://en.wikipedia.org/wiki/Web_2.

  • Web 2.0 is also known as the ‘collaborative web’. Describe which technologies make this possible, and indicate how these technologies are supported in Rails.

The technologies that collaborate together to form what is known as Web 2.0 includes Web Content Syndication (RSS, Web Feed), Messaging Protocols (XMPP/Jabber), and Server Software (Apache), among others.

Ruby supports the use of RSS feeds by acting as an object orientated library, that parses, creates, downloads, and caches RSS's. Examples of RSS feed code can be found at www.rubyrss.com.

The eXtensible Messaging and Presence Protocol (XMPP) is the messaging protocol formerly known as Jabber. XMPP uses XML code, and can be used for Instant Messaging (including file transfer) and Voice over IP applications. XMPP4R is an XMPP library project to provide frameworks for creating applications and scripts in Ruby. As it is coded in Ruby, it is object orientated, making it easier for the user.

The ModRuby project is currently in development, which aims to integrate Ruby with the server software package Apache.

  • Web 2.0 and XML go together like ‘bread and butter’. Discuss this assertion with reference to RSS and AJAX. How do these technologies contribute to the Web 2.0 approach?

XML is used to transfer data in web technologies such as RSS (Really Simple Syndication) and AJAX (Asynchronous JavaScript and XML) in a Web 2.0 application. This helps Web 2.0 provide characteristics such as rich user experience and dynamic content. RSS is a common feature/technique used in web 2.0 applications to permit the use of a website’s data to be used in another context such as another website or even a browser plug-in. RSS files are created using XML and therefore enables web 2.0 applications to publish frequently updated content. AJAX is a rich-internet application technique used in Web 2.0 to improve user experience. It works by using XML to transfer data requests, by calling AJAX functions, in JavaScript on the client side to a server side scripting language. This takes place in the ’background’ so the view, in terms of MVC, is not interfered with. This helps Web 2.0 applications increase their interactivity, speed, functionality, and usability.

These Technologies contribute to the Web 2.0 approach in a number of ways. RSS allows data to be shared with individuals or with other websites, therefore supporting collaboration. This means that a web developer can use data via an RSS feed to help create a custom web application. An example of RSS in action is when a web developer creates a ‘latest news’ webpage using several RSS feeds to gather the latest news information. AJAX is used to give a rich user experience. Examples of AJAX integration in web development can be seen in [1] and in [2]. These websites allow web applications to behave more like desktop applications, in that you can ‘drag and drop’ items, so you are able to customize the webpage to your personal taste. AJAX allows asynchronous web applications, you get faster response times. Also used to improve user experience e.g. web-page requests an update for some part of its content which requires altering the webpage in the browser. This can be achieved without the need to refresh the whole page using AJAX. These technologies contribute to the Web 2.0 approach by allowing the creation of rich user interfaces.

Tutorial week 11 - Web services

  • Explain what is meant by the term ‘web services’ and the role they play in a distributed computing system. Compare and contrast them with Corba, explaining the acronym and the advantages and disadvantages of each.
  • Modern web services can be implemented via a RESTful approach or via SOAP. Discuss the advantages and disadvantages of each approach.
  • A service oriented architecture (SOA) is one approach to the enterprise application of web services. Discuss how web services fit into a SOA, and explain what supplementary services/ components are required to form a true SOA.