Html/Javascript widget

Sunday 27 August 2017

Unified Process

Unified Process is one of the most important software industry patterns as of late. This software process was spearheaded by 3 experts in object-oriented analysis in the 1990's: Jacbson, Booch and Rumbaugh). This is the first ever model to be designed after the UML notation. It started to find wide acceptation as a best practice for market ROI. Among the UP features one could quote:
-Clear and precise instructions;
-promotes accountability;
-activities that stress out input and output artefacts
-defines the dependency relationships among activities;
-comprises a well understood life cycle model;
-emphasises the use of the right procedures with the available resources;
-strong correlation with UML.

As a framework, UP is easily adapted to a variety of processes, encompassing the needs of different businesses. Its main features are:

1- Use case-driven- This is process understood from the user's viewpoint, without touching on implementation details. This means a comprehensive collection of all functional requirements that the proposed system has to include. Non-functional requirements might be noted along matching use cases, while extra requirements are kept in a different document.

2- Archiecture-centred - This implies gathering the requirements collected during the use cases and think of them as classes organised in components with defined roles within a system. Archiecture might be thought of as the information structure as well as the likely operations of said system. The system architecture starts with the user's viewpoints through use cases influenced by implementation factors.

3- Incremental iterations - At each iteration, relevant use cases are analysed according to the chosen architecture. The artefact resulting at the end of every iteration is a system module or an executable version.  The next stage of the iteration involves the next system component to be implemented provided that the current one meets the user's expectations.

4- focus on risk- This means that the most critical use cases are dealt with early in order to solve the most difficult problems first. The highest risk requirements or use cases are usually the ones most likely to be unpredictable in their interaction with the remainder of the components. Thus, understanding them first emables is important to ensure tighter system cohesion.

UP stages

1- Inception: This stage seeks to establish a broad picture of the system. Here the main priorities are limited to requirements, conceptual models and high level use cases. A development plan is also drawn up at this point in order to anticipate the amount of resources needed into the proposed project. The use cases will be incorporated into iterative cycles. Tests and implementation might occur during this stage in case an early prototype is deemed necessary to avoid greater risks, but otherwise these are kept to a minimum.

2- elaboration- Use cases are expanded upon in order to plot a basic architectural model. This means that the use cases are given more details to decide which artifacts will serve as the input/output of the incoming iterations. The conceptual model is revised and gives rise to the logical and physical design of the intended system.

3- construction- With the basic system architecture established, the first release of the software product is the aim of this stage, which is almost entirely dedicated to coding and testing. At this point a basic should have been reached between managers and users about the intended system.

4- transition - The system is deployed to the user's work environment. Usually data transfer from the former system takes place along with the obligatory training course. Any discrepancy picked by the end users are reported to the developers so they can work on the necessary improvements. It's still possible for requirements and code to undergo some minor revisions.




Thursday 17 August 2017

Linked List

Introduction to linked list.

A linked list is a data structure that looks a lot like a regular list, except that it's a sequence of nodes. Each node comprises of two parts: data field and data reference. The latter is what defines nodes in a linked list as they're needed to point to the next node in the sequence. Without the data reference, the elements of a linked list wouldn't be bound at all; they'd be only loose entities without any connecting feature to relate them. A head pointer is used to track the first element in the linked list, always pointing to it.

The linked list data structure is tops for insertion or removal at any position in the list. However finding elements according to some specified criterium is made more difficult when compared to other compound data structures such as arrays and lists because it requires going through the whole list in order to find the desired item.

We can model a node of the linked list using a structure as follows:

typedef struct node{
    int data;
    struct node* next;
}

It should be noted that a linked list element is basically a struct, an object-esque entity in C which shares some similarities with a bona fide object from OO programming. For instance, a struct can store other values using common data types such as ints and chars, which can be referred to later on down the project.  Also, notice how data stores information while the next pointer holds the address of the next node.


First we declare a head pointer that always points to the first node of the list.

To add a node at the beginning of list we need to create a new node. We will need to create a new node each time we want to insert a new node into the list so we can develop a function that creates a new node and return it.

node* create(int data,node* next)
{
    node* new_node = (node*)malloc(sizeof(node));
    if(new_node == NULL)
    {
        printf("Error creating a new node.\n");
        exit(0);
    }
    new_node->data = data;
    new_node->next = next;

    return new_node;
}

Then we need to point the next pointer of the new node to the head pointer and point the head pointer to the new node.

node* prepend(node* head,int data)
{
    node* new_node = create(data,head);
    head = new_node;
    return head;
}

TRaversing the linked list

To traverse the linked list, we start from node 1, and move to the next node until we reach a NULL pointer.


typedef void (*callback)(node* data);
The following is the traverse() function:

void traverse(node* head,callback f)
{
    node* cursor = head;
    while(cursor != NULL)
    {
        f(cursor);
        cursor = cursor->next;
    }
}