0% found this document useful (0 votes)
19 views26 pages

Week 2 - DOT NET Framework

The document provides an overview of key concepts related to the Microsoft .NET Framework including: the .NET Framework classes which provide functionality for common tasks like working with files and data; the Common Language Runtime (CLR) which compiles code and provides application isolation and security; and the Common Type System (CTS) which allows components written in different languages to interoperate. It also discusses how .NET code is compiled to Microsoft Intermediate Language (MSIL) for platform-independent execution on any CPU.

Uploaded by

10303374
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views26 pages

Week 2 - DOT NET Framework

The document provides an overview of key concepts related to the Microsoft .NET Framework including: the .NET Framework classes which provide functionality for common tasks like working with files and data; the Common Language Runtime (CLR) which compiles code and provides application isolation and security; and the Common Type System (CTS) which allows components written in different languages to interoperate. It also discusses how .NET code is compiled to Microsoft Intermediate Language (MSIL) for platform-independent execution on any CPU.

Uploaded by

10303374
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

LEARNING OBJECTIVES

• Students will be taught the following:


• The Microsoft .Net Framework
• The .Net Framwork Classes
• The Common Language Runtime (CLR)
• The Common Type System and the Common Language Specification
• Installing Visual Studio and .Net Framework.
THE MICROSOFT .NET FRAMEWORK
• The .NET Framework provides an unprecedented platform for building Windows,
web, and mobile applications with one or more programming languages.
• The .NET Framework provides base classes, available to all Visual Studio
languages, for such functions as accessing databases, parsing XML, displaying and
processing Windows and web forms, and providing security for your applications.
• All languages in Visual Studio share and use the same base classes, making your
choice of a programming language in Visual Studio a matter of personal
preference and syntax style.
• .NET splits an operating system’s platform (be it Windows, Linux, Mac OS, or any
other OS) into two layers: a programming layer and an execution layer.
THE .NET FRAMEWORK CLASSES
• Unlike the Win32 API, .NET is totally object-oriented. Anything you want to do
in .NET, you are going to be doing with an object.
• If you want to open a file, you create an object that knows how to do this.
• If you want to draw a window on the screen, you create an object that knows
how to do this.
• This is called encapsulation; the functionality is encapsulated in an object, and
you don’t really care how it’s done behind the scenes.
• Although the concept of subsystems still exists in .NET, these subsystems are
never accessed directly—instead, they are abstracted away by the Framework
classes.
• Either way, your .NET application never has to talk directly to the subsystem
(although you can do so if you really need or want to).
• Rather, you talk to objects, which then talk to the subsystem. In Figure 2.1, the
box marked System.IO.File is a class defined in the .NET Framework.
THE .NET FRAMEWORK CLASSES

• The .NET Framework is actually a set of classes called base classes.


• The base classes in the .NET Framework are rather extensive and provide the functionality
for just about anything that you need to do in a Windows or web environment, from
working with files to working with data to working with forms and controls.
THE .NET FRAMEWORK CLASSES
• The class library is vast, containing several thousand objects available to
developers.
• Although in your daily development you need to understand only a handful of
them to create powerful applications.
• Another really nice thing about the base classes in the .NET Framework is that
they are the same irrespective of the language used.
• So if you are writing a Visual Basic 2015 application, you use the same object you
would use from within a C# application.
• That object will have the same methods, properties, and events, meaning there is
very little difference in capabilities between the languages, because they all rely
on the Framework.
EXECUTING CODE
• The .NET Framework uses the Common Language Runtime (CLR) to make it possible for
programs written in any .Net language to run on any processor.
• If you wrote an application with Visual Basic 6, you had to compile it into a set of ×86
machine instructions before you could deploy it.
• This machine code would then be installed and executed on any machine with a
processor that supported ×86 instructions and was also running Windows.
• If you write an application with Visual Basic 2015, you still have to compile the code.
• However, you don’t compile the Visual Basic 2015 code directly into ×86 machine
instructions because that would mean that the resulting program would run only on
processors that support this language—
• In other words, the program would run only on Intel chips and their compatible
competitors.
• Instead, compilation creates something called Microsoft Intermediate Language (MSIL).
• This language is not dependent on any processor. It is a layer above the traditional
machine code.
EXECUTING CODE
• To run the code, it has to be further compiled, as shown in Figure 2.2, from MSIL code into
the native code that the processor understands.

