31
INTRODUCTION TO . NET & VISUAL STUDIO

Net framework

  • Upload
    viv-ek

  • View
    656

  • Download
    0

Embed Size (px)

DESCRIPTION

A brief introduction About .NET Framework

Citation preview

Page 1: Net framework

INTRODUCTION TO . NET & VISUAL

STUDIO

Page 2: Net framework
Page 3: Net framework
Page 4: Net framework

ADVANTAGES OF .NET Object-oriented programming Good design Language independence Better support for dynamic Web pages Efficient data access Code sharing Improved security Zero-impact installation Support for Web services Any Platform

Page 5: Net framework

Object-oriented programming - Both the .NET Framework and C# are entirely based on object-oriented principles right from the start.

Good design - A base class library, which is designed from the ground up in a highly intuitive way.

Language independence - With .NET, all of the languages Visual Basic .NET, C#, J#, and managed C++ compile to a common Intermediate Language. This means that languages are interoperable in a way that has not been seen before.

Page 6: Net framework

Better support for dynamic Web pages - While ASP offered a lot of flexibility, it was also inefficient because of its use of interpreted scripting languages, and the lack of object-oriented design often resulted in messy ASP code. .NET offers an integrated support for Web pages, using a new technology - ASP.NET. With ASP.NET, code in your pages is compiled, and may be written in a .NET-aware high-level language such as C#, J#, or Visual Basic 2005.

Page 7: Net framework

Efficient data access - A set of .NET components, collectively known as ADO.NET, provides efficient access to relational databases and a variety of data sources. Components are also available to allow access to the file system, and to directories. In particular, XML support is built into .NET, allowing you to manipulate data, which may be imported from or exported to non-Windows platforms.

Any Platform – dot net is a Multilanguage and Multiplatform operating environment.

Page 8: Net framework

Code sharing - .NET has completely revamped the way that code is shared between applications, introducing the concept of the assembly, which replaces the traditional DLL. Assemblies have formal facilities for versioning, and different versions of assemblies can exist side by side.

Improved security - Each assembly can also contain built-in security information that can indicate precisely who or what category of user or process is allowed to call which methods on which classes. This gives you a very fine degree of control over how the assemblies that you deploy can be used.

Page 9: Net framework

Zero-impact installation - There are two types of assemblies: shared and private. Shared assemblies are common libraries available to all software, while private assemblies are intended only for use with particular software. A private assembly is entirely self-contained, so the process of installing it is simple. There are no registry entries; the appropriate files are simply placed in the appropriate folder in the file system.

Support for Web services - .NET has fully integrated support for developing Web services as easily as you’d develop any other type of application.

Page 10: Net framework

The .NET Framework

.NET is a collection of tools, technologies, and languages that all work together in a framework to provide the solutions that are needed to easily build and deploy truly robust enterprise applications.

Objectives:

“Microsoft .NET is based on the .NET Framework, which consists of two major components: the Common Language Runtime (CLR) and an extensive set of Framework Class Libraries (FCL). The CLR defines a common programming model and a standard type system for cross-platform, multi-language development.”

Page 11: Net framework

.NET IS MULTI-LANGUAGE .NET supports VB, C# (C-sharp), C++, J# (Java 1.2), Eiffel, etc.

code.vb code.cs code.cpp ...

Development Tools

app.exe

Page 12: Net framework

.NET IS CROSS-PLATFORM Compiled .NET apps run on any supported platform:

APP.exe

?Win64 Win32

(XP,2K,98)WinCE

Page 13: Net framework

HOW IS CROSS-PLATFORM ACHIEVED?

Cross-platform execution realized in two ways:

1.apps are written against Framework Class Library (FCL), not underlying OS

2.compilers generate generic assembly language which must be executed by the Common Language Runtime (CLR)

Page 14: Net framework

(1) FCL

Framework Class Library1000's of predefined classescommon subset across all platforms & languages

networking, database access, XML processing, GUI, Web, etc.

Goal?FCL is a portable operating system

Page 15: Net framework

.NET FRAMEWORK ARCHITECTURE

Page 16: Net framework

COMMON LANGUAGE SPECIFICATION Common Language Specification (CLS) is a set of specifications

or guidelines defining a .NET

language. CLS defines the common types of managed languages, which is a subset of the Common Type System(CTS).

Page 17: Net framework

MANAGED LANGUAGES AND CLS .NET supports managed programming languages, such

as C#, VB.NET, C++, J#, execute under the management of a common runtime called the CLR.

-> Managed applications compile to Microsoft Intermediate Language (MSIL) and meta data.

