Ads

Pages

Saturday, November 27, 2010

CS 604 assignment no 2 solution









mth202 assignment no 3

Question no 1) Show that f(x) is one to one; where







Question 2) Find the inverse function of







Q3) Find the common fraction for the recurring decimal 0.7


Wednesday, November 24, 2010

CS-504 Assignment#2 Solution

Q1:Differentiate the following

1) Coupling and Cohesion

2) Object-Oriented and Function-Oriented design

Your solution should be in following format:

Coupling

Cohesion

Coupling between modules/components is their degree of joint interdependence; lower coupling is healthier.

Cohesion of a solitary module/component is the degree to which its responsibilities form a significant unit; higher cohesion is healthier.

v Size: number of relations between routines

v intimacy: the directness of the link among routines

Someone had indistinct reference to decomposability here. Amplification?

v visibility: the prominence of the connection between routines

v flexibility: the ease of changing the connections between routines

How concerning: 'Cohesion is inversely relative to the number of responsibilities a module/part has.'

Coupling explains how dependent a given part of software is on other modules. An extremely coupled system in one in which the events in one module can directly right to use rudiments of another module. A low coupled system in one in which the events of one module can only interrelate with the procedures of another during an interface channel. Highly coupled systems are often characterized by code that is hard to read & maintain (the cause cohesion and coupling are frequently used as opposites).

Cohesion explains how "paying attention" a part of software is. A highly-cohesive system is one in which all procedures in a specified module work jointly towards some end aim. High cohesion is frequently typified by high readability and maintainability.

Object-Oriented Design

Function-Oriented Design

The Basic concept is not the services accessible to the clients of the system

The basic concept is available to clients of the system

The state information survive in the form of data distributed between several objects of the system

The state information is accessible in a federal shared data store.

Group function jointly on the basis of data they work on

Group Functions together if as a group, they constitute a higher level Function

Where OOP orients on objects,

Or as called in C++ classes.

Functional oriented plan familiarize on functions

Object is data with techniques of processing it.

Functions, obtain some data, process it and then revisit result, or do several actions.

Q2

1) Write down any custom built C++ Class which you think is not cohesive (or low cohesive).

Public I Enumerable GetEmployeesFromDb_LowCohesion()

{
// instantiate the links
using(SqlConnection connection = newSqlConnection(ConfigurationManager.ConnectionStrings[CONNECTION_STRING_KEY].ConnectionString))
using(SqlCommand command = new SqlCommand("spGetEmployee", connection)) // instantiate the command

{
command.CommandType = CommandType.StoredProcedure;

// try to open the links
try
{
connection.Open();
}
catch (InvalidOperationException ex)
{
// log exemption
throw;
}
catch (SqlException ex)
{
// log exemption
throw;
}
catch (Exception ex)
{
// log exception
throw;
}

// perform the reader & read the results
using(SqlDataReader reader = command.ExecuteReader())
{
Int32 m_NameOrdinal, m_DeptOrdinal;

// obtain the ordinals
try
{
m_NameOrdinal = reader.GetOrdinal(NAME);
m_DeptOrdinal = reader.GetOrdinal(DEPARTMENT);
}
catch(System.IndexOutOfRangeException ex)
{
// log exemption
throw;
}

Collection result = new Collection();

// interpret the results
while(reader.Read())
{
try
{
Employee emp = new Employee();
emp.Name = reader.IsDBNull(m_NameOrdinal) ? String.Empty: reader.GetString (m_NameOrdinal);
emp.Department = reader.IsDBNull (m_NameOrdinal) ? String.Empty : reader.GetString(m_DeptOrdinal);
result.Add(emp);
}
catch (IndexOutOfRangeException ex)
{
// Log the exemption
throw; // rethrow or handle gracefully here
}
catch (Exception ex)
{
// Log the universal exemption
throw; // rethrow or handle gracefully here
}
}

return result;
}
}
}

CS 615 2nd Idea Solution

Solution:

Question # 1:

01 How Facilitated Application Specification Techniques (FAST) help in the requirement elicitation for software? Is requirement analysis and requirements elicitation is same thing?

Solution:

Effective software management plan much depends on the nature of the software itself, to be developed. The plan can only remain successful if all the scheduled activities are performed according to the timelines already decided. It has been observed that quite a high amount of projects both in developing and developed countries fail despite the organization wide process maturity. There are many factors that contribute in the successful and on time completion of the software but the most important of the phases is the requirement engineering in which requirement are to be fabricated and rectified again and again to suggest the most appropriate requirements. FAST (Facilitated Application Specification Technique) has emerged as a technology to help decrease the communication gap between the customer and the developer. The success of FAST session generally depends on the way the session is conducted by the facilitator

Requirement analysis

Requirements analysis, also called requirements engineering, is the process of determining user expectations for a new or modified product. These features, called requirements, must be quantifiable, relevant and detailed. In software engineering, such requirements are often called functional specifications. Requirements analysis is an important aspect of project management.

Requirements analysis involves frequent communication with system users to determine specific feature expectations, resolution of conflict or ambiguity in requirements as demanded by the various users or groups of users, avoidance of feature creep and documentation of all aspects of the project development process from start to finish.

Energy should be directed towards ensuring that the final system or product conforms to client needs rather than attempting to mold user expectations to fit the requirements.

Requirements analysis is a team effort that demands a combination of hardware, software and human factors engineering expertise as well as skills in dealing with people.

Requirements Elicitation

a) Standish Group listed "Lack of User Input" as most common factor of challenged projects.

b) Requirements Elicitation is the process of discovering the requirements for a system by communication with customers, system users and others who have a stake in the system development.1

c) Development teams have to take the initiative.

Requirements elicitation is concerned with where software requirements come from and how the software engineer can collect them. It is the first stage in building an understanding of the problem the software is required to solve. It is fundamentally a human activity, and is where the stakeholders are identified and relationships established between the development team and the customer. It is variously termed "requirements capture," "requirements discovery," and "requirements acquisition."

One of the fundamental tenets of good software engineering is that there is good communication between software users and software engineers. Before development begins, requirements specialists may form the conduit for this communication. They must mediate between the domain of the software users (and other stakeholders) and the technical world of the software engineer.

Question # 2:

Make comparative analysis between the GOF design pattern and GRASP design pattern with their pros and cons.

Solution:

GRASP stands for General Responsibility Assignment Software Patterns

There are several GRASP patterns. Some of them are simply good design principles, and one can argue whether they are really patterns. For example, High Cohesion and Low Coupling are two that are well known design principles and not really patterns.

The full set of GRASP patterns are:

1. Information Expert

2. Creator

3. Controller

4. Low Coupling

5. High Cohesion

6. Polymorphism

7. Pure Fabrication

8. Indirection

9. Protected Variations

I. This approach to understanding and using design principles is based on patterns of assigning responsibilities.

II. The GRASP patterns are a learning aid to help one understand essential object design, and apply design reasoning in a methodical, rational, explainable way.

III. After identifying your requirements and creating a domain model, then add methods to the software classes, and define the messaging between the objects to fulfill the requirements.

Doing:

a) Doing something itself, such as creating an object or doing a calculation

b) Initiating action in other objects

c) Controlling and coordinating activities in other objects.

Knowing:

a) Knowing about private encapsulated data

b) Knowing about related objects

c) Knowing about things it can derive or calculate

a) Interaction diagrams show choices in assigning responsibilities to objects.

b) GRASP patterns guide choices in where to assign responsibilities.

c) GRASP patterns are a codification of widely used basic principles.

d) Assign a responsibility to the information expert – the class that has the information necessary to fulfill the responsibility.

e) What is a general principle of assigning responsibilities to objects?

f) Who should be responsible for knowing/doing …?

g) Domain model (domain expert, domain analysis) to design model (software classes).

h) Any existing to any representative.

GOF design pattern

A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it.

There are many types of GOF design pattern we will discuss some of them

I. Creational Design Patterns

II. Singleton Design Pattern

III. Visitor Design Pattern

IV. Strategy Pattern

V. Command Pattern

VI. Proxy Design Pattern

Singleton Design Pattern: The Singleton pattern ensures that a class has only one instance. Provides a global point of access to that instance.