• However, this approach also provides the industry with a subtle problem.
• In a world in which .NET is extremely popular who is responsible for developing an MSIL-to-
native compiler when a new processor is released?
COMMON LANGUAGE RUNTIME
• The Common Language Runtime (CLR) is the heart of .NET.
• CLR takes your .NET application, compiles it into native processor code, and runs
it.
• It provides an extensive range of functionalities to help applications run properly:
• Code loading and execution
• Application isolation
• Memory management
• Security
• Exception handling
• Interoperability
CODE LOADING AND EXECUTION
• The code loading and execution part of the CLR deals with reading the MSIL code
from the disk and running it.
• It compiles the code from MSIL into the native code (machine code) that the
processor understands.
• Java also has a concept similar to MSIL, known as byte code, which the Java
runtime loads and executes.
APPLICATION ISOLATION
• One important premise of modern operating systems such as Windows and Linux
is that applications are isolated from one another.
• This is critically important from the standpoint of both security and stability.
• Imagine that you have a badly written program and it crashes the PC.
• This shouldn’t happen; only the badly behaved program should crash.
• You don’t want other applications or the operating system itself to be affected by
a program running on it.
• For example, if your email program crashes, you don’t want to lose any unsaved
changes in your word processor.
• With proper application isolation, one application crashing should not cause
others to crash.
• The other aspect to application isolation is one of security.
• Imagine that you are writing a personal and sensitive email
APPLICATION ISOLATION
• You don’t want other applications running on your computer to be able to grab or
even stumble across the contents of the email and pass it on to someone else.
• Applications running in an isolated model can’t just take what they want.
• Instead, they have to ask whether they can have something, and they are given it
only if the operating system permits it.
• This level of application isolation is already available in Windows.
• .NET extends and enhances this functionality by further improving it.
Security
• .NET has powerful support for the concept of code security.
• The Framework was designed to give system administrators, users, and software
developers a fine level of control over what a program can and can’t do.
• Windows (old framework) does not understand the difference between a script
file you write that looks through your address book and sends emails to
everyone, and those written by others and delivered as viruses.
• .NET solves this problem by building security features into the CLR.
• Under the CLR, code requires evidence to run.
• This evidence can consist of policies set by you and your system administrator.
• As well as the origin of the code (for example, whether it came off your local
machine, off a machine on your office network, or over the Internet).
Interoperability
• Interoperability in the .NET Framework is achieved on various levels.
• One kind of interoperation is at the core of the Framework, where data types are
shared by all managed languages.
• This is known as the Common Type System (CTS).
• The other type of interoperation is that of communicating with existing COM
interfaces.
• Because a large application-software base is written in COM, it was inevitable that
.NET should be able to communicate with existing COM libraries.
• This is also known as COM interop.
EXCEPTION HANDLING
• Exception handling is the concept of dealing with exceptional happenings when
you are running the code.
• Imagine that you have written a program that opens a file on disk.
• What if that file is not there?
• Well, the fact that the file is not there is exceptional, and you need to handle it in
some way.
• It could be that you crash or you could display a window asking the user to supply
a new filename.
• Either way, you have a fine level of control over what happens when an error
does occur.
• .NET provides a powerful exception handler that can catch exceptions when they
occur and give your programs the opportunity to react and deal with the problem
in some way.
THE COMMON TYPE SYSTEM AND COMMON LANGUAGE
SPECIFICATION
• Microsoft’s motivation was to get any developer using any language to use .NET,
and for this to happen, all languages had to be treated equally.
• Likewise, applications created in one language have to be understood by other
languages.
• For example, if you create a class in Visual Basic 2015, a C# developer should be
able to use and extend that class.
• Alternatively, you might need to define a string in C#, pass that string to an object
built in Visual Basic 2015.
• That object should be able to understand and manipulate the string successfully.
• The CTS enables software written in different languages to work together.
• Before .NET, Visual Basic and C++ handled strings completely differently, and you
had to go through a conversion process each time you went from one to the
other.
THE COMMON TYPE SYSTEM AND COMMON LANGUAGE
SPECIFICATION
• With the CTS in place, all .NET languages use strings, integers, and so on in the
same way, so no conversion needs to take place.
• In addition, the Common Language Specification (CLS) was introduced by
Microsoft to make it easier for language developers to adapt their languages to
be compatible with .NET.
INSTALLING VISUAL STUDIO 2015 AND DOT NET
FRAMEWORK

1 2 3 4

Double click
“vs_community_ENU
Select your If you want to install
all features, select
Finally, click
installation
__266050523.14878 location and type default; if you want the "Install"
83645.exe” and click of installation. to install specified button.
"Run". features, select
custom.
INSTALLING
VISUAL STUDIO
2015 AND DOT
NET
FRAMEWORK
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• You can see the two


progress bars for Acquiring
and Applying, as shown in
below screenshot.
• It will take some time to
finish the installation.
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• The "finished installation


screen" will look like below.
• Just click "Restart Now".
• Your system will be
restarted.
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• After the restart, go to


Start button >> All
programs >> double
click Visual Studio 2015.
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• Visual Studio 2015 will


open.
• We can sign in using
Hotmail or Outlook mail Id.
• If you want to use it
without signing in, just click
“Not now, maybe later”.
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• Now, the development settings


are selected “General” by
default.
• If needed, we can change that
based on our requirement.
• Finally, chose color themes
and click "Start Visual Studio".
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• It will take few minutes to


open Visual Studio for the
first time.
• We can see the screenshots
on the right side of this
slide.
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK

• Now, we can see the full


view.
• It looks like the
screenshot on the right
side of this slide.
SUMMARY
TOPIC CONCEPT
Microsoft .Net Framework Provides a platform for building windows, web and mobile applications with one
or more programming languages. The framework contains classes for functions
such as accessing databases, parsing XML, displaying and processing windows and
web forms and providing security for applications.
.Net Framework Classes .Net Framework contains classes known as Base classes. Unlike Win32 API, .Net is
totally object-oriented meaning programmers will react with objects, providing
encapsulation.
Although subsystems exist in .Net framework, they are never accessed directly,
instead they are abstracted away by the frameworks classes.
Executing Computer Programs The .Net Framework uses the Common Language Runtime (CLR) to run programs
written in any .Net language
The CLR converts the source code into MSIL which is then converted to the
executable code.
The Common Language Runtime (CLR) The CLR compiles .Net programs into native processor code and runs them. It
provides extensive range of functionalities to help applications run smoothly. These
Code loading and execution, Application Isolation, Memory management, Security,
Exception handling and Interoperability.
The Common Type System (CTS) This enables software written in different languages to work together. This was
Microsoft’s motivation to develop the .Net framework.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy