Skip to content
ewernli edited this page Sep 18, 2012 · 26 revisions

Deadline: Wednesday, 26. September 2011, 12:00

1. Registration (1 point)

To register for the exercises, you must

  • Create a github account (if you already have one, you can reuse it) ;
  • Create a repository ese2012_warmup;
  • Follow ese_unibe_ch on twitter ;

Then

  • Send a mail to [email protected] with the title "registration ESE 2012", containing your github and twitter accounts. Send the mail from your @students.unibe.ch email address, otherwise it will be queued in the mailing list.

We will confirm your registration, and send you the license key for RubyMine.

Recommended readings for github are:

This part of the exercise is solved if you successfully obtained a reply to your registration email.

2. Short Bio (1 point)

We request that you write a short bio about yourself using the github wiki:

  1. Add a wiki page "bio" to the wiki of ese2012_warmup.
  2. Introduce yourself by writing a few short paragraphs about yourself and your knowledge and experience in Software Engineering. If you like you can also write down your contact information, this will likely be useful during the project later on in this course.

Answer the following questions with a few keywords or a short sentence:

  • What programming languages do you know and use?
  • Have you been involved in any software projects?
  • Do you have experience working in teams?

3. Programming (4 points)

The goal of this task is to implement a simple application to trade items. Users have an amount of credits. Users in the system can propose items to a fixed price, which other users can buy using their credits.

The requirements you are asked to implement are:

  • Users have a name.
  • Users have an amount of credits.
  • A new user has originally 100 credit.
  • Items have a name.
  • Items have a price.
  • An item can be active or inactive.
  • An item has an owner.
  • A user can add a new item to the system with a name and a price; the item is originally inactive.
  • A user can buy active items of another user (inactive items can't be bought). When a user buy an item, it becomes the owner; credit are transferred accordingly; immediately after the trade, the item is inactive. The transaction fails if the buyer has not enough credits.
  • A user provides a method that lists his/her active items to sell.

Note that this task only involves to model the requested features of the entities User and Item. We do not ask you to provide a user-interface. The code has to be accompanied with unit-tests though. For each of the above requirements, it is required to have at least one test method containing at least one assertion. For the last requirement, you must have at leat 3 test methods that cover different cases (enough/not enough credit, active/inactive, etc.)

The code must be provided according to the guidelines:

Structure

The code must be structured as follows:

/lib
     appname.rb
     /module-x
           class-in-module-x.rb
/test
     test-y.rb

Coding Style

For this exercise, only the following bare minimal rules are mandatory:

Ruby 101

The sample class below shows all the language construct needed for this exercise:

The sample class below shows how to write a unit test with Ruby:

Notice

You can solve the third part of the exericse in team of two. You are asked to deliver the code in the ese2011-warmup repository of one of the author. You need to send a mail to [email protected] with the following subject line: "Exercise 1: Warming Up", give the names of the authors, and the git repository to pull the code from. We must be able to create a ruby project out of your code and run the tests with no pain. Exerices must be delivered by Wednesday, 26. September 2011, 12:00.

Clone this wiki locally