Wednesday, 17 July 2013

Agile Methodology

Agile Methodology

What Is Agile?

Agile methodology is an alternative to traditional project management, typically used in software development. It helps teams respond to unpredictability through incremental, iterative work cadences, known as sprints. Agile methodologies are an alternative to waterfall, or traditional sequential development.

What is Scrum?

Scrum is the most popular way of introducing Agility due to its simplicity and flexibility. Because of this popularity, many organizations claim to be “doing Scrum” but aren’t doing anything close to Scrum’s actual definition. Scrum emphasizes empirical feedback, team self management, and striving to build properly tested product increments within short iterations. Doing Scrum as it’s actually defined usually comes into conflict with existing habits at established non-Agile organizations.
Scrum has only three roles: Product Owner, Team, and Scrum Master. These are described in detail by the Scrum Training Series. The responsibilities of the traditional project manager role are split up among these three Scrum roles. Scrum has five meetings: Backlog Grooming (aka Backlog Refinement), Sprint Planning, Daily Scrum (aka 15-minute standup), the Sprint Review Meeting, and the Sprint Retrospective Meeting.
Many books and classes are available from a variety of competing sources of varying accuracy and quality.  One place to start would be the Scrum Training Series, which uses an entertaining approach to cover the most popular way of introducing Agile to teams. You can also download the 6-page illustrated Scrum Reference Card.

Where Did Agile Come From?

In 1970, Dr. Winston Royce presented a paper entitled “Managing the Development of Large Software Systems,” which criticized sequential development. He asserted that software should not be developed like an automobile on an assembly line, in which each piece is added in sequential phases. In such sequential phases, every phase of the project must be completed before the next phase can begin. Dr. Royce recommended against the phase based approach in which developers first gather all of a project’s requirements, then complete all of its architecture and design, then write all of the code, and so on. Royce specifically objected to this approach due to the lack of communication between the specialized groups that complete each phase of work.
It’s easy to see how the “waterfall” methodology is far from optimized compared to agile methodology. First of all, it assumes that every requirement of the project can be identified before any design or coding occurs. Put another way, do you think you could tell a team of developers everything that needed to be in a piece of software before it was up and running? Or would it be easier to describe your vision to the team if you could react to functional software? Many software developers have learned the answer to that question the hard way: At the end of a project, a team might have built the software it was asked to build, but, in the time it took to create, business realities have changed so dramatically that the product is irrelevant. In that scenario, a company has spent time and money to create software that no one wants. Couldn’t it have been possible to ensure the end product would still be relevant before it was actually finished?

Why Agile?

Agile development methodology provides opportunities to assess the direction of a project throughout the development lifecycle. This is achieved through regular cadences of work, known as sprints or iterations, at the end of which teams must present a potentially shippable product increment. By focusing on the repetition of abbreviated work cycles as well as the functional product they yield, agile methodology is described as “iterative” and “incremental.” In waterfall, development teams only have one chance to get each aspect of a project right. In an agile paradigm, every aspect of development — requirements, design, etc. — is continually revisited throughout the lifecycle. When a team stops and re-evaluates the direction of a project every two weeks, there’s always time to steer it in another direction.
The results of this “inspect-and-adapt” approach to development greatly reduce both development costs and time to market. Because teams can develop software at the same time they’re gathering requirements, the phenomenon known as “analysis paralysis” is less likely to impede a team from making progress. And because a team’s work cycle is limited to two weeks, it gives stakeholders recurring opportunities to calibrate releases for success in the real world. Agile development methodology helps companies build the right product. Instead of committing to market a piece of software that hasn’t even been written yet, agile empowers teams to continuously replan their release to optimize its value throughout development, allowing them to be as competitive as possible in the marketplace. Development using an agile methodology preserves a product’s critical market relevance and ensures a team’s work doesn’t wind up on a shelf, never released.

Wednesday, 26 June 2013

Introduction to LINQ Queries (C#)

A query is an expression that retrieves data from a data source. Queries are usually expressed in a specialized query language. Different languages have been developed over time for the various types of data sources, for example SQL for relational databases and XQuery for XML. Therefore, developers have had to learn a new query language for each type of data source or data format that they must support. LINQ simplifies this situation by offering a consistent model for working with data across various kinds of data sources and formats. In a LINQ query, you are always working with objects. You use the same basic coding patterns to query and transform data in XML documents, SQL databases, ADO.NET Datasets, .NET collections, and any other format for which a LINQ provider is available.
All LINQ query operations consist of three distinct actions:
  1. Obtain the data source.
  2. Create the query.
  3. Execute the query.
The following example shows how the three parts of a query operation are expressed in source code. The example uses an integer array as a data source for convenience; however, the same concepts apply to other data sources also. This example is referred to throughout the rest of this topic.
class IntroToLINQ
{        
    static void Main()
    {
        // The Three Parts of a LINQ Query: 
        //  1. Data source. 
        int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };

        // 2. Query creation. 
        // numQuery is an IEnumerable<int> 
        var numQuery =
            from num in numbers
            where (num % 2) == 0
            select num;

        // 3. Query execution. 
        foreach (int num in numQuery)
        {
            Console.Write("{0,1} ", num);
        }
    }
}
The following illustration shows the complete query operation. In LINQ the execution of the query is distinct from the query itself; in other words you have not retrieved any data just by creating a query variable.
Complete LINQ Query Operation
In the previous example, because the data source is an array, it implicitly supports the generic IEnumerable<T> interface. This fact means it can be queried with LINQ. A query is executed in a foreach statement, and foreach requires IEnumerable or IEnumerable<T>. Types that support IEnumerable<T> or a derived interface such as the generic IQueryable<T> are called queryable types.
A queryable type requires no modification or special treatment to serve as a LINQ data source. If the source data is not already in memory as a queryable type, the LINQ provider must represent it as such. For example, LINQ to XML loads an XML document into a queryable XElement type:
// Create a data source from an XML document. 
// using System.Xml.Linq;
XElement contacts = XElement.Load(@"c:\myContactList.xml");
With LINQ to SQL, you first create an object-relational mapping at design time either manually or by using the Object Relational Designer (O/R Designer). You write your queries against the objects, and at run-time LINQ to SQL handles the communication with the database. In the following example, Customers represents a specific table in the database, and the type of the query result, IQueryable<T>, derives from IEnumerable<T>.
Northwnd db = new Northwnd(@"c:\northwnd.mdf");

// Query for customers in London.
IQueryable<Customer> custQuery =
    from cust in db.Customers
    where cust.City == "London"
    select cust;
For more information about how to create specific types of data sources, see the documentation for the various LINQ providers. However, the basic rule is very simple: a LINQ data source is any object that supports the generic IEnumerable<T> interface, or an interface that inherits from it.
NoteNote
Types such as ArrayList that support the non-generic IEnumerable interface can also be used as a LINQ data source. For more information, see How to: Query an ArrayList with LINQ.
The query specifies what information to retrieve from the data source or sources. Optionally, a query also specifies how that information should be sorted, grouped, and shaped before it is returned. A query is stored in a query variable and initialized with a query expression. To make it easier to write queries, C# has introduced new query syntax.
The query in the previous example returns all the even numbers from the integer array. The query expression contains three clauses: from, where and select. (If you are familiar with SQL, you will have noticed that the ordering of the clauses is reversed from the order in SQL.) The from clause specifies the data source, the where clause applies the filter, and the select clause specifies the type of the returned elements. These and the other query clauses are discussed in detail in the LINQ Query Expressions (C# Programming Guide) section. For now, the important point is that in LINQ, the query variable itself takes no action and returns no data. It just stores the information that is required to produce the results when the query is executed at some later point. For more information about how queries are constructed behind the scenes, see Standard Query Operators Overview.
Note Note
Queries can also be expressed by using method syntax. For more information, see Query Syntax and Method Syntax in LINQ (C#).
As stated previously, the query variable itself only stores the query commands. The actual execution of the query is deferred until you iterate over the query variable in a foreach statement. This concept is referred to as deferred execution and is demonstrated in the following example:
//  Query execution.  
foreach (int num in numQuery)
{
    Console.Write("{0,1} ", num);
}
The foreach statement is also where the query results are retrieved. For example, in the previous query, the iteration variable num holds each value (one at a time) in the returned sequence.
Because the query variable itself never holds the query results, you can execute it as often as you like. For example, you may have a database that is being updated continually by a separate application. In your application, you could create one query that retrieves the latest data, and you could execute it repeatedly at some interval to retrieve different results every time.
Queries that perform aggregation functions over a range of source elements must first iterate over those elements. Examples of such queries are Count, Max, Average, and First. These execute without an explicit foreach statement because the query itself must use foreach in order to return a result. Note also that these types of queries return a single value, not an IEnumerable collection. The following query returns a count of the even numbers in the source array:
var evenNumQuery = 
    from num in numbers
    where (num % 2) == 0
    select num;

int evenNumCount = evenNumQuery.Count();
To force immediate execution of any query and cache its results, you can call the ToList<TSource> or ToArray<TSource> methods.
List<int> numQuery2 =
    (from num in numbers
     where (num % 2) == 0
     select num).ToList();

// or like this: 
// numQuery3 is still an int[] 

var numQuery3 =
    (from num in numbers
     where (num % 2) == 0
     select num).ToArray();
You can also force execution by putting the foreach loop immediately after the query expression. However, by calling ToList or ToArray you also cache all the data in a single collection object.

Tuesday, 25 June 2013

Getting started with CEBP

To get started, IT buyers need to do two things. The first is to start your UC deployment -- but do not choose a vendor based on who your VoIP or email vendor is. Instead, think of UC as a development platform, and choose your vendor based on its ability to integrate into your current application infrastructure and business processes.
The second task is to evaluate your business processes and understand which ones will benefit most from being communications-enabled. These are typically the ones with the highest amounts of human latency. Taking a platform approach, coupled with an understanding of the business process benefits, will create a higher likelihood of a successful deployment.

CEBP helps companies be more efficient

Communications-enabled business processes enable most companies to be much more agile than they have been before. Organizations can deliver critical information to anyone in the extended enterprise at any time, over any device in real time, ultimately saving companies huge amounts of time. For organizations that have adopted CEBP, many processes that previously took hours to complete can now be completed in minutes. CEBP allow organizations to make faster, more accurate decisions. This will lead to a more efficient workforce, higher productivity and even, in many cases, higher customer satisfaction.
Companies will vary in deciding which elements of UC to deploy and which processes to communications-enable. There is no company that should integrate all elements of UC into all processes, but most companies will integrate some of the elements. These are the elements of UC most likely to be used in a CEBP:
  • Presence -- This allows the process to understand which individuals are available and how to reach them. This is the main reason I feel presence is the key foundational element of UC, not VoIP.
  • Email and messaging -- This will be the most common method of delivering information to the key individuals.
  • Integration into a skills database, customer information or other data source -- An additional source of information can be used to refine the decision the CEBP makes.
  • Mobile extension -- This will allow information to be delivered to devices and users that are not tied to a desktop.
Other components such as voice, video, conferencing and chat will also be used to allow users to communicate with one another, but the use will be dictated by the process.

Defining a communications-enabled business process (CEBP)

A "communications enabled business process" is just what the phrase describes -- it's a business process that is enabled because communications has been embedded into it. One way to understand this is to think of the concept of a "Web-enabled business process." While we don't call it that specifically, there are many processes that are more efficient or entirely possible only because of the Web. Similarly, over the next few years, organizations will streamline and then subsequently create new business processes that are wrapped around communications.
CEBP combines all the capabilities of UC with the world of business applications. In this phase of UC, Web services and service-oriented architecture (SOA) become the means by which communications and business applications converge. A CEBP can be something as simple as a transfer of information or as complex as an organization's supply chain being modified because real-time communications is now being fed into it.
An example of a CEBP would be the process of finding an expert to answer a question. This can be streamlined by calling a network-based service that uses a combination of presence, customer information and business rules to locate the best person and contact him across any mode of communication. In many cases, this could be a fully automated process removing all of the human latency.
This might occur in a hospital environment where a medical alarm creates the need for a specialist. Historically, this could require an attendant to search through many systems to find the right individual and then call specific individuals until one is located. With a CEBP, the system would automatically know who was available, on which device and what presence status, and then a message could automatically be sent alerting the specialist that there is a need for his or her skills. In a medical environment, this precious time could be the difference between life and death. Not all CEBP will be this dramatic, but it could be the difference between a manufacturer being able to fulfill an order or a retailer being able to replenish inventory for the holiday season.

Understanding communications-enabled business processes (CEBP) with unified communications

Unified communications (UC) has gone through several market transitions since its inception. Over the past few years, we've heard terms like "integrated communications," "IP communications" and "unified communications and collaboration" as terms that further the definition of UC. The latest evolution of UC is something known as communications-enabled business processes (CEBP). But CEBP needs to be better understood to have it be more broadly adopted.

Glossary (UCMA 4.0 SDK)

Term
Definition
Activated Conference
A conference that has at least one participant. A conference becomes activated when the first participant joins the conference. Conferences are deactivated after the last participant leaves the conference. Any conference properties that have changed while the conference was activated are lost after the conference is deactivated.
ApplicationEndpoint
An endpoint type that is principally used by server applications, and that provides communication and collaboration services for end users. An ApplicationEndpoint is designed for high availability and resiliency against dialog route failure and is trusted by Lync Server 2013. Because an ApplicationEndpoint is trusted, an application using this endpoint type must be provisioned before it is deployed. Provisioning ensures that the relevant information needed for the application and Lync Server 2013 is in persistent stores such as Active Directory and the Central Management Store (used by Lync Server 2013).
The trust relationship that an ApplicationEndpoint has with Lync Server 2013 makes it possible for any Lync Server 2013 Front End server to reach such an endpoint directly, which makes an ApplicationEndpoint more reliable than a UserEndpoint. If the preferred registrar of a UserEndpoint ceases operation, up to two minutes can elapse before other servers can be made aware of the problem. Although an ApplicationEndpoint is more reliable than a UserEndpoint, there are some operations that a UserEndpoint can perform that an ApplicationEndpoint cannot. For example, an ApplicationEndpoint cannot publish presence or schedule conferences on behalf of another user, or receive calls for specific users. For these purposes, an application must use a UserEndpoint object in conjunction with a trusted server platform.
An ApplicationEndpoint can also be used for some limited scenarios that do not involve Lync Server 2013.
Back-to-Back User Agent
A back-to-back user agent allows one party (typically known as the call controller) to set up and manage communication between two or more other parties. A back-to-back user agent is also known as a third-party call control (3PCC) in telephony.
Branch Office (BO)
In unified communications terminology, any remote location other than the Data Center that hosts the user agent for communications.
Browser
The object that sets up an audio user interface that callers use to communicate with (“browse”) an IVR application, which is composed of one or more VoiceXML documents. A VoiceXML Browser contains a VoiceXML interpreter and includes APIs that provide access to telephony and audio resources that facilitate communication with a caller. The terms “Browser” and “VoiceXML Browser” are used interchangeably in this documentation.
Call
A communication session between the local endpoint and a remote endpoint. The Call abstract class provides the base class implementation needed to handle a Session Description Protocol (SDP)-based communication session. The SDP is used to negotiate media characteristics between the two endpoints. The base Call class implements the common functionality that is independent of the media types involved, and this functionality can be leveraged by derived classes. InstantMessagingCall and AudioVideoCall are two subclasses that are provided by the Microsoft Unified Communications Managed API 4.0 for instant messaging and audio-video sessions. A call always belongs to a conversation.
The Call, MediaProvider, and MediaFlow abstract classes are the building blocks of the communication framework. A developer can create classes that are derived from these abstract classes to extend the UCMA platform, to establish a media channel between two endpoints for arbitrary media types.
CallFactory
A call factory is used to create a call to handle a collection of media types. By default, the UCMA platform incorporates two call factories to handle the creation of InstantMessagingCall and AudioVideoCall instances. An application can remove these factories or add new custom call factories, although call factories that are registered with the platform cannot overlap in the media types supported. For simplicity, only incoming sessions with active media types that are supported by a registered call are exposed to the application. Incoming sessions with media types not supported by a registered call are rejected automatically by the UCMA platform.
Call Admission Control (CAC)
Industry-standard terminology for controlling the creation of new calls, based on business rules (policy) that are coordinated through a policy distribution point (PDP) and enforced by a policy enforcement point (PEP). Call Admission Control can be used to manage bandwidth usage in an organization.
Call Parking
A user involved in a two party audio call can park a call at a Call Park server so that the call can be retrieved at another device or by another user. Typically, the user who parks the call is given an "orbit" number that uniquely identifies the parked call. The call can be retrieved by any user who has the orbit number. The user whose call is parked typically hears music while waiting for someone to retrieve the call. The Call Park server provides the means for users to be able to park and retrieve calls. This concept is typically applied to audio calls, but can be extended to other media types when appropriate.
CollaborationPlatform
The CollaborationPlatform class is the foundational class for any application built using UCMA. This class is used to initialize the platform with such settings as listening port, the certificate to be used, and the list of trusted servers or domains. It is responsible for managing connections between servers (connection pooling, connection throttling), establishing trust with Lync Server 2013 computers, and providing extensibility to calls of different modalities, such as audio and instant messaging.
A CollaborationPlatform instance represents one SIP stack instance. An application cannot create an endpoint without first creating a collaboration platform. Although a single platform instance is sufficient for most applications, it is possible to create multiple instances of the platform. Typically, this is useful for supporting Mutual TLS and TCP for connections. Creating more than a small number of platform instances is not recommended because memory consumption increases significantly with each instance.
There are two types of collaboration platform that are available. A client platform can be used for quick prototyping or to develop a tool to simulate a large number of client instances that target an application server. This is useful to measure the performance of an application server built using the UCMA platform. A server platform is typically used for a production application that might run on multiple servers. The server platform enables sharing of connections across multiple endpoints and enables the application to accept incoming connections from trusted sources. To create an application that is trusted by Lync Server 2013, it is important to provision the application so that persistent information for the trust relationship is created in persistent stores such as the Active Directory or Central Management Store. A trusted application server can create application endpoints or user endpoints that are not challenge for user credentials.
Conference
A conference represents an online meeting place for participants to discuss topics of interest, using one or more media types, such as instant messaging or audio-video. A conference organizer typically schedules a conference in advance by using a Web application or add-in tools for e-mail programs such as Microsoft Outlook. An impromptu or ad hoc conference can also be created. A conference becomes active when the first participant joins the conference. Conference participants who are neither leaders nor the organizer are called attendees. A conference leader typically has more control over a conference than an attendee. For example, only leaders have the ability to mute all participants or admit or deny entrance to users who are in the conference lobby.
Conference Leader
A conference participant who is able to can perform certain privileged operations on an activated conference. However, a conference leader cannot eject the conference organizer from the organizer’s own conference.
A pre-invited leader is a participant whom the conference organizer has designated as a leader, when the conference is being scheduled. Such a person becomes a leader when he or she joins an active conference.
Conference Lobby
A conference can be controlled by the organizer or presenter so that new users who join the conference are placed in a virtual Conference Lobby instead of being directly connected to the conference. The Leader has the ability to see those users in the lobby and can selectively admit certain users from the lobby into the conference, and deny admission to others.
Lobby participants are unable to admit themselves into the conference or perform conference commands such as mute, unmute, lock, unlock, and others.
Conference Organizer
The person who schedules the conference. A conference organizer always joins his or her conference as a conference leader. A conference can be cancelled or modified only by its organizer.
ConferenceServices
The ConferenceServices class offers a variety of services related to the management of conferences before they become active. Users can create a scheduled conference, modify an existing conference before it becomes active, or delete a previously scheduled conference.
ConferenceSession
The ConferenceSession class can be used for joining either an ad hoc conference or a scheduled conference. The conference is hosted by the Focus, which is responsible for enforcing conference policies as specified by the conference organizer. The conference session allows a user to perform a variety of operations within a conference to change the characteristics of an active conference. For example, the leader of the conference can eject a participant or can lock the conference to prevent new participants from joining it. Lync Server 2013 uses the Centralized Conferencing Control Protocol (C3P) for implementing the primitives needed for the conference.
Contact
A contact is usually another user who has the ability to use real-time communications, but can also be an application, such as a "bot" or a Help Desk service.
Users of real-time communications often maintain a list of "buddies" (or contacts in Lync Server 2013 terminology) with whom they frequently communicate. Every contact has a uniquely identifiable SIP URI and display name, as well as other attributes.
The contact list can exist in different stores such as e-mail servers or Communications Server backend stores. UCMA provides an API for managing contacts that are stored in the Lync Server 2013 backend stores. An application written using UCMA can use other mechanisms as well, if necessary.
An application can organize its contacts into contact groups, and usually subscribes to the presence (the online state of the contact) of users in a contact list.
A contact is different from an Active Directory contact object.
Contact Group
A contact group is a logical group of contacts controlled by the user.
ContactGroupServices
The ContactGroupServices class contains methods that can be used to add, delete, or update contacts and groups. The class is available only to UserEndpoint instances. It is not available to ApplicationEndpoint instances.
Conversation
A conversation represents a multi-party, multi-modal communication context between a local participant and one or more remote participants. A conversation involving only one remote participant is called a two-party conversation. The Conversation class manages and coordinates between components such as calls, the conference session, MCU sessions, and media providers that are needed for the communication experience. A conversation that involves more than two participants involves a conference session. A two-party conversation is normally escalated into a conference when it is desired to add a new participant or a new modality that requires the services of an MCU.
Contact Object
An Active Directory contact object represents a communication and collaboration-enabled service. Similar to a user object, an Active Directory contact object is assigned a SIP URI, Display Name, and telephone number, and belongs to an Lync Server 2013 pool.
An application can also have a dedicated SIP URI assigned to it based on an Active Directory contact object entry for the application, similar to an end user having a SIP URI in the Active Directory user object that represents the user. Note that an Active Directory contact object is unrelated to a contact.
ConversationParticipant
A conversation participant represents an information worker or a communication-enabled service (local or remote) engaged in a conversation. It exposes properties of a participant such as the URI, network source, phone URI, and endpoints of the participant in the conversation.
DNS Load Balancing
Hardware load balancers are typically used to balance the load among a set of computers that are configured behind the load balancer. Because configuring hardware load balancers can be difficult at times, the UCMA platform supports Domain Name System (DNS) load balancing to avoid the use of hardware load balancers. In DNS load balancing, a set of IP addresses are assigned to a specific fully-qualified domain name (FQDN). The UCMA platform distributes all calls to the given FQDN among the various computers who share that FQDN (but have different IP addresses).
DTMF (Dual-Tone Multi-Frequency)
Tones produced by touching keys on a phone. IVR applications may allow a caller to provide information by speaking or by entering touch tones, or both.
Enhanced Presence
The presence information as represented by category instances supported by Lync Server 2013. The enhanced presence data model provides the presence publisher with a more flexible and more granular control of how presence can be tracked by other users.
Enhanced Presence Schema
An XML schema that defines the structure of enhanced presence data represented by the value of a category instance as XML elements and attributes. The schema helps an application create, parse, and validate the enhanced presence data before publication, or after receiving a fresh set of information as the result of a subscription.
Focus
In Lync Server 2013, the Focus represents an active conference. The Focus is created when the first user joins the conference. The Focus is responsible for authenticating users, supplying the roster, and enabling indirect communication with Multipoint Controller Units (MCUs) that support different media types, such as an AudioVideo MCU, an InstantMessaging MCU, or a Data MCU. The Focus is responsible for ensuring that conference policies and settings are followed by all participants of a conference.
Focus Factory
In Lync Server 2013, the Focus Factory is a component that offers conference creation, conference deletion, and conference update services for users. The ConferenceServices class communicates with the Focus Factory to offer its services.
GRUU
A Globally Routable Unique URI (GRUU) represents a URI that can be used to uniquely address an endpoint or an application process in the Lync Server 2013 infrastructure. When an endpoint registers with Lync Server 2013, it is dynamically assigned a GRUU (a registered GRUU) that can be used to route messages to that specific endpoint.
An application that is provisioned so that it is trusted by Lync Server 2013 also is assigned a static GRUU in the back end storage used by the server. This static GRUU uniquely addresses a specific process on a machine. A message that is routed by Lync Server 2013 to the process using this static GRUU can have additional information that identifies an endpoint that is hosted in that process. The UCMA platform uses this additional information to route the message to that specific endpoint. If the additional information is not present, special rules are used to route the message to an endpoint, if possible. For example, if an application endpoint is designated as the default endpoint (by a value of true in its IsDefaultRoutingEndpoint property), messages without the additional endpoint-specific information are routed to this endpoint.
If an endpoint is registered and has a registered GRUU assigned to it, and the platform has a static GRUU assigned to it, the registered GRUU is used only for operations related to presence publication. The static GRUU is used for all other operations.
Grammar
A list of words or phrases that an application will recognize. A VoiceXML application might use multiple grammars, each of which defines what a user can say for a portion of a call. Other grammars might be active across multiple portions of a call.
A grammar can assign meanings to words, typically assigning the same meaning to multiple words. For example, the spoken words “Yes”, “Yup”, “Yeah”, “You Bet”, and “Affirmative” can all be given the meaning “Yes”.
UCMA 4.0 supports XML-format grammars that conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0. Grammars may be included inline in a VoiceXML document, or may be separate files that the VoiceXML document references with links.
Host Application
A .NET application that contains a Browser and can process the markup language in VoiceXML documents.
LocalEndpoint
An endpoint represents the basic communication unit needed by a user or application to perform any meaningful operations in the UCMA. An endpoint is created in the context of a collaboration platform. The UserEndpoint and ApplicationEndpoint classes are two subclasses of the LocalEndpoint class.
LocalOwnerPresence
The LocalOwnerPresence class can be used to manage the presence of the local (self) presentity. A presentity can use this class to publish presence categories, subscribe to self presence notifications, and assign and manage access control lists.
McuSession
A multipoint controller unit (MCU) is a server component that offers media specific services in a conference. For example, an AudioVideo MCU is useful for mixing audio of the participants in a conference. In the UCMA 4.0 SDK, the McuSession class is the base class that provides services to control an MCU. The InstantMessagingMcuSession and AudioVideoMcuSession classes are concrete platform implementations that extend the McuSession class. MCU-specific commands such as ejecting a user from a specific MCU or requesting the MCU to send an invitation to a specific user (dial-out) can be issued using this class. An McuSession subclass instance cannot exist without a supporting ConferenceSession instance because communication with the MCU happens through the Focus.
MediaFlow
The MediaFlow abstract class represents a media channel that is created as a result of offer/answer exchange in a call. A media flow is created and managed by a media provider that is bound to a conversation. When a media flow is created, an application can configure the flow settings that are used when it generates the SDP needed for the invitation. The InstantMessagingFlow and AudioVideoFlow classes are platform-supplied concrete implementations of a media flow.
The Call, MediaProvider, and MediaFlow abstract classes are the building blocks of the communication framework. A developer can create classes that are derived from these abstract classes to extend the UCMA platform, to establish a media channel between two endpoints for arbitrary media types.
When a call is used to provide back-to-back services (also called third-party call control, or 3PCC), the provider bound to the call does not create the MediaFlow, because the media does not flow through the local endpoint.
MediaProvider
A media provider represents the media platform that offers support for a specific media type. The MediaProvider abstract class is the base class that must be derived from by media providers to extend media support for typical applications. The UCMA includes AudioVideoProvider and InstantMessagingProvider class implementations to enable the consumption of the audio and message media types. An application does not need to create or deal with provider instances directly. The media provider implementations built into the UCMA for audio and instant messaging are internal and cannot be accessed by the application.
The Call, MediaProvider, and MediaFlow abstract classes are the building blocks of the communication framework. A developer can create classes that are derived from these abstract classes to extend the UCMA 4.0 platform, to establish a media channel between two endpoints for arbitrary media types.
MediaProviderFactory
A media provider factory is used to create media providers. By default, the collaboration platform supports the creation of platform-supported media providers to handle calls. An application that is intended to support a custom media type should register a factory instance that is responsible for creating an appropriate MediaProvider type to handle the custom media type.
Player
An audio device in UCMA 4.0 that plays a pre-recorded audio file to communicate with a caller.
Pool
A collection of one or more computers that are affiliated with a site and serve as an installation point for a service role. All computers in a pool are homogeneous in nature (the service roles installed on all of the computers in the cluster are identical). For example, a pool for Lync Server 2013 can have a pool FQDN assigned to it that points to one or more Front End servers to enable load balancing.
Presence Category
Provides the basic identification of the kind of data that is published. A category name is an identifier of the contract between publisher and subscriber. It identifies the nature of the published data, and implies an agreed-upon schema for how the data should be interpreted. Some of the predefined categories in Lync are note, contactCard, calendarData, state, and device.
A presence category represents a type to capture specific Rich Presence Data. A number of categories are defined and used in the Lync Server 2013 infrastructure. Some of the categories are Note, ContactCard, CalendarData, UserState, and DeviceState. Each category has metadata that is interpreted by Lync Server 2013 and includes such data as Category Name, expiry time, and instance ID. In addition, a category instance carries actual data for that category that is used and interpreted by some server components and clients. Each category has well defined XML schema and semantics associated with the various fields.
Presence Category Expiry Policy
Indicates the lifetime of a category publication. The publication lasts until it is unpublished.
Presence Category Instance
Enables the publication of the same category of data multiple times by the same publisher.
It is sometimes desirable to publish multiple instances of a specific presence category from one or more endpoints. Each publication carries a presence category instance that uniquely identifies the specific instance that is published. When a single instance across all of a user’s endpoints is to be published, a predefined instance number (such as 0) can be used for the publication. For example, an offline presence note is published by all endpoints using a specific instance ID.
Presence Category Version
Allows multiple clients that publish the same category instance to synchronize themselves. Each published item has a server-maintained version number. The publication is updated only if the publisher presents the current version number. The version number is then incremented atomically with the data update by the server.
Presence Container
A data structure that holds a set of published items and a membership list describing who can see those items. A presence container allows a publisher to publish different data values of the same category and instance for the purpose of allowing different subscribers to see different values. Containers are identified by container IDs. A set of well-known containers is defined for use by the Lync Server 2013 infrastructure.
Presence Document
The XML data that is defined by a schema and represented by the document object model (DOM). The presence document is used in the publication and subscription of enhanced presence.
Presence Information Document Format (PIDF)
This commonly used data format represents presence based on the rules specified in RFC 3863, and is used by Lync Server 2013 when presence notifications are delivered to a PIC user.
Presence Publication
A user publishes his or her presence data to inform other users that he or she is willing, available, or even able to communicate or collaborate with them. With Lync Server 2013, presence publication can be thought of as placing specified category instances in the appropriate category containers, at a specified membership scope.
Presence View
The RemotePresenceView class can be used to subscribe to remote presentities either persistently or through polling at possibly different intervals. Using this class, and application can obtain up-to-date presence information as often as it specifies. For example, the Contacts list should be a persistent subscription, updated immediately. In contrast, a conference call with two other participants does not need immediate update information, and can be set to poll every five minutes. The RemotePresenceView class is an alternative to the RemotePresence class.
The RemotePresenceViews maintains a list of active RemotePresenceView objects.
Presentity
An application or user whose presence information can be tracked. A presentity registers its status, location, and other attributes with Lync Server 2013.
Public Internet Cloud (PIC) User
A user on a public internet cloud service provider, such as MSN, AOL, or Yahoo!.
Publisher
A user who publishes his or her presence for the use of other users who subscribe to it. The enhanced presence model allows a publisher to publish presence in a more flexible way to control how the specified presence data can be received by different subscribers.
Recorder
An audio device in UCMA 4.0 that captures audio and records it to a file.
Session
Represents the contents of a phone call between a single user and an IVR application. A session begins when the hosting .NET application launches a Browser instance to process the documents in a VoiceXML application in response to an incoming phone call. A session ends when the Browser exits a VoiceXML document.
Session Description Protocol (SDP)
An RFC-based protocol that describes the offer/answer payload format for an INVITE-based session to indicate a variety of information such as the media types for the session, the codec formats that are supported, the bandwidth information, and security properties. For more information, see RFC 4566.
Session Initiation Protocol (SIP)
An RFC-based protocol for real-time communications, supported by Lync and Lync Server 2013. The UCMA platform supports SIP-based message abstractions. For more information, see RFC 3261.
Speech Recognition
The conversion of spoken words into text. UCMA 4.0 uses the speech recognition engines in Microsoft.Speech to match speech or keypad tones from callers to lists of acceptable input. Lists of acceptable input are contained in a grammar, see above. Speech recognition is also referred to as SR or ASR (automatic speech recognition).
Speech Synthesis
The conversion of text to computer-generated spoken words. Also known as text-to-speech (TTS). UCMA 4.0 uses the speech synthesis engines in Microsoft.Speech to speak text as instructed by a VoiceXML application. Speech Synthesis is also known as text-to-speech (TTS). An instruction to speak text in a VoiceXML application is also known as a prompt.
Subscriber
A presentity who subscribes to presence data published by another presentity. This documentation uses subscriber and watcher interchangeably.
Subscription
A long-lived session in which a presentity receives published presence data that the presentity has subscribed to. A presentity can elect to subscribe to its own presence data or to the presence data of remote presentities.
Tone Controller
An audio device in UCMA 4.0 that can receive or send telephone keypad tones during a call.
Uniform Resource Identifier (URI)
A URI represents an identity across multiple devices, either of an application or a user. URIs are used for routing in the Lync Server 2013 network. A SIP URI uses the sip scheme and a telephony URI uses the tel scheme. The UCMA supports both SIP and telephony URIs. A URI can also be used to refer to a specific device instance in advanced scenarios.
UserEndpoint
A UserEndpoint primarily represents an endpoint for a user with a SIP identity. This endpoint type enables an Information Worker to manage his or her contacts and groups, share his or her presence status, subscribe to the presence of others, schedule conferences, and communicate with others. An application can use a UserEndpoint instance to emulate an end user or to emulate large numbers of test clients in order to stress test an application built using the platform. A UserEndpoint instance must be used in conjunction with Lync Server 2013, because it depends on a variety of features and protocols supported by Communications Server.
Unlike an ApplicationEndpoint, a UserEndpoint is not automatically trusted, and must register with Lync Server 2013 components. This registration requirement has an impact on the reliability of the UserEndpoint in some scenarios. For more information, see the ApplicationEndpoint entry in this glossary.
VoiceXML Document
An XML-format file that contains markup language that conforms to the VoiceXML standard. A VoiceXML document is also called a VoiceXML page, and both terms are used in this documentation. For more information about VoiceXML, see VoiceXML 2.0.
VoiceXML Interpreter
Interprets the markup language in VoiceXML documents and passes the instructions in the markup language to the Browser, which transacts the actual communication with the caller.
Watcher
A presentity who subscribes to presence data published by another presentity. This documentation uses subscriber and watcher interchangeably.

Wednesday, 29 May 2013

Interview Questions and answers : WCF and basics

Q1. What is WCF?
WCF stands for Windows Communication Foundation. It is a Software development kit for developing services on Windows. WCF is introduced in .NET 3.0. in the System.ServiceModel namespace. WCF is based on basic concepts of Service oriented architecture (SOA)
Q2. What is endpoint in WCF service?
The endpoint is an Interface which defines how a client will communicate with the service. It consists of three main points: Address,Binding and Contract.
Q3. Explain Address,Binding and contract for a WCF Service?
Address: Address defines where the service resides.
Binding: Binding defines how to communicate with the service.
Contract: Contract defines what can be done with the service.
Q4. What are the various address format in WCF?
a) HTTP Address Format:--> http://localhost:
b) TCP Address Format:--> net.tcp://localhost:
c) MSMQ Address Format:--> net.msmq://localhost:
Q5. What are the types of binding available in WCF?
A binding is identified by the transport it supports and the encoding it uses. Transport may be HTTP,TCP etc and encoding may be text,binary etc. The popular types of binding may be as below:
a)BasicHttpBinding
b)NetTcpBinding
c)WSHttpBindingl
d)NetMsmqBinding
Q6. What are the types of contract available in WCF?
The main contracts are:
a)Service Contract:Describes what operations the client can perform.
b)Operation Contract : defines the method inside Interface of Service.
c)Data Contract:Defines what data types are passed
d)Message Contract:Defines wheather a service can interact directly with messages
Q7. What are the various ways of hosting a WCF Service?
a) IIS
b) Self Hosting
c) WAS (Windows Activation Service)
Q8. WWhat is the proxy for WCF Service?
A proxy is a class by which a service client can Interact with the service.
By the use of proxy in the client application we are able to call the different methods exposed by the service
Q9. How can we create Proxy for the WCF Service?
We can create proxy using the tool svcutil.exe after creating the service.
We can use the following command at command line.
svcutil.exe *.wsdl *.xsd /language:C# /out:SampleProxy.cs /config:app.config
Q10.What is the difference between WCF Service and Web Service?
a)WCF Service supports both http and tcp protocol while webservice supports only http protocol.
b)WCF Service is more flexible than web service.
Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

