Use cases and requirements

Written on 7 November 2013, 11:38am

Tagged with: , ,

Functional vs non-functional requirements

Functional: describes the behavior of the system, its functionality; what the system should do
Non-functional: describes the performance characteristics of the system; how the system should be

Functional: the system must present the user an interface with the number of records in the db.
Non functional: the number of records must update in real-time.

Functional: the system must send an email when a new order is placed.
Non-functional: the emails should be sent with a latency of no greater than 10 minutes from such an activity.

Use cases

Use cases represent a practice for capturing functional requirements.

Use cases > scenarios:

A use case defines a goal-oriented set of interactions between external actors and the system under consideration.
A scenario is an instance of a use case, and represents a single path through the use case.
Use cases capture who (actor) does what (interaction) with the system, for what purpose (goal), without dealing with system internals.
http://www.bredemeyer.com/pdf_files/functreq.pdf

Scenarios > use cases:

A scenario is a sequence of steps describing an interaction between a user and a system.
A use case is a set of scenarios tied together by a common user goal.
Martin Fowler – UML distilled

In order to engage all the stakeholders, the use cases should be:
– written in an easy to understand language
– kept short (1-2 pages max)
– have a narrative language (user stories)
– have a clear structure (Title, Goal, Actors, Assumptions, Steps, Variations, Non-functional requirements, Issues)

Galtur

OO concepts refresher

Written on 5 November 2013, 12:19pm

Tagged with: ,

Going back to square one 🙂
http://docs.oracle.com/javase/tutorial/java/index.html

Class: the blueprint from which individual objects are created.
Object: the instance of a class. The objects have state (fields) and behavior (methods).
Encapsulation: Hiding internal state and requiring all interaction to be performed through an object’s methods (getters and setters). Note: this requires that the class fields are private (“In the spirit of encapsulation, it is common to make fields private. […] Use private unless you have a good reason not to.“)
concepts-object
Inheritance: Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. Subclass extends Superclass

This keyword: can be used either for a field (this.radius=radius) or for a constructor – this(0,0)

Class variables (static fields): they are common to all objects. There is only a copy of this variable, no matter how many times the class is instantiated.
Instance variables (non-static fields): they are distinct for each object. Each object has its own copy.
Example: Bicycle class, numberOfGears static field, speed non-static field. Each Bicycle object has its own speed (instance variable), but all of them have the same number of gears (class variable).

Instance methods: they need an instance of a class. instanceName.methodName(args)
Class methods: they can be used without an instance of the class. ClassName.methodName(args)
Class vs instance methods: Instance methods can access instance variables, instance methods, class variables and class methods directly.
Class methods can access class variables and class methods directly. But they cannot access instance variables or instance variables directly (they must use an object). They also cannot use the ‘this‘ keyword

Constants: static + final modifiers. Final indicates that the value cannot change:
static final double PI = 3.141592653589793;

Method overloading: Methods within a class can have the same name if they have different parameter lists. Warning: The compiler does not consider return type when differentiating methods, so you cannot declare two methods with the same signature even if they have a different return type.
Example:
public void draw (int i);
public void draw (double d); //ok
//--
public int draw (int i);
public void draw (int i); //compiler error

Method overriding: An instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and return type as an instance method in the superclass overrides the superclass’s method.
Method hiding: If a subclass defines a class method with the same signature as a class method in the superclass, the method in the subclass hides the one in the superclass.
Note: You will get a compile-time error if you attempt to change an instance method in the superclass to a class method in the subclass, and vice versa.

Super: If your method overrides one of its superclass’s methods, you can invoke the overridden method through the use of the keyword super: super.printDescription()

Polimorphism: Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class.
public void printDescription() {
super.printDescription();
System.out.println("The MountainBike has a" + getSuspension() + " suspension.");
}

Interface: a group of related methods with empty bodies. A class implements an interface
Package: a namespace that organizes a set of related classes and interfaces.

Abstract classes: cannot be instantiated, but they can be subclassed.
Abstract method: is declared without an implementation:
abstract void moveTo(double deltaX, double deltaY);
Abstract classes vs interfaces: Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain implemented methods. Such abstract classes are similar to interfaces, except that they provide a partial implementation, leaving it to subclasses to complete the implementation.

colors
Photo: instagram

HTTP basic authentication

Written on 3 November 2013, 12:28pm

Tagged with: , ,

A few notes:

– it only uses HTTP headers
– it does not encrypt the username:password, it only base64 encodes them to obtain a string (think about a password containig two newlines 🙂 )
– so it is highly recommended to be used over HTTPS
– if this is not possible, then HTTP digest authentication should be used instead
– initially, the server responds with a HTTP 401 Non Authorized response code
– the HTTP headers must be sent by the browser with every subsequent request, so caching is necessary
– the web server does not provide a ‘log out’ mechanism; each browser has its own way of logging out. Example for Chrome: load http://username@mysite.com

More details on the Wikipedia page: http://en.wikipedia.org/wiki/Basic_access_authentication
HTTP Digest Access Authentication: http://en.wikipedia.org/wiki/Digest_access_authentication
How to set up HTTP Basic Authentication in Apache: http://wiki.apache.org/httpd/PasswordBasicAuth

iStock_000010892293Small
Photo: iStockPhoto