Chapter 2 Dot NET Framework (Presentation Slide)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Chapter 2

•Introduction to .NET
framework

1
.NET Framework(cont..)
What is a Framework?
• A framework is a software tool.
• A framework is a collection of many small technologies
integrated together to develop applications that can be
executed anywhere.
What .NET Represents?
• NET stands for Network Enabled Technology.
• In .NET, dot (.) refers to object-oriented and NET refers
to the intercommunication.
• Dot net is a new API (application programming interface)
that helps programmers to write applications for the
Windows platform, web applications, web services. 2
Dot (.) Net Framework Architecture
• The architecture of the .Net framework focuses on two main
things:
• The first of these is that the framework code is largely independent
of the language in which it is written.
• For example, a framework written in C# can contain calls to
libraries written in C++, as well as to libraries written in other
programming languages.
• This allows .Net programs to be ported to a wide variety of
platforms.
• The second main goal of the .Net framework is that it should be
easy to adopt.
• This means that the framework should be designed in a way that
makes it easy to incorporate new features and new functionality
into an existing program.
3
.NET Framework(cont..)
• What does the DOTNET Framework provide?
• The DOTNET Framework provides two things such as:
1. BCL (Base Class Libraries)
2. CLR (Common Language Runtime)

1. BCL: Base Class Libraries (BCL) is designed by


Microsoft.
• Without BCL we can’t write any code in .NET. So,
BCL is also known as the Building block of .NET
Programs.
• BCLs are installed into the machine when we installed
the .NET framework, contains pre-defined classes
• The physical location of BCL is C:\Windows\assembly
4
.NET Framework(cont..)
2. CLR: CLR stands for Common Language Runtime,
and
• It is the core component under the .NET framework
which is responsible for converting the MSIL (Microsoft
Intermediate Language) code into native code and then
execution.
• In the .NET framework, the code is compiled twice.
• In the 1st compilation, the source code is compiled by
respective language compiler and generates the intermediate
code which is known as MSIL (Microsoft Intermediate
Language) or IL (Intermediate language code) Or Managed
Code.
• In the 2nd compilation, MSIL is converted into Native code
(native code means code specific to Operating System so that
the code is executed by the Operating System) using CLR.
5
.NET Framework(cont..)

6
.NET Framework(cont..)
• What is JIT? JIT stands for the Just-in-Time compiler. It is the component
of CLR which is responsible for converting MSIL code into Native Code. This
Native code is directly understandable by the operating system.
• Different types of DOTNET Framework.
The .net framework is available in three different flavors:
-DOT NET Framework: This is the general version required to run .NET
applications on Windows OS only.
- DOT NET mono Framework: This is required if we want to run DOT NET
applications on other OS like Unix, Linux, MAC OS, etc.
-DOT NET Compact Framework: This is required to run .NET applications on
other devices like mobile phones and smartphones.

• -NOTE: MSIL is only CPU dependent and will run only on Windows OS only using
dot NET Framework because .NET Framework is designed for Windows OS only.
• -There is another company known as “NOVEL” designed separate framework known
as “MONO Framework”. Using this framework we can run MSIL on
7
different OS Like Linux, UNIX, Mac, BSD, OSX, etc.
.NET Framework(cont..)
What is exactly DOTNET?
• .NET is a framework tool that supports many
programming languages and many technologies.
• Programming languages that designed by Microsoft
are as follows:
• VB.NET
• C#.NET
• VC++.NET
• J#.NET
• F#.NET
• Jscript.NET
• WindowsPowerShell
• Iron phython
• Iron Ruby 8
.NET Framework(cont..)

What is not DOT NET?


• .NET is not an Operating system.
• It is not an application or package.
• .NET is not a database
• .NET is not a Testing Tool.
• It is not a programming language.
9
.NET Framework(cont..)
Technologies supported by the .NET framework are as
follows
• ASP.NET (Active Server Pages.NET)
• ADO.NET (Active Data Object.NET)
• WCF (Windows Communication Foundation)
• WPF (Windows Presentation Foundation)
• WWF (Windows Workflow Foundation)
• AJAX (Asynchronous JavaScript and XML)
• LINQ (Language Integrated Query)
10
Features of .NET Framework
• Interoperability with other environments

• Support for developing language-independent


applications

• Support for OOPs(object-oriented programming)

• Support for Web applications development

• Support for Web services development


