Monday, May 11, 2009

Exercise 21: Shopping cart specifications

Develop the class diagram for the following shopping cart specifications:

A shoppingCart object is associated with only one creditCard and
customer and to items in itemToBuy object. Persistent customer
information such as name, billing address, delivery address, e-mail address
and credit rating is stored in the customer object. The credit card object is
associated with a frequentShopper discount object, if the credit rating
for the customer is good. The customer can make or cancel orders as well
as add and delete items to the shopping cart product. The credit card
object contains the secure method for checking that the charge is authentic.

Class Diagram for shopping cart

Exercise 20: Modeling with UML

Use Case, Class, Sequence, Collaboration, State chart, Activity, Component and Deployment diagrams are used in UML. Describe each of the eight (8) main diagrams used in UML.

According to the Ambler (2007), the main diagrams used in UML are as following:

Use Case diagram
"Shows use cases, actors, and their interrelationships. "

Class diagram
"Shows a collection of static model elements such as classes and types, their contents, and their relationships. "

Sequence diagram
"Models the sequential logic, in effect the time ordering of messages between classifiers."

Collaboration diagram
"Shows instances of classes, their interrelationships, and the message flow between them. Communication diagrams typically focus on the structural organization of objects that send and receive messages. Formerly called a Collaboration Diagram."

State chart
"Describes the states an object or interaction may be in, as well as the transitions between states. Formerly referred to as a state diagram, state chart diagram, or a state-transition diagram."

Activity diagram
"Depicts high-level business processes, including data flow, or to model the logic of complex logic within a system."

Component diagram
"Depicts the components that compose an application, system, or enterprise. The components, their interrelationships, interactions, and their public interfaces are depicted."

Deployment diagram
"Shows the execution architecture of systems. This includes nodes, either hardware or software execution environments, as well as the middleware connecting them."

Reference:
Ambler, S. W. (2007), Introduction to the Diagrams of UML 2.0, Retrieved 20 May 2009 from http://www.agilemodeling.com/essays/umlDiagrams.htm

Exercise 22: Differentiate between software systems

Customer Relationship Management (CRM)

CRM is a strategy used to learn more about customers' needs and behaviors in order to develop stronger relationships with them

a. providing services and products that are exactly what your customers want
b. offering better customer service
c. cross selling products more effectively
d. helping sales staff close deals faster
e. retaining existing customers and discovering new ones

Supply Chain Management (SCM)

There are five major functions in Supply Chain Management software. Most of the companies requires only some component in their business, so the software for SCM is usually fragmented.

According to Wailgum (2007), the five components are:
a. Plan

i. planning is developing a set of metrics to monitor the supply chain so that it is efficient, costs less and delivers high quality and value to customers.

b. Source

i. develop a set of product pricing, delivery and payment processes with suppliers and create metrics for monitoring and improving the relationships

ii. processes for managing their goods and services inventory, including receiving and verifying shipments, transferring them to the manufacturing facilities and authorizing supplier payments.

c. Make

i. schedule the activities necessary for production, testing, packaging and preparation for delivery.

d. Deliver

i. coordinate the receipt of orders from customers, develop a network of warehouses, pick carriers to get products to customers and set up an invoicing system to receive payments.

e. Return

i. Supply chain planners have to create a responsive and flexible network for receiving defective and excess products back from their customers and supporting customers who have problems with delivered products.


Conclustion:
To sum up, both software performing different functions. CRM trends to collect information on customer behavor and habits for designing strategy for selling products while SCM trends to plan for the production, testing and delivery of the products.

Reference:

Wailgum T. (March 06, 2007), CRM Definition and Solutions, Retrieved 19 May 2009 from http://www.cio.com/article/40295/CRM_Definition_and_Solutions

Wailgum T. (March 19, 2007), Supply Chain Management Definition and Solutions, Retrieved 19 May 2009 from http://www.cio.com/article/40940/Supply_Chain_Management_Definition_and_Solutions

Business Link (2007), Customer relationship management, Retrieved 19 May 2009 from http://www.businesslink.gov.uk/bdotg/action/detail?r.l1=1073861197&r.l3=1075422922&r.lc=en&type=RESOURCES&itemId=1075422931&r.l2=1075422920&r.s=sc#

Exercise 23: Searching mechanisms

1. What is a spider? What does it do?

Schneider (2006) stated that spider is a part of the search engine. It is used to search the webpage and website which interesting to people automatically.
Awad (2004) defined that "spider: a software tool that prowls the internet looking for new sites where information is likely to reside."

During the search, the spider will collect information from the page such as the links contained on the page, keywords, title, content and also "meta" tag for user to search in the future.

2. What is a meta-search engine? Provide some examples.
meta is the keywords that describe the webpages but not part of the web content. (Schneider)
Rosen (2002) pointed that the meta-search engine looks for the meta tag in the webpages only. It then locates the website to the user by keyword matching.

Examples of meta-search engine:
Clusty
Dogpile

3. How can you get your site listed at major search sites; and how could you improve your site ranking?

a. Register a suitable domain name for the website.
b. Register the website to the major search engine.
c. Put the website into subitable category.
d. Use suitable meta in the website for spider to locate.
e. Better design and content of web to make it a popular search.
e. Paid or sponsor to the company of search engine to increase its rank.
f. Advertise on the search engine.


Reference:
Schneider, G. P. (2006), Electronic Commerce Sixth Annual Edition, Thomson, Canada, p. 203-205

Awad, E. M. (2004), Electronic Commerce (2nd ed), Pearson Education, NJ, p. 44

Rosen A. (2002), The e-commerce question and answer book: a survival guide for business managers (2nd ed), American Management Association, NY, p. 182

Meta-Search Engines, Retrieved 16 May 2009 from http://www.lib.berkeley.edu/TeachingLib/Guides/Internet/MetaSearch.html

Ince, D. (2004), Developing Distributed and E-commerce Applications (2nd ed.), Pearson, p. 438-439

Exercise 19: TP monitors and transaction protocols

1. Give a description in your own words of the ACID proprtties of a transaction.

Atomicity (A)
Atomicity is used to ensure the transaction is successfully completed or not to prevent incomplete transactions.
In case of transaction success and completed. For example, the client paid for goods and the merchant is received his money.
In case of transaction failed and incomplete. For example, the client money remains in his account and the merchant do not receive any money.

Consistency (C)
When a transaction transforms from one state to another, intermediate points may be produced in database before the transaction commit and complete. Consistency is that the transaction does not require the intermediate points to transform from one state to another.

Isolation (I)
When there are concurrent transactions are running, the tranaction assigned to process should be complete and commit before another transaction to start process.

Durability (D)
The commited transaction should be availible at any time it is being used.


2. Describe a TP monitor environment. How can a TP monitor stop an operating system being overwhelmed?

The softwareag.com (2006) stated that the TP monitor environment contains user session data is referred to as thread. The session data used for the user session.

Figure 1. Environment of the TP monitor, Natural is a program running in the operating system (softwareag.com 2006)


As all administrative tasks of an operating system involving time must be created by TP monitor which is used to allocate the resources basis on the request each time such as process allocation and storage allocation. The load of the operating system is prevented from being overwhelmed. (Gray J., Reuter A., 1993)

3. What is difference in load balancing with traditional and transactional MOM, RPC and conversations?

In traditional RPC model, the request from user should be queued and wait synchronously for the server to execute and return the reply where the client and server should be free at the same time.

Messge-oriented middleware help to resolve the problem of the wait time. It acts as a middleware between the client and server, buffering the requests from user and replies from servers. As it runs in asynchronous model, it is no need to wait for client and server to be free at the same time.

In transactional MOM and RPC, the message queue is divided, distributed into queues and maintained at queue managers. The messages queues can be integrated for direct transaction processing and allow to commit or undone.

As a result, as the queue is divided, the load of the servers is then evenly distributed. (Mahmoud 2004)

4. Why is a two-phase commit protocol better than a one-phrase commit protocol?

The two-phrase commit protocol is better than one-phrase protocol. It is because the two phrase protocol confirm the transaction is received and recoverable before the transaction transofrm and commit. In case of the system fail, the transaction can be recovered or processed through the protocol. (Zurich)

Reference:
PCMAG.COM (n.d.), Definition of: TP monitor,Retrieved 14 May 2009 from http://www.pcmag.com/encyclopedia_term/0,2542,t=TP+monitor&i=53022,00.asp

PCMAG.COM (n.d.), Definition of: two-phase commit, Retrieved 14 May 2009 from http://www.pcmag.com/encyclopedia_term/0,2542,t=two-phase+commit&i=53281,00.asp