MSIL is a low level language that all managed languages compile to instead of native binary.

In .NET, a managed application is called an assembly.

Page 18: Net framework

COMMON TYPE SYSTEM (CTS)

The Common Type System (CTS) is a catalog of .NET types.

ex:

System.Int32, System. Decimal,

System. Boolean, System. Value

System. Object is a base class for remaining all the sub classes.

The contribution of CTS extend well beyond the definitions of common data types.

CTS helps with type safeness, enhances language interoperability, aids in segregating application domains, and more.

Page 19: Net framework

.NET FRAMEWORK CLASS LIBRARY

The .NET Framework Class Library (FCL) is a set of managed classes that provide access to system services.

Ex:

File I/O, sockets, database access, remoting, and XML are just some of the services available in the FCL.

FCL includes some 600 managed classes.

Page 20: Net framework

A flat hierarchy consisting of hundreds of classes would be difficult to navigate. Microsoft partitioned the managed classes of FCL into separate namespaces based on functionality.

For example,

classes pertaining to local input/output can be found in the namespace - System. IO. To further refine the hierarchy, FCL namespaces are often nested; the tiers of namespaces are delimited with dots. System.Runtime.InteropServices, System.Security.Permissions, and System.Windows.Forms are examples of nested namespaces.

The root namespace is System, which provides classes for console input/output, management of application domains, delegates, garbage collection, and more.

Page 21: Net framework

COMMON LANGUAGE RUNTIME

The Common Language Runtime is the engine of .NET and the common runtime of all managed languages.

CLR manages security, code verification, type verification, exception handling, garbage collection, a common runtime, and other important of program execution.

Page 22: Net framework

.NET Framework is a managed environment.

Language interoperability is one goal of .NET.

CLR: (Common Language Runtime)

The common language runtime monitors the execution of .NET applications and provides essential services. It manages memory, handles exceptions, ensures that applications are well-behaved, and much more.

Page 23: Net framework

Central to the .NET Framework is its runtime execution environment, known as the Common Language Runtime (CLR) or the .NET runtime. Code running under the control of the CLR is often termed managed code.

However, before it can be executed by the CLR, any source code that you develop (in C# or some other language) needs to be compiled. Compilation occurs in two steps in .NET:

1.Compilation of source code to IL

2.Compilation of IL to platform-specific code by the CLR

This two-stage compilation process is very important, because the existence of the IL (managed code) is the key to providing many of the benefits of .NET.

Page 24: Net framework

JUST-IN-TIME COMPILATIONAssemblies contain MSIL, which is converted

into native binary and executed at runtime, using a process aptly named Just-in-Time compilation, or jitting. An assembly is subjected to two compilations.

First,

managed code is compiled to create the actual assembly. Managed compilers, such as csc and vbc, compile C# and VB.NET source code into an assembly that contains MSIL and metadata.

Page 25: Net framework

Second,

the assembly is compiled at load time, converting the MSIL into native binary that is optimized for the current platform and hardware. When an assembly is jitted, an in-memory cache of the binary is created and executed. Just-in-Time compilers are called Jitters.

Page 26: Net framework

STEPS TO COMPILE & EXECUTIONThe common language runtime is responsible for executing your application code.

When you write an application for the .NET with a language such as C# , VB, Java Script, your source code is never compiled directly into machine code. Instead the C# or VB compiler converts your code into a special language named (Micro Soft Intermediate Language) MSIL.

Page 27: Net framework

MSIL looks very much like a object oriented assembly language. However, unlike a typical assembly language, it is not CPU specific.

MSIL is a low level and plat form independent language.

When your application actually executes, the MSIL code is “just-in-time” compiled into machine code by JITTER (The Just-In-Time compiler).

Page 28: Net framework

Normally your entire application is not compiled from MSIL into machine code. Instead the methods that are actually called during execution are compiled.

In reality .NET Framework understands only one language: MSIL. However, you can write applications using languages such as C#, VB.NET for the .NET framework because the .NET framework includes compilers for these languages that enable you to compile your code into MSIL.

Page 29: Net framework
Page 30: Net framework

ASSEMBLIES.NET packages components into assemblies

. 1 assembly = 1 or more compiled classes .EXE represents an assembly with classes + Main program .DLL represents an assembly with classes

Development Tools

assembly

code.vbcode.vb

code.cs

.DLL

Page 31: Net framework

ADVANTAGES OF MANAGED CODE Microsoft Intermediate Language shares with Java byte code the idea that it is a low-level language with a simple syntax (based on numeric codes rather than text), which can be very quickly translated into native machine code. Having this well-defined universal syntax for code has significant advantages.