11
How a .NET application compiled and run?
• First, the developer has to write the code using any dot net supported
programming languages such as C#, VB, J#, etc.
• Then the respective language compiler will compile the program into something
called Intermediate language (IL) code.
• For example, if the programming language is C#, then the compiler is cse and if
the programming language is VB, then the compiler will be vbc.
• This Intermediate Language (IL) code is half compiled code i.e. partially
compiled code and cannot be executed directly by the operating system.
• So, when you want to execute this IL code on your machine, the dot net
framework provides something called CLR (Common Language Runtime) which
takes the responsibility to execute your IL Code.
• The CLR takes the IL (Intermediate Language) code and gives it to something
called JIT (Just-in-Time) Compiler.
• The JIT compiler takes the IL code and reads each and every line of the IL code
and converts it to machine-specific instructions (i.e. into binary format) which can
be executed by the underlying operating system.
13
Intermediate Language (IL) Code
• IL code is a half compiled or partially compiled or CPU
independent partially compiled code.
• Why Partial Compiled Code or why not fully compiled Code?
• The reason is very simple; We don’t know in what kind of
environment .NET Code will run (for example, Windows XP,
Windows 7, Windows 10, Windows Server, etc.).
• In other words, we don’t know what operating system is going to
run our application; we also don’t know the CPU configuration,
machine configuration, security configuration, etc.
• So, the IL code is partially compiled and at runtime, this IL code is
compiled to machine-specific instructions using the environmental
properties such as OS, CPU, Machine Configuration, etc. 14
Components of Common Language Runtime
(CLR)
• CLR is the heart of .NET Framework and it contains the
following components.
SecurityManager
JIT Compiler
Memory Manager
Garbage Collector
Exception Manager
Common Language Specification (CLS)
Common Type System (CTS)

• Let us discuss what each of these components does in


detail.
15
Components of CLR
Security Manager:
• There are basically two components to manage security. They are as follows:
• CAS (Code Access Security)
• CV (Code Verification)
• These two components are basically used to check privileges of the current user that
the user is allowed to access the assembly or not.
• The CLR also sees what kind of rights or what kind of authorities this code has and
whether it is safe to be executed by the operating system.
• So, basically these types of checks are maintained by the Security Manager.
 JIT Compiler:
• The JIT Compiler is responsible for Converting the MSIL code into native code that
is executed by the machine.
• The native code is directly understandable by the system hardware.
• JIT compiles the code just before the execution and then save this translation in
memory.
Memory Manager:
• The memory manager component allocates the necessary memory for the variables
and objects that are to be used by the application. 16
T’Components of CLR, … cont
Garbage Collector:
• When a dot net application runs, lots of objects are created.
• At a given point in time, it is possible that we don’t need these
objects.
• So, Garbage Collector is nothing but it is a small routine or you
can say it’s a background process thread that runs and try to
identify what objects are not being used currently by the
application and de-allocates the memory of those objects.
Exception Manager:
• This component redirects the processor to execute catch or finally
blocks whenever an exception has occurred at runtime.

17
Components of CLR , … cont’
Common Type System (CTS):
• The .NET Framework supports many programming languages such as C#, VB.NET,
J#, etc.
• Every programming language has its own data types.
• One programming language cannot understand other programming language data
types.
• But, there can be situations when you want to code in one language to be called in
other languages.
• In order to ensure smooth communication between these languages, the most
important thing is that they should have a common type system (CTS) which ensures
that type defined in two different languages gets compiled to a common data type.
• CLR will execute all programming language’s data types; this is possible because
CLR will contain its own data types which are common to all programming
languages.
• At the time of compilation, all language-specific data types are converted into CLR’s
data type.
• This data type system of CLR which is common to all programming languages of
.NET is known as the Common Type System (CTS).
18
Components of CLR , … cont’
CLS (Common Language Specification):
• CLS is a part of CLR. .NET supports many programming languages and every
programming language has its own syntactical rules for writing the code which
is known as language specification i.e. every programming language has its
own language specification.
• One programming language cannot understand other programming language
syntactical rules (language specification).
• But CLR will execute all programming languages code.
• This is possible because CLR cannot understand any programming language
specification rather CLR has its own language specification (syntactical rules)
for its MSIL.
• Every language compiler should follow this language specification of CLR at
the time of compilation and should generate MSIL; CLR’s JIT compiler will
generate native code from MSIL.
• This language specification of CLR is common for all programming languages
code execution of .NET and is known as CLS.
19
Introduction to Microsoft
Visual Studio 2012 or above:
Will be in chapter 4

20

You might also like