Zurich, ETH (n.d.), Message Oriented Middleware (MOM), Retrieved 15 May 2009 from http://www.iks.inf.ethz.ch/education/ws04/eai/Lecture-8.pdf

Zurich, ETH (n.d.), Message Oriented Middleware (MOM), Retrieved 15 May 2009 from http://www.iks.inf.ethz.ch/education/ws03/eai/Lecture-5.pdf

Kenneth M. A. (2006), http://www.cs.colorado.edu/~kena/classes/7818/f06/lectures/03/index.html

softwareag.com (2006), TP/OS Interface, Retrieved 15 May 2009 from https://cis.tamu.edu/systems/database/manuals/NAT421/arc/tp_mf_0040.htm

PCMAG.COM (2009), Definition of: TP monitor, Retrieved 15 May 2009 from http://www.pcmag.com/encyclopedia_term/0,2542,t=TP+monitor&i=53022,00.asp

Gray J., Reuter A. (1993), Transaction Processing: Concepts and Techniques, Morgan Kaufmann Publisher, p. 363

Mahmoud Q. H. (2004), Middleware for communications, John Wiley and Sons, p. 65-66

Exercise 18: Threading demostration in Python

Source Code of the threaddemo.py


Process Explain:
In this demo, the first part is defining the objects, variables and values.

The second part defining the common variable which will be access by the threads.
The third part is the major part of the threaddemo.
During the main program runs, the program acquire the lock for the the common variable and add a value into it. A delay of a random time is started just after the release of the common variable. At this moment, the other thread can be created by the main program. After the delay is end, the thread acquire the lock again and reduce the variable for the number of running processes.

Findings:
According to the result provided with the exercise, the longer the wait time o the thread, the later end of the process. This program favor the smaller program. The smaller thread uses the waiting time of the long waited thread to get its job done. Thread in this program simulate the multi-tasking environment to a common resources.

Exercise 17: Concurrency terms

Find definitions for eight terms and concepts used in threaded programming:

1. Thread Synchronisation

Daelin stated that thread synchronization helps to prevent the threads created to change the value of a variable at the same time. A 'lock' is applied for the process which gain the right to use the variable. The other thread will wait till the 'lock' applied on the variable to release. In multiple threads environment, it is used to prevent the corruption of program data.

2. Locks

There are two types of lock, read and write lock. It is used to ensuring only one thread can access the resource at a time to prevent conflict. (Ince)

3. Deadlock

According to Ince (2004), deadlock is defined as "where two threads cannot proceed becuse each is holding resources required by the other."

4. Semaphores

"A semaphore is a protected variable or abstract data type which constitutes the classic method for restricting access to shared resources such as shared memory in a multiprogramming environment." (Wikipedia)

5. Mutex (mutual exclusion)

Galvin (1994) defined that mutual exclusion condition exists "If process Pi is executing in its critical section, then no other processes can be executing in their critical section."

6. Thread

Ince (2004) stated that thread is "An independent execution of some program code."

7. Event

The Microsoft Developer Network stated that event is "Represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons."

8. Waitable timer.

In Microsoft Developer Network, it defined waitable timer as "a waitable timer object is a synchronization object whose state is set to signaled when the specified due time arrives."

It also stated that there are three types of timer - manual-reset, synchronization and periodic timer and is defined in MSDN as follows.

"manual-reset timer - A timer whose state remains signaled until SetWaitableTimer is called to establish a new due time.

synchronization timer - A timer whose state remains signaled until a thread completes a wait operation on the timer object.

periodic timer - A timer that is reactivated each time the specified period expires, until the timer is reset or canceled. A periodic timer is either a periodic manual-reset timer or a periodic synchronization timer."

Reference:
Galvin, S. (1994), Operating System Concepts 4ed, Addison Wesley

Ince, D. (2004), Developing distributed and e-commerce applications 2nd edition, Pearson education limited

Microsoft Developer Network (n.d.), event Object, Retrieved 11 May 2009 from http://msdn.microsoft.com/en-us/library/ms535863(VS.85).aspx

Wikipedia (n.d.), Semaphore (programming), Retrieved 11 May 2009 from http://en.wikipedia.org/wiki/Semaphores

WikiAnswer (n.d.), What is Thread Synchronization?, Retrieved 12 May 2009 from http://wiki.answers.com/Q/What_is_Thread_Synchronization