Wednesday, October 22, 2008

Functional vs. Non-Functional Requirements

Functional vs. Non-Functional Requirements
Functional requirements describe what the system should do
- things that can be captured in use cases
- things that can be analyzed by drawing sequence diagrams, statecharts, etc.
- Functional requirements will probably trace to individual chunks of a program
- Non-functional requirements are global constraints on a software system
- e.g. development costs, operational costs, performance, reliability,
maintainability, portability, robustness etc.
- Often known as the “ilities”
- Usually cannot be implemented in a single module of a program

Functional Requirements
The official definition for a functional requirement specifies what the system should do:

"A requirement specifies a function that a system or component must be able to perform."

Functional requirements specify specific behavior or functions, for example:

"Display the heart rate, blood pressure and temperature of a patient connected to the patient monitor."

Typical functional requirements are:
• Business Rules
• Transaction corrections, adjustments, cancellations
• Administrative functions
• Authentication
• Authorization –functions user is delegated to perform
• Audit Tracking
• External Interfaces
• Certification Requirements
• Reporting Requirements
• Historical Data
• Legal or Regulatory Requirements
Non-Functional Requirements
The official definition for a non-functional requirement specifies how the system should behave:

"A non-functional requirement is a statement of how a system must behave, it is a constraint upon the systems behavior."
Non-functional requirements specify all the remaining requirements not covered by the functional requirements. They specify criteria that judge the operation of a system, rather than specific behaviors, for example:
"Display of the patient's vital signs must respond to a change in the patient's status within 2 seconds."
Typical non-functional requirements are:
• Performance - Response Time, Throughput, Utilization, Static Volumetric
• Scalability
• Capacity
• Availability
• Reliability
• Recoverability
• Maintainability
• Serviceability
• Security
• Regulatory
• Manageability
• Environmental
• Data Integrity
• Usability
• Interoperability
Non-functional requirements specify the system’s ‘quality characteristics’ or ‘quality attributes’. Potentially many different stakeholders have an interest in getting the non-functional requirements right. This is because for many large systems the people buying the system are completely different from those who are going to use it (customers and users).



Functional requirements are typically phrased with subject/predicate
constructions, or noun/verb. "The system prints invoices."
Non-functional requirements may be found in adverbs or modifying
clauses, such as "The system prints invoices *quickly*" or "The system
prints invoices *with confidentiality*".

From a mathematical point of view, a "function" takes an input(s) and
yields an output(s). "Functional" refers to the set of functions the
system it to offer, while "non-functional" refers to the manner in which
such functions are performed.

Sunday, October 05, 2008

How to find first and last entry of HashMap

http://forums.sun.com/thread.jspa?threadID=403658&tstart=81825
How come Hashtable / HashMap have search order constant . ?
/**
* The table, resized as necessary. Length MUST Always be a power of two.
*/
transient Entry[] table;
// and here's the method that intrests you
public Object get(Object key) {
Object k = maskNull(key);
int hash = hash(k);
int i = indexFor(hash, table.length);
Entry e = table[i];
while (true) {
if (e == null)
return e;
if (e.hash == hash && eq(k, e.key))
return e.value;
e = e.next;
}
}
so, as you see, if you have one Entry per bucket, then it's as easy as taking from an array, but if you have more that one entries in one bucket, then it has to loop that while for a while.

Wednesday, October 01, 2008

USE OF SINGLETON

Assume that we have a web based system that allows users to log in to secure areas of a web server. Such a system will have a database containing user names, passwords, and other user attributes. Assume further that the database is accessed through a third party API. We could access the database directly in every module that needed to read and write a user. However this would scatter usage of the third party API throughout the code, and would leave us no place to enforce access or structure conventions.