Second web services are not flexible. However, WCF Services are flexible. If you make a new version of the service then you need to just expose a new end. Therefore, services are agile and which is a very practical approach looking at the current business trends.
What is .NET 3.0?
In one simple equation .NET 3.0 = .NET 2.0 + Windows Communication Foundation + Windows
Presentation Foundation + Windows Workflow Foundation + Windows Card Space.
What is WCF?
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.
First let us give a short answer to this: - “WCF (Indigo was the code name for WCF) is a
unification of .NET framework communication technologies
“.WCF is a unification technology,
which unites the following technologies:-
• NET remoting
• MSMQ
• Web services
• COM+.
What was the code name for WCF?
The code name of WCF was Indigo .
WCF is a unification of .NET framework communication technologies which unites the following technologies:-
1.Web services
2.MSMQ
3.NET remoting
4.COM+
What are the main components of WCF?
The main components of WCF are
1. Service class
2. Hosting environment
3. End point
Where we can host WCF services?
Every WCF services must be hosted somewhere. There are three ways of hosting WCF services.
They are
1. IIS
2. Self Hosting
3. WAS (Windows Activation Service)
What is service and client in perspective of data communication?
A service is a unit of functionality exposed to the world.
The client of a service is merely the party consuming the service.
What are different elements of WCF Srevices Client configuration file?
WCF Services client configuration file contains endpoint, address, binding and contract.
A sample client config file looks like

What is endpoint in WCF?
Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service. In WCF the relationship between Address, Contract and Binding is called Endpoint.

What are ends, contract, address, and bindings?
The above terminologies are the core on which SOA stands. Every service must expose one or
more ends by which the service can be available to the client. End consists of three important
things where, what and how:-
• Contract (What)
Contract is an agreement between two or more parties. It defines the protocol how client should
communicate with your service. Technically, it describes parameters and return values for a
method.
• Address (Where)
An Address indicates where we can find this service. Address is a URL, which points to the
location of the service.
• Binding (How)
Bindings determine how this end can be accessed. It determines how communications is done.
For instance, you expose your service, which can be accessed using SOAP over HTTP or
BINARY over TCP. So for each of these communications medium two bindings will be created.
Below figure, show the three main components of end. You can see the stock ticker
is the service
class, which has an end hosted on www.soa.com with HTTP and TCP binding support and using
Stock Ticker interface type.

What is binding and how many types of bindings are there in WCF?
A binding defines how an endpoint communicates to the world. A binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.

WCF supports nine types of bindings.

Basic binding
Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.

This binding is used when we need to use SOAP over HTTP. This binding
can also be configured to be used as HTTPS. It can be also configured to send data in plain text or
in optimized form like MTOM.

TCP binding
Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.
This binding sends binary-encoded SOAP, including support for reliable
message transfer, security, and transactions, directly over TCP. The biggest disadvantage of
NetTcpBinding is that both server and client should be also made in .NET language.

Peer network binding
Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.

IPC binding
Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.

Web Service (WS) binding
Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.

It is same like BasicHttpBinding. In short, it uses SOAP over HTTP. But with
it also supports reliable message transfer, security and transaction. WS-Reliable Messaging,
security with WS-Security, and transactions with WS-Atomic Transaction supports reliable
message.

Federated WS binding
Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.

Duplex WS binding
Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.

MSMQ binding
Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.

MSMQ integration binding
Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.

This binding sends binary-encoded SOAP over MSMQ. This binding can
only be used for WCF-to-WCF communication.

Which specifications does WCF follow?
WCF supports specifications defined by WS-* specifications. WS-* specifications are defined
together by Microsoft, IBM, SUN and many other big companies so that they can expose there
service through a common protocol. WCF supports all specifications defined we will understand
them one by one.
• Messaging (WS-Addressing):- SOAP is the fundamental protocol for web services. WS
Addressing defines some extra additions to SOAP headers, which makes SOAP free from
underlying transport protocol. One of the good things about Message transmission is MTOM,
also termed as Message Transmission Optimization Mechanism. They optimize transmission
format for SOAP messages in XML-Binary formant using XML optimized packaging (XOP).
Because the data will sent in binary and optimized format, it will give us huge performance
gain.
• Security (WS-Security, WS-Trust, and WS-Secure Conversation): All the three WSdefine
authentication, security, data integrity and privacy features for a service.
• Reliability (WS-Reliable Messaging): This specification ensures end-to-end
communication when we want SOAP messages to be traversed back and forth many times.
• Transactions (WS-Coordination and WS-Atomic Transaction): These two specifications
enable transaction with SOAP messages.
• Metadata (WS-Policy and WS-Metadata exchange): WSDL is a implementation of WSMetadata
Exchange protocol. WS-Policy defines more dynamic features of a service, which
cannot be expressed by WSDL.
WCF follows WS-* specifications other
languages like JAVA , C++ can also exploit features like Messaging , Security , Reliability and
transactions written in C# or VB.NET. This is the biggest achievement of WCF to integrate the
above features with other languages.

What is the difference WCF and Web services?
Web services can only be invoked by HTTP. While Service or a WCF component can be invoked
by any protocol and any transport type. Second web services are not flexible. However, Services
are flexible. If you make a new version of the service then you need to just expose a new end.
Therefore, services are agile and which is a very practical approach looking at the current
business trends.

what are the advantages of hosting WCF Services in IIS as
compared to self-hosting?
There are two main advantages of using IIS over self-hosting:-
Automatic activation
IIS provides automatic activation that means the service is not necessary to be running in
advance. When any message is received by the service it then launches and fulfills the request.
But in case of self hosting the service should always be running.
Process recycling
If IIS finds that a service is not healthy that means if it has memory leaks etc, IIS recycles the
process. For every browser instance, a
worker process is spawned and the request is serviced. When the browser disconnects the worker,
process stops and you loose all information. IIS also restarts the worker process. By default, the
worker process is recycled at around 120 minutes. So why does IIS recycle. By restarting the
worker process it ensures any bad code or memory leak do not cause issue to the whole system.
In case of self-hosting both the above features, you will need to code yourself. Lot of work
right!!.

what are the various ways of hosting a WCF service?
There are three major ways to host a WCF service:-
• Self-hosting the service in his own application domain. This we have already covered in
the first section. The service comes in to existence when you create the object of Service
Host class and the service closes when you call the Close of the Service Host class.
• Host in application domain or process provided by IIS Server.
• Host in Application domain and process provided by WAS (Windows Activation
Service) Server.

Which are the various programming approaches for WCF?/ What is one-way operation?
IsOneWay equal to true ensures that the client does not have to wait for the response. So methods
marked by IsOneWay to true should always return void. In this, the caller does not get anything