Introduction to .NET by Quontra Solutions Email : info@quontrasolutions.com Call us : 404-900-9988 Visit : www.quontrasolutions.com
2
.NET Framework
Introduction to .net
3
Computer programs were written using procedural languages .(C,
Cobol, Pascal, etc.)
Code was written around functions; i.e., logic is built around the functions to be performed.
Object Oriented Programming (OOP) era ( C++ and Smalltalk).
Code was written around data; i.e., logic is built by identifying the data in the system and performing functions around this data.
Introduction to .net
Disadvantages 4
ď‚— The resources (like memory) were managed by the programmer and
there was no runtime support provided by the programming language. ď‚— This caused a lot of problems by assigning programmers a lot of
responsibilities, the mishandling of which could easily crash the whole application (and sometimes the Operating System (OS) itself).
Introduction to .net
Introduction of Java 5
The first commercially successful language to provide such runtime
support was Java by Sun Microsystems (although runtime support was present in languages like Smalltalk). Java comes with a runtime environment, called Java Virtual Machine
(JVM) which performs memory management, garbage collection, checking of runtime data types and memory access. Java also presented the idea of 'Platform independence' by providing
their JVM implementation for several OS and different hardware. This meant that a compiled java program can run on multiple OS and hardware without any change or re-compilation (at least in theory). Introduction to .net
6
Drastic changes in other popular concepts
Eliminating Pointers, Multiple inheritance, Operator overloading and Templates.
Java a very popular language
For both academic and development environments, especially web applications.
Java provides this ease and simplification at the penalty of performance
by introducing interpreter at runtime.
Disadvantage : Also, because of the platform independence of Java, it
lacks in some Platform specific features such as GUI and event handling.
Introduction to .net
History of .NET 7
In the beginning of 1998, a team of developers at Microsoft had just
finished work on a new version of IIS 4.0 including several new features in ASP. While developers were pleased to see new capabilities for internet
development on WinNT they developed a new architecture called NGWS (next Generation windows services). In July 2000 ,Microsoft held a professional Developers conference (PDC)
in Orlando, Florida. Next Generation Platform for windows and Internet Software Development (.NET) Introduction to .net
Microsoft .NET 8
In the year 2000, Microsoft launched its new development
environment called Microsoft Visual Studio .NET. Microsoft .NET, at its core, is very similar to J2EE (Java 2 Enterprise Edition). But, .NET is a compromise between traditional 'un-managed' and 'managed' style of programming. It allows a programmer to run both managed (code managed by .NET Runtime) and un-managed code (not managed by .NET runtime). In managed code, .NET does memory management, run-time type checking, memory access checking and exception handling on behalf of your program.
Introduction to .net
Microsoft .NET 9
It’s the framework for the .NET platform. Its a common environment for building, deploying, and running Web
applications and Web Services. It consists of the following CLR (Common Language Runtime) CTS (Common Type System) Common Class Libraries. The .NET Framework provides the following. Rich Application Environment Simplified Development Easy Integration The .NET is language neutral. Introduction to .net
Microsoft .NET 10
Microsoft Visual Studio.NET is the common development environment
for the .NET Framework. Its for providing powerful, reliable enterprise Web Solutions. It’s a framework designed by Microsoft. It has been written so that applications on other platforms will be able
to access these services. Its built upon open standard technologies like XML and SOAP. Introduction to .net
Microsoft .NET 11
Microsoft .NET was originally called NGWS. It is a new Internet and web based architecture. .NET delivers software as Web Services. It is a Framework for universal services. It will run in any browser on any platform. It Contains Common Class Libraries like ADO.NET and ASP.NET and
windows forms to provide advanced std services that can be integrated on variety of computer systems.
Introduction to .net
Microsoft .NET 12
.NET uses Just In Time (JIT) compilers to translate your intermediate
compiled code to native executable code, which significantly improves the performance. .NET also provides 'Platform independence' and 'Language Independence'.
However, the concept of 'Platform independence' is somewhat different from Java. In .NET, your compiled program can run on any hardware running any
variant of the Windows OS (except for Windows 95).
Introduction to .net
Microsoft .NET 13
ď‚— .NET also provides cross language support. This means that modules
written in different .NET compliant languages can call/use each others modules. Hence, it is possible to write your class in C#, inherit it in VB.Net and finally use it in VC++.NET ď‚— There are as many as 22 languages supporting the .NET Platform
(including C#, VB, C++, J#, Cobol, Eiffel, Pascal, Fortran, RPG, Smalltalk and others) and enjoying full use of the .NET runtime and huge Framework class library (FCL).
Introduction to .net
Microsoft .NET 14
ď‚— .NET is useful for building a variety of Windows applications, web
applications and services, database and embedded applications (using .NET compact version).
ď‚— On the marketing and commercial side, Microsoft is apparently putting
80% of its development resources and investment on .NET by providing a number of .NET enabled/supported applications like SQL server .NET and Windows Server 2003
Introduction to .net
Internet Standards Of .NET 15
HTTP – used as a Communication protocol between Internet
Applications. XML – used to exchange the data between internet applications. SOAP – Used to request web services. UDDI – Used to search and discover Web services.
Introduction to .net
Web Services 16
These are small units of code built to handle a limited task. These are XML based communicating protocols. These are independent of OS. These are independent of Programming Languages. These are connect people , system and devices.
Introduction to .net
.NET Architecture and .NET Framework 17
In the .NET Architecture and the .NET Framework there are different
important terms and concepts which we will discuss one by one:• • • • • • •
Introduction to .net
Common Language Runtime (CLR): MSIL (Microsoft Intermediate Language) Just In Time Compilers (JITers) Framework Class Library (FCL) Common Language Specification (CLS) Common Type System (CTS) Garbage Collector (GC)
Common Language Runtime (CLR) 18
The most important concept of the .NET Framework is the existence and
functionality of the .NET Common Language Runtime (CLR), also called .NET Runtime in short. It is a framework layer that resides above the OS and handles the
execution of all the .NET applications. Our programs don't directly communicate with the OS but go through the
CLR.
Introduction to .net
MSIL (Microsoft Intermediate Language) 19
When we compile our .NET Program using any .NET compliant language
(like C#, VB.Net, C++.NET) it does not get converted into the executable binary code but to an intermediate code, called MSIL or IL, understandable by CLR. MSIL is OS and hardware independent code. When the program needs to be executed, this MSIL, or intermediate code,
is converted to binary executable code (native code). The presence of IL makes possible the Cross Language Relationship as all
the .NET compliant languages produce similar, standard IL code. Introduction to .net
Working of CLR 20
Language Compiler
Code in any .net Language At Compile Time
Introduction to .net
MSIL Code
Just In Time Compiler At Run Time
Executable Native Code
Just In Time Compilers (JITers) 21
When our IL compiled code needs to be executed, CLR invokes the JIT
compilers which compile the IL code to native executable code (.exe or .dll) that is designed for the specific machine and OS JITers in many ways are different from traditional compilers as they
compile the IL to native code only when desired; e.g., when a function is called, the IL of the function's body is converted to native code just in time. So, the part of code that is not used by that particular run is never
converted to native code. Introduction to .net
Just In Time Compilers (JITers) 22
If some IL code is converted to native code, then the next time it's needed,
the CLR reuses the same (already compiled) copy without re-compiling. So, if a program runs for sometime (assuming that all or most of the
functions get called), then it won't have any just-in-time performance penalty. As JITers are aware of the specific processor and OS at runtime, they can
optimize the code extremely efficiently resulting in very robust applications.
Introduction to .net
Just In Time Compilers (JITers) 23
ď‚— Also, since a JIT compiler knows the exact current state of executable
code, they can also optimize the code by in-lining small function calls (like replacing body of small function when its called in a loop, saving the function call time). ď‚— Although Microsoft stated that C# and .NET are not competing with
languages like C++ in efficiency and speed of execution, JITers can make your code even faster than C++ code in some cases when the program is run over an extended period of time (like web-servers).
Introduction to .net
Types of JIT 24
JIT
This the default JIT compiler of the NGWS runtime. It can cope up with unrestricted sets of IL instructions. Its main constraint is the time it takes to perform the optimizations. EconoJIT It performs high speed conversion of IL to Managed native code. It allows caching for generated native code. It isn’t optimized as the code produced by the main JIT. PreJIT It works like the traditional compiler. Its based on the main JIT Compiler. It has faster loading time and faster application start time.
Introduction to .net
Framework Class Library (FCL) 25
The .NET Framework provides a huge Framework (or Base) Class Library
(FCL) for common, usual tasks FCL contains thousands of classes to provide access to Windows API and
common functions like String Manipulation, Common Data Structures, IO, Streams, Threads, Security, Network Programming, Windows Programming, Web Programming, Data Access, etc. It is simply the largest standard library ever shipped with any development
environment or programming language.
Introduction to .net
Framework Class Library (FCL) 26
ď‚— The best part of this library is they follow extremely efficient OO
design (design patterns) making their access and use very simple and predictable ď‚— You can use the classes in FCL in your program just as you would use
any other class. You can even apply inheritance and polymorphism to these classes.
Introduction to .net
Common Language Specification (CLS) 27
Microsoft has released a small set of specifications that each language
should meet to qualify as a .NET Compliant Language As IL is a very rich language, it is not necessary for a language to
implement all the IL functionality; rather, it merely needs to meet a small subset of CLS to qualify as a .NET compliant language. This is the reason why so many languages (procedural and OO) are
now running under the .NET umbrella.
Introduction to .net
Common Language Specification (CLS) 28
CLS basically addresses language design issues and lays down certain
standards. For instance, there shouldn't be any global function declarations, no
pointers, no multiple inheritance and things like that. The important point to note here is that if you keep your code within the
CLS boundary, your code is guaranteed to be usable in any other .NET language. .NET also defines a Common Type System (CTS). Introduction to .net
Common Type System (CTS) 29
Like CLS, CTS is also a set of standards. CTS defines the basic data types that IL understands. Each .NET com language should map its data types to these standard data
types. This makes it possible for the 2 languages to communicate with each other by passing/receiving parameters to/from each other. For example, CTS defines a type, Int32 an integral data type of 32 bits (4
bytes) which is mapped by C# through int and VB.Net through its Integer data type. Introduction to .net
Language Independent 30
It has the ability to use any language to write applications The Component Object Model (COM) already allows reuse of COM
components in any COM aware language and allows for COM components to be written in languages such as VB and C++. But the superior capabilities of the .NET framework was very easy than
COM Interoperability
Introduction to .net
Language Independent 31
With COM Interoperability in possible only when the components adhere
to a binary standard for interaction. That is every component has to follow rules for communication established for sending information to compiled components. The .NET CLR takes this Interoperability a step further by allowing cross
–language inheritance and standardized exception handling
Introduction to .net
Garbage Collector (GC) 32
ď‚— CLR also contains the Garbage Collector (GC), which runs in a low-
priority thread and checks for un-referenced, dynamically allocated memory space. ď‚— If it finds some data that is no longer referenced by any
variable/reference, it re-claims it and returns it to the OS so it can be used by other programs as needed. ď‚— The presence of a standard Garbage Collector frees the programmer
from keeping track of dangling data.
Introduction to .net
.NET Framework 33
Introduction to .net
.NET Architecture 34
Windows Forms
ASP.NET Web services
Web Forms
Controls
ASP.NET application Services
Drawing
Windows Application Services
.NET Framework Base Classes ADO.NET
XML
NET
SECURITY
THREADING DIAGNOSTICS
IO ETC
Common Language Runtime Memory Management Introduction to .net
Common Type System
Life Cycle Monitoring
CLR 35
Common Type System (Datatypes etc)
IL to Native code Compilers
Execution Support (Runtime Functions)
Garbage Collections , Stack ,Code Manager
Class Loader and Memory Layout
Introduction to .net
Security
Features 36
ď‚— In Team environments, developers can be free to use whatever language
they choose to develop objects .whenever it comes time to integrate the Team members components, we can be sure that they can talk to each other seamlessly on the runtime as well as on the source-code level ď‚— It allows enhancements to existing objects coded In one language to be
added using a different language
Introduction to .net
37
Thank you!!
Introduction to .net