Constructor is 'PRIVATE'. This ensures that no other code in your application will be able to create an instance of this class, by using the constructor directly. Using a static method, which returns an object? Static variable, used for holding the created instance. If the instance is already there, the static method do not create a second one, instead returns the already created one. When multiple threads are introduced, you must protect the getInstance() method through synchronization. If the getInstance() method is not protected against synchronization, it is possible to return two different instances of the Singleton object. Refer to Double Checked Lock (DCL) programming pattern and Thread Local implementation for better singleton implementation in a multithreaded environment.

The Proxy Design Pattern the Proxy pattern is used when you need to represent an object that is complex or time consuming to create, by a simpler one. If creating an object is expensive in time or computer resources, Proxy allows you to postpone this creation until you need the actual object. A Proxy usually has the same methods as the object it represents, and once the object is loaded, it passes on the method calls from the Proxy to the actual object. There are several cases where a Proxy can be useful:

a) If an object, such as a large image, takes a long time to load.

b) If the object is on a remote machine and loading it over the network may be slow, especially during peak network load periods.

c) If the object has limited access rights, the proxy can validate the access permissions for that user.

The Visitor Design Pattern: The Visitor pattern turns the tables on our object-oriented model and creates an external class to act on data in other classes. This is useful when you have a polymorphic operation that cannot reside in the class hierarchy for some reason.. For example, the operation wasn't considered when the hierarchy was designed, or because it would clutter the interface of the classes unnecessarily.

The Strategy Pattern: The Strategy pattern is much like the State pattern in outline, but a little different in intent. The Strategy pattern consists of a number of related algorithms encapsulated in a driver class called the Context. Your client program can select one of these differing algorithms or in some cases the Context might select the best one for you. The intent is to make these algorithms interchangeable and provide a way to choose the most appropriate one. The difference between State and Strategy is that the user generally chooses which of several strategies to apply and that only one strategy at a time is likely to be instantiated and active within the Context class.

By contrast, as we have seen, it is possible that all of the different States will be active at once and switching may occur frequently between them. In addition, Strategy encapsulates several algorithms that do more or less the same thing, while State encapsulates related classes that each do something somewhat different. Finally, the concept of transition between different states is completely missing in the Strategy pattern.

The Command Pattern: The Chain of Responsibility forwards requests along a chain of classes, but the Command pattern forwards a request only to a specific object. It encloses a request for a specific action inside an object and gives it a known public interface. It lets you give the client the ability to make requests without knowing anything about the actual action that will be performed, and allows you to change that action without affecting the client program in any way

BNK601 Online Quiz No. 2 Announced

Quiz will cover Video lecture no. 01 to 18
Schedule
Opening Date and Time
24 Nov 2010 At 12:01 AM (Mid-Night)
Closing Date and Time
25 Nov, 2010 At 11:59 PM (Mid-Night)

24 hours extra time is not available

Dear Students!
Read the following instructions carefully before attempting the Quiz.
Instructions
l You can start attempting the quiz at any time but within given date(s) by clicking the quick link for Quiz on VU-LMS as it will become enabled within the mentioned dates. As soon as the time will be over, it will automatically be disabled and will not be available to attempt it.

l Quiz will be based on Multiple Choice Questions (MCQs). Covering Video Lectures 1 to 18.

Fin621 GDB Solution

"Suppose you are working as an accountant and the president of your firm Mr. Ali has a little back ground of accounting. This morning, he approached you and said:

"Last year we purchased a piece of land for Rs. 200,000. During this, the inflation has driven prices up by 12 %, and an expert has also just told me that we can sell this land for Rs. 300,000 whereas our balance sheet still shows the land at Rs. 200,000. It should be valued at Rs. 300,000 or at least at Rs. 224,000 (after the effect of 12% inflation)".

Identify accounting principle(s) (GAAP) applicable to this situation which negates Mr. Ali's Claim. "

Solution:

Prudence principle: when choosing between two solutions, the one that will be least likely to overstate assets and income should be picked

Cost principle requires companies to account and report based on acquisition costs rather than fair market value for most assets and liabilities. This principle provides information that is reliable (removing opportunity to provide subjective and potentially biased market values), but not very relevant. Thus there is a trend to use fair values. Most debts and securities are now reported at market values.