Monday, April 18, 2011

Visual Studio 2010 and UML(Unified Modeling Language) Part-I

Microsoft Visual Studio 2010 comes with great UML Features I will explain them in details in future post. But In this post I am going to explain the UML concepts because its necessary to understand UML concepts before moving to Visual Studio 2010 part. I know this post may sound very basic to some of people but its necessary to understand visual studio 2010 UML Features. So let’s start first basic question.

What is UML?

UML means Unified Modeling Language its a standard language for specifying, visualizing, and documenting the artifacts of software systems as well as for business modelling . UML provide a set of engineering practice that has proven successful modeling of large complex and complex systems. In UML mostly graphical notations are used for expressing design concepts of software. Using UML software development team communicate,explore and architectural design of large scale projects.

Goals and Advantages of UML

  1. Provide user a visually appealing modelling language
  2. Its provides extensibility and specialization mechanism to extend the software.
  3. Its independent of any programming language
  4. Its works better with Object Oriented Design concepts
  5. It integrates best practices

Why we need to use UML?

As you know software is now key part of any company production life cycle. Companies want to enhance their production life cycle with the help of software. So software industries are looking towards to automate the best practices,frameworks and patterns. UML language is defined to use this kind of things.

Different Type of UML Diagrams

1) Class Diagram

This diagram displays contains classes,packages and structures. It displays the relationship between them and Inheritance also.

2) Sequence Diagram

This diagram displays sequences of object and classes participating in the particular operation.

3) Use Case Diagram

This diagram displays the relationship between the actors and user cases.

4) Activity Diagram

This diagram displays the flow of the iteration. Here it describes the actions that are taken on particular objects

5) Component Diagram

This diagram displays the code component of system. It displays high level structure of code itself. It also shows dependencies among the components.

6) Layer Diagram

This diagram visualizes the logical architecture of the system.
We will explore this each Diagram in great details in forthcoming posts.

Visual Studio 2010 and UML

Microsoft Visual Studio 2010 supports the Modelling Projects from where you can create different diagrams. Like following.

ProjectDialog

After that You can add any diagrams and other components of the UML via right click project->add new item.

UMLDiagram

That’s it. We will explore all the features in great details in forthcoming posts. Stay tuned for more.. Hope this will help you..

Shout it
kick it on DotNetKicks.com
Share:
Thursday, April 14, 2011

ExpandoObject class in C# 4.0

As you know till now in c# everything was static and known at design time. But with the C# 4.0 language Microsoft have enabled new dynamic data type which is belongs to Dynamic Language Runtime on top of CLR(Common language Runtime). As you know that dynamic object will know their behaviour at run time. Here Microsoft has given one new class called ExpandoObject class. ExpandoObject class is a member of System.Dynamic namespace and is defined in the System.Core assembly. This class object members can be dynamically added and removed at runtime. This is class is a sealed class and implements number of interfaces like below.

public sealed class ExpandoObject :
IDynamicMetaObjectProvider,
IDictionary<string, object>,
ICollection<KeyValuePair<string, object>>,
IEnumerable<KeyValuePair<string, object>>,
IEnumerable,
INotifyPropertyChanged;

Now let’s take a simple example of console application. Where we will create a object of expandoobject class and manipulate that class at run time. Let’s create a simple code like below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExpandoObject
{
class Program
{
    static void Main(string[] args)
    {
        dynamic users = new System.Dynamic.ExpandoObject();
        users.UserName = "Jalpesh";
        users.Password = "Password";

        Console.WriteLine(string.Format("{0}:{1}","UserName:",users.UserName));
        Console.WriteLine(string.Format("{0}:{1}","Password:",users.Password));

        Console.ReadKey();
    }
}
}

Here in the above code I have added a new memeber called UserName and Password for the new dynamic user type and then print their value. Now let’s run the application and see its output as below

ExpandoObject

That’s it. You can add valid type of member to ExpandoOjbect class. Isn’t interesting.. Hope you liked it.. Stay tuned for more..

Shout it

kick it on DotNetKicks.com
Share:
Wednesday, April 13, 2011

Variable Reference Code Highlighting and Hide selection features of Visual Studio 2010.

Microsoft Visual studio 2010 is a Great IDE(Integrated Development Environment) and I am exploring everyday something new in this blog post , I am also going to explore something new with Visual Studio 2010. There are two more new features that can make developers life easier. Let’s explore that in detail.

Variable Reference Code Highlighting

It’s a new feature there in Visual studio 2010. Whenever you put the cursor on the variable it will highlight all the code where that variable used. This is a very nice features as within one shot we can see what is done with that variable in code just like following.

VariableRefeferene

Hiding selected code in Visual Studio 2010

In earlier version of Microsoft Visual Studio We can collapse the method and region. But you can not collapse the particular code block but with Visual Studio 2010 code you can hide the particular selected code via right click outlining –>Hide Selection and you can highlight code lets see first following code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Blogging
{
 public partial class _Default : System.Web.UI.Page
 {
     protected void Page_Load(object sender, EventArgs e)
     {
         if (Page.IsPostBack)
         {
             Response.Write("Page is not postback");
         }

         for (int i = 1; i <= 20; i++)
         {
             Response.Write(i.ToString());
         }
     }
 }
}

Now I want to hide the following Page.IsPostBack part via right click Outlining –> Hide Selection

CodeHiding

As you can see in above image there is –(Minus) Icon so you can collapse that code Just like region. Now you want to undo the collapsing then once again you need to select the code in editor and then right click and then select Outlining->Stop Hiding Current and then it will be treated as normal code with out collapsible block Like below.

UndoSelection

That’s it hope you liked it.. Stay tuned for more.. Happy programming..

Shout it

kick it on DotNetKicks.com
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews