Practical Demo

Practical Demonstration For Dotnet

My New Blog

Friends and my dudes.. I have altered my blog and change its address to http://www.dotnetandwp7.blogspot.com so please go to that page and refer. In that page i'm going to post Windows phone 7 application development Articles also.. Have a Nice Day....

Thursday, June 17, 2010

.NET Initiative and the .NET

The Microsoft .NET initiative is a very wide initiative and it spans multiple Microsoft

Products ranging from the Windows OS to the Developer Tools to the Enterprise Servers.

The definition of .NET differs from context to context, and it becomes very difficult for

you to interpret the .NET strategy. This section aims at demystifying the various terminologies behind .NET from a developer’s perspective. It will also highlight the need for using this new .NET Platform in your applications and how .NET improves over itsprevious technologies.


Understanding the Existing Development Scenario
              Windows DNA is a concept for building distributed applications using the Microsoft  Windows operating system and related software products. First we will understand about the 2- tier, 3- tier and then move on to N- tier Windows DNA.

Why to divide an application into logical layers?
                Factoring an application into logical parts is useful. Breaking a large piece of software into smaller pieces can make it easier to build, easier to reuse and easier to modify. It can also be helpful in accommodating different technologies or different business organizations.



                                                Fig Showing 2 – Tier Client Server Model


Through the appearance of Local-Area-Networks, PCs came out of their isolation, and were soon not only being connected mutually but also to servers. Client/Servercomputing was born. A two-tiered application is an application whose functionality can only be segmented into two logical tiers, presentation services and data services. The presentation services of a two-tiered application are responsible for gathering informationfrom the user, interacting with the data services to perform the application's business operations, and presenting the results of those operations to the user. The Presentation services are also called the presentation layer because it presents information to the user.
                                      Things you might find in a presentation layer include a Web browser, a terminal, a custom-designed GUI, or even a character-based user interface. Client-Server architecture was a major buzzword in the early 90's, taking initially dumb terminal applications and giving them a fancy windows-like front end, using PCs with terminal emulators which presented pretty GUIs (Graphical user interface) or later Visual Basicetc front-ends. A web browser talking to a web server is an example of a client talking to a server. Here there is presentation logic (presentation tier) appening at the client, and data/file access (data access tier) and logic happening at the server. One reason why the 2-tier model is so widespread is because of the quality of the tools and middleware thathave been most commonly used since the 90’s: Remote-SQL, ODBC, relatively inexpensive and well-integrated PC-tools (like Visual Basic, Power-Builder, MS Access,4-GL-Tools by the DBMS manufactures). In comparison the server side uses relatively expensive tools. In addition the PC-based tools show good Rapid-Application-Development (RAD) qualities i.e. simpler applications can be produced in a comparatively short time. The 2-tier model is the logical consequence of the RAD-tools’ popularity.    


3 – Tier: Client Server













Fig Showing 3 – Tier or N- Tier Client Server Model


                                             In a three-tiered application, the presentation services are responsible for gathering information from the user, sending the user information to the business services for processing, receiving the results of the business services processing, and presenting those results to the user. The most popular architecture on the web currently, mostly taking the form of web browser processing client side presentation in the form of HTML/DHTML,etc, the web server using some scripting  language (ASP) and the database server (SQLServer for example) serving up the data.


The basic functionalities of 3 – Tier or N-Tier follows are


The presentation services tier is responsible for:
• Gathering information from the user
• Sending the user information to the business services for processing
• Receiving the results of the business services processing
• Presenting those results to the user

The business services tier is responsible for:
• Receiving input from the presentation tier.
• Interacting with the data services to perform the business operations.
• Sending the processed results to the presentation tier.


The data services tier is responsible for the:
• Storage of data.
• Retrieval of data.
• Maintenance of data.
• Integrity of data.


In Windows DNA applications commonly implement their business logic using one or
more of three implementation options.


• Asp Pages
• COM components
• Stored procedures running in the DBMS


Writing much business logic in ASP pages is a bad idea. Since simple languages are used, such as Microsoft Visual Basic Script, and the code is interpreted each time it is executed, which hurts the performance. Code in ASP pages is also hard to maintain,largely because business logic is commonly intermixed with presentation code that creates the user interface.


One recommended approach for writing middle-tier business logic is to implement that logic as COM objects. This approach is a bit more complex than writing a pure ASP application. Wrapping business logic in COM objects also cleanly separates this code from the presentation code contained in ASP pages, making the application easier tomaintain.
                               The Third option for writing business logic is to create some of that code as stored procedures running in the database management system (DBMS). Although a primary reason for using stored procedures is to isolate the details of database schema from business logic to simplify code management and security, having code in such a close proximity to data can also help optimize performance.


Challenges faced by developers


                        In Windows DNA, there are two major choices of user interfaces - Win32 clients and browser based clients. During the Internet revolution of the late 90s we saw the emergence of the browser and the Web Server. With the introduction of Internet, information started being available but with limited functionality. With the development of the Windows Distributed Internet Architecture, we started to see Web sites that allowed simple transactions to occur. Clients on browsers could access Web sites that had COM components available to them that allowed them to retrieve information from the database. So now we gained the capability  to simulate the environment of the Win32 platform. The client software – the browser – can access information on a server. But as with the Win32 environment, we are limited in the way in which the information is
presented to us. Customization is neither widespread nor broadly developed.


Let us look into limitations of these technologies.


Limitations in Win32 Clients
                                   In a client-server environment visual tool such as Visual Basic, are often used to create a rich user interface. The drawbacks is that such client software is difficult to deploy and maintain, requiring and install on every client and a change to every client when an upgrade is needed.
                                  DLL conflicts on the client are frequent because of variations in the version of the operating system and other software installed on the client.
                                  Visual Basic is the most common language used to write middle-tier components. This requires high level of expertise in COM. Since these middle-tire components are implemented using Microsoft Transaction Server on Windows NT or COM+ services on Windows 2000. These components use stateless designs, which can look very different from the stateful designs often used in client-based components.
                                 COM components, in the middle tier must work together, Versioning all the components properly so that they understand each other's interfaces can be a challenge. This requires a highly sophisticated skill level and a well - controlled deployment process.
                                 COM works well on Microsoft platforms. But it suffers from lack of interoperability with other platforms. One of the most important ways functionality can be reused is for a software component to inherit another component, But COM does not support inheritance.
                                Visual Basic is the most popular language for developing applications with the DNA model, this is used in two major roles - forms based VB Clients and COM components.This VB6 language has its own limitations it doesn’t have the capability of multithreading, lack of OOPS concepts, Poor error handling ability and poor integration with other languages. Hence it makes it unsuitable for development of object-based frameworks.
                                 Today’s applications need to use the Win32 API for a variety of purposes like monitor widows messages, manipulate controls, reading and writing to INI files and socket programming etc. But these widows API are hard to program for variety of reasons, like it is not object oriented and complex calls to the functions with long lists of arguments, since Win32 API is written in C++ language, getting calling conventions right on data types is messy.


Limitations in DNA-Based Internet Development or Browser based clients
                      With DNA - based software development, creating software that is accessed by a user locally is done very differently from development for the Internet. The Visual Basic forms for client-server user interfaces versus the use of Active Server Pages for Internet user interfaces. Even though both situations involve designing and implementing GUI based user interfaces the tools and programming techniques used are quite different. ASP lacks in state management between post backs. Every time a page is rendered, the programmer must make sure that all the visual controls like text boxes, dropdowns have their information loaded. It is the programmer's responsibility to manage the state in the user interface and to transfer state information between pages. This causes developers to have to write a lot of code for the internet user interfaces that is not relevant to business problem being solved.
                             If the Internet application is going to run on a group of Web Servers, then considerable additional work is necessary to design a state management system that is independent of particular server.
                            Browser based clients are somewhat more difficult to create, and offer a more limited user interface with fewer controls and less control over layout of the screen and handling of screen events. It is possible to create rich user interfaces using DHTML, but it requires lot of coding and also browser compatibility issues rises, for which a separate coding or two version of the same page have to be maintained, keeping in mind, the browser we are targeting.
                               The Internet has caused server-based applications to become much more popular than ever before and has made the connectionless request/response programming model common. But communicating between servers—especially among those running on different platforms—is difficult, and because most substantial Internet applications are Database-Centric, the ability to access a wide variety of data sources easily is more important than ever.As we move on to handheld devices or wireless devices, kiosks or other type of systems, many of which run a different processors and do not use standard operating system. So sharing the data between these devices and communication varies which is not uniform, becomes difficult.



Introduction to DotNet ...

.NET framework is an essential component of the windows operating system and helps create applications by integrating different programming languages, such as Visual C#, Visual Basic, Visual C++, and so on. .NET Framework consists of a virtual execution syatem called the common language runtime(CLR) and a set of class libraries. CLR is a Microsoft product of the Common Language Infrastructure(CLI), which is an industrial standard and a basis for creating execution and development environmentss in which languages and libraries work together. Microsoft introduced .NET to bridge the gap and ensure interoperability between application created in different languages. .NET framework is used to integrate the business logic of an application implemented in different programming languages and services. Consequently, it induces significant improvements in code reusability, code specialization, resource management, development of applications in multiple programming languages, security, deployment, and administration of programs developed in multiple programming languages..

Why .NET?

Why .NET? Mainly .NET is the competitor for JAVA. . Its an environment or platform. It contains collection of services for application development and application execution. It supports different type of applications development. ex: CUI, GUI, console, web based,mobile applications Main thing is .NET is network & Internet based application development.It provides a good development environment. ex: Drag and Drop design - IntelliSense features - Syntax highlighting and auto-syntax checking - Excellent debugging tools - Integration with version control software such as Visual Source Safe (VSS) - Easy project management

Evaluation of .NET:

Around 1995, Java was gaining popularity because of its platform-independent approach and Sun Microsyatem's open source policy. Later in 2002, Sun Microsystems released the enterprise edition of Java. ie., Java 2 Enterprise edition(J2EE), which is a Java Platform to develop and execute distributed Java Applications based on the N-tier architecture. The advent of J2EE eventually led to the decline of, Microsoft's Market share. Consequently, Microsoft started a project called NEXT GENERATION WINDOWS SERVICE(NGWS) to regain the market share . It tooks more than three years to develop the product, Which is Known as .NET. Microsoft released the first version of .NET with the name .NET Framework 1.0 on february 13,2002, along with the Visual studio .NET 2002 integrated development environment(IDE). .NET's Second revised version took nearly a year to release; and it was known as .NET framework 1.1 Microsoft Visual studio .NET, bettre known as Visual studio .NET2003, was also a part of the second release. The next version of .NET framework, .NET Framework 2.0, was released with Visual studio .NET 2005 on november 07,2005. .NET framework 3.0 formerly called WinFX, was released on novenber 06,2006. Finally the latest version of .NET framework, known as .NET framework 3.5, was released with Visual studio .NET2008 on november 19,2007.

Flavors of .NET:


Contrary to general belief .NET is not a single technology. Rather it is a set of
technologies that work together seamlessly to solve your business problems. The
following sections will give you insight into various flavors and tools of .NET and what kind of applications you can develop.
• What type of applications can I develop?
When you hear the name .NET, it gives a feeling that it is something to do only with internet or networked applications. Even though it is true that .NET provides
solid foundation for developing such applications it is possible to create many other types of applications. Following list will give you an idea about various
types of application that we can develop on .NET.
1. ASP.NET Web applications:
These include dynamic and data driven browser
based applications.
2. Windows Form based applications:
These refer to traditional rich client applications.
3. Console applications:
These refer to traditional DOS kind of applications like
batch scripts.
4. Component Libraries:
This refers to components that typically encapsulate
some business logic.
5. Windows Custom Controls:
As with traditional ActiveX controls, you can develop your own windows controls.
6. Web Custom Controls:
The concept of custom controls can be extended to
web applications allowing code reuse and modularization.
7. Web services:
They are “web callable” functionality available via industry standards like HTTP, XML and SOAP.
8. Windows Services:
They refer to applications that run as services in the
background. They can be configured to start automatically when the system boots up.
As you can clearly see, .NET is not just for creating web application but for almost all kinds of applications that you find under Windows.

Feature Of .NET

Features of .NET

Now that we know some basics of .NET, let us see what makes .NET a wonderful

platform for developing modern applications.

• Rich Functionality out of the box

.NET framework provides a rich set of functionality out of the box. It contains hundreds of classes that provide variety of functionality ready to use in your applications. This means that as a developer you need not go into low level details

of many operations such as file IO, network communication and so on.

Easy development of web applications

ASP.NET is a technology available on .NET platform for developing dynamic and data driven web applications. ASP.NET provides an event driven programming model (similar to Visual Basic 6 that simplify development of web

pages (now called as web forms) with complex user interface. ASP.NET server controls provide advanced user interface elements (like calendar and grids) that save lot of coding from programmer’s side.

• OOPs Support

The advantages of Object Oriented programming are well known. .NET provides a fully object oriented environment. The philosophy of .NET is – “Object is mother of all.” Languages like Visual Basic.NET now support many of the OO

features that were lacking traditionally. Even primitive types like integer and characters can be treated as objects – something not available even in OO languages like C++.

• Multi-Language Support

Generally enterprises have varying skill sets.
For example, a company might have people with skills in Visual Basic, C++, and Java etc. It is an experience that
whenever a new language or environment is invented existing skills are outdated.

This naturally increases cost of training and learning curve. .NET provides something attractive in this area. It supports multiple languages. This means that if you have skills in C++, you need not throw them but just mould them to suit
.NET environment. Currently four languages are available right out of the box namely – Visual Basic.NET, C# (pronounced as C-sharp), Jscript.NET and
Managed C++ (a dialect of Visual C++). There are many vendors that are working on developing language compilers for other languages (20+ language compilers are already available). The beauty of multi language support lies in the
fact that even though the syntax of each language is different, the basic capabilities of each language remain at par with one another.

• Multi-Device Support

Modern lift style is increasingly embracing mobile and wireless devices such as PDAs, mobiles and handheld PCs. . . .NET provides promising platform for programming such devices. .NET Compact Framework and Mobile Internet Toolkit are step ahead in this direction.

• Automatic memory management

While developing applications developers had to develop an eye on system resources like memory. Memory leaks were major reason in failure of applications. .NET takes this worry away from developer by handling memory on its own. The garbage collector takes care of freeing unused objects at appropriate intervals.

• Compatibility with COM and COM+

Before the introduction of .NET, COM was the de-facto standard for componentized software development. Companies have invested lot of money and efforts in developing COM components and controls. The good news is – you can still use COM components and ActiveX controls under .NET. This allows you to use your existing investment in .NET applications. .NET still relies on COM+ for features like transaction management and object pooling. In fact it provides enhanced declarative support for configuring COM+ application right from your source code. Your COM+ knowledge still remains as a valuable asset.

• No more DLL Hell

If you have worked with COM components, you probably are aware of “DLL hell”. DLL conflicts are a common fact in COM world. The main reason behind this was the philosophy of COM – “one version of component across machine”.

Also, COM components require registration in the system registry. .NET ends this DLL hell by allowing applications to use their own copy of dependent DLLs.

Also, .NET components do not require any kind of registration in system registry.

• Strong XML support

Now days it is hard to find a programmer who is unaware of XML. XML has gained such a strong industry support that almost all the vendors have released some kind of upgrades or patches to their existing software to make it “XML compatible”. Currently, .NET is the only platform that has built with XML right into the core framework. .NET tries to harness power of XML in every possible way. In addition to providing support for manipulating and transforming XML
documents, .NET provides XML web services that are based on standards like HTTP, XML and SOAP.

• Ease of deployment and configuration

Deploying windows applications especially that used COM components were always been a tedious task. Since .NET does not require any registration as such,
much of the deployment is simplified. This makes XCOPY deployment viable.

Configuration is another area where .NET – especially ASP.NET – shines over traditional languages. The configuration is done via special files having special
XML vocabulary. Since, most of the configuration is done via configuration files,

there is no need to sit in front of actual machine and configure the application manually. This is more important for web applications; simply FTPing new configuration file makes necessary changes.

• Security

Windows platform was always criticized for poor security mechanisms. Microsoft has taken great efforts to make .NET platform safe and secure for enterprise applications. Features such as type safety, code access security and role based
authentication make overall application more robust and secure.