Presentation is loading. Please wait.

Presentation is loading. Please wait.

.NET Session Prepared By : Manu Sharma IBE Team. Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET.

Similar presentations


Presentation on theme: ".NET Session Prepared By : Manu Sharma IBE Team. Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET."— Presentation transcript:

1 .NET Session Prepared By : Manu Sharma IBE Team

2 Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET

3 .NET Applications

4 Console Applications GUI Applications  Windows Applications  Web based Application Library of Types  Windows Services  Web Services

5 .NET Framework

6 .NET Architecture Win 32 Windows Forms.NET Framework Class Library Common Language Runtime ASP.NET Web Forms XML Web Services VB.NETC# VJ# VC++.NET …..

7 Defining the.NET Framework The.NET Framework is  A software development environment  A runtime engine for Managed Code  A platform designed for Internet-Distributed software The.NET Framework is an exciting new computing platform

8 Web Server Client Web Server Second-Tier (database or other server) Second-Tier Internet Distributed Software

9 .NET Framework Features Cross Language Compatibility Platform Independent CTS (Common Type Specification)

10 Cross Language Support The.NET Framework supports many languages Any compiler can be modified to emit managed executables  IL and metadata Languages that target the.NET Framework  C#, Visual Basic, C++, Java, PERL, COBOL, SmallTalk  Dozens more existing and on the way Regardless of source language, all managed code can  Use the same tools  Use the same reusable components  Take advantage of features of the CLR Developers use their language of choice

11 Platform Independent Support.NET Linux Development tool has been created to date (Mono & DotGNU) Mono  Primary Component is CLR which executes.net Byte-code (MSIL)  Same as Java Runtime Environment. DotGNU  More Focused on Web Service area of.NET

12 Common Type Specification As.NET Application are converted into IL prior to deployment and execution,thus all primitive data types are represented as.NET data type VB.Net(Integer)=C#(int)=System.Int32(.NET Type)

13 Components of.NET Framework CLR (Common Language Runtime) FCL ( Framework Class Library)

14 Introducing the Common Language Runtime

15 Managed Code and the CLR The Common Language Runtime (CLR) is a runtime engine  Manages.NET Code (such as C# applications)  Provides features such as memory management, thread management, object type safety, security, etc.  Is a part of the.NET Framework

16 Windows (or other operating oystem) Common Language Runtime (JIT compilation, memory management, etc.) Legacy Software (unmanaged code) Managed Executable Reusable Managed Components The CLR and Managed Code

17 What is Managed Code Code that targets the CLR  C#, VB.NET, PERL, Java, C++, Cobol, etc. All Managed code has all features of CLR  Object oriented  Internet oriented  Access to the Framework Class Library (FCL) All Managed executables consist of  Intermediate Language (IL) instructions  Metadata

18 IL and Metadata IL  CPU independent machine language  Just-in-time compiled at runtime Metadata  Structured information  describes programming constructs including Classes definitions, field and method definitions, parameter lists, return types, etc.

19 ILDasm.exe Use ILDasm.exe to view IL for managed executable

20 Just-in-Time Compiling All managed code runs in native machine language All managed code is made up of IL and metadata The CLR JIT-compiles the IL and metadata  At execution time  Executed directly by CPU Allows for the best of both worlds  Code management features  Performance of full-speed execution

21 using System.Windows.Forms; using System.Drawing; class MyForm:Form{ public static void Main(){ Application.Run( new MyForm()); } protected override void OnPaint( PaintEventArgs e){ e.Graphics.DrawString( "Hello World!", new Font("Arial",35), Brushes.Blue, 10, 100); SomeSource.cs C# Compiler SomeSources.exe IL Metadata A Managed Application From Source Code to Managed.exe

22 Running Process’ Memory SomeSources.exe IL Metadata JIT Compiler Native Machine Language The CPU executes the JIT- compiled machine code directly At execution time the IL and Metadata are JIT compiled Executing a Managed Application

23 The Common Language Runtime The Common Language Runtime (CLR)  Execution engine of The.NET Framework  Offers many system services  Similar to an OS  Runs on a host OS The.NET Framework  New platform by Microsoft  Designed to target the Internet

24 The Purpose of the CLR… Safe binary execution  Security, memory protection  Running un-trusted code, locally Performance and Functionality  Native execution (JIT Compiled)

25 …The Purpose of the CLR Bug reduction  More code interacting, bugs affect more users Ease of integration Developer investment  Reuse skills from project to project, even if the projects are vastly different

26 Managed Code and the CLR The Common Language Runtime (CLR) is a runtime engine  Manages.NET Code (such as C# applications)  Provides features such as memory management, thread management, object type safety, security, etc.  Is a part of the.NET Framework Managed code  Code that targets the CLR  Any.NET Language, including C#, Visual Basic, C++, Java, Cobol, etc. The CLR and Managed Code

27 IL and Metadata All Managed executables consist of  Intermediate Language (IL) instructions  Metadata IL  CPU independent machine language  Just-in-time compiled at runtime Metadata  Structured information  describes programming constructs including Classes definitions, field and method definitions, parameter lists, return types, etc.

28 Automatic Memory Management The CLR manages memory for managed code  All allocations of objects and buffers made from a Managed Heap  Unused objects and buffers are cleaned up automatically through Garbage Collection Some of the worst bugs in software development are not possible with managed code  Leaked memory or objects  References to freed or non-existent objects  Reading of uninitialized variables Pointerless environment

29 A B E D C The Managed Heap = Object or buffer in memory class MyClass{ void Method(){ Variable v1; Variable v2; do{. Objects A and D will be cleaned up because neither is directly or indirectly referenced by code Garbage Collection

30 Garbage collection occurs when a new operation fails due to lack of memory All managed threads are stopped Collection starts with roots, and recursively finds referenced objects  Roots == globals, locals, cpu registers Referenced objects are moved down in the managed heap,  Making space available at the end  Removing unreachable objects  No Fragmentation References fixed-up and managed threads restarted

31 Types of Managed Applications Common application  GUI or windowed applications (Windows.Forms)  Console applications or command line apps Web applications (ASP.net)  Web forms applications  Web services Scripted code  Applications like word processors or database servers can host the CLR  Use any managed language (C#, VB, etc.) as a script or macro language Wherever you use managed code  Same compilers and tools  Same FCL  Same CLR (JIT compiled, object oriented, memory managed, etc.

32 CLR Summary The platform for managed code  C#, VB.NET, etc. Features  Memory management, security management, reflection, type safety  IL, metadata, JIT compilation  Assemblies, managed modules Understanding the platform will make coding.NET code easier  C#, VB.NET, etc.

33 Introducing the Framework Class Library

34 The Framework Class Library A huge collection of reusable types  Classes, interfaces, enumerations and structures For use by any managed code  Including code written in any managed programming language Types for  Common tasks such as collections, file IO, memory and thread management  GUI and window manipulation  Web form and web service applications Totally object oriented toolbox for developers  Ships as part of the.NET Framework

35 Using the FCL Types are arranged in a hierarchy of Namespaces A type’s full name includes its namespaces  Form class is actually System.Windows.Forms.Form  Use using to indicate namespaces in source code Assembly references are necessary for many types The SDK documentation is critical for using SDK types  Includes descriptions  Often includes useful code samples  Indicates namespaces and assemblies for types

36 Assembly vs. Managed Module Deployment of managed code broken-up into to logical concepts  Assembly  Managed module Managed module  Single physical file  Contains type definitions  Cannot be executed or used directly Assembly  Unit of versioning, deployment, and security  Can consist of multiple files Managed modules Resource files

37 Reasons for Assemblies Decouple concepts of physical and logical deployment  Logically, you deploy a complete assembly  Physically, deploy only necessary files Performance enhancement for network deployment Include resource files  No embedding  Resource files retain their identity Smiley.jpg, Info.xml, etc.

38 Versioning Assemblies Assemblies can be strongly named  Includes public/private key information Strong named assemblies bind by version  Code that uses V1 uses V1 even after V2 is installed on the system  Avoids DLL hell  Gives you the freedom to make V2 components incompatible with V1 Strong binding is a major improvement over DLLs

39 Top 10 Reasons to Move to.NET

40 Reason 1 In the past, the Microsoft architecture has been built on COM/DCOM, a binary standard for allowing cross- process communication that standard didn't have any relevance outside the Microsoft world In the past, the Microsoft architecture has been built on COM/DCOM, a binary standard for allowing cross- process communication that standard didn't have any relevance outside the Microsoft world ADO Recordset also saves data in Binary Format and Binary Format has no meaning for non Microsoft Environment. ADO Recordset also saves data in Binary Format and Binary Format has no meaning for non Microsoft Environment.. Net uses completely standards-based like Xml linked with XSD so that client can validate the data.. Net uses completely standards-based like Xml linked with XSD so that client can validate the data. SOAP is an XML-based protocol that communicates with Web services. The integration of SOAP allows for easy programmatic access by any client, whether or not that client is running a Microsoft operating system. SOAP is an XML-based protocol that communicates with Web services. The integration of SOAP allows for easy programmatic access by any client, whether or not that client is running a Microsoft operating system. XML, SOAP, and more Standards integration

41 Reason 2 COM makes extensive use of the Windows Registry to locate components on the machine. The concept was good, but there would only ever be a single instance of a component registered, and all applications would use the same version. COM promised to have new versions maintain backwards compatibility with old versions, but developers were free to break this compatibility, and sometimes did. COM makes extensive use of the Windows Registry to locate components on the machine. The concept was good, but there would only ever be a single instance of a component registered, and all applications would use the same version. COM promised to have new versions maintain backwards compatibility with old versions, but developers were free to break this compatibility, and sometimes did..Net doesn't use the registry, most deployments can simply be done with a copy command. There's often no need to develop installation files. Also, Web applications don't lock assemblies, so you don't have to shut down an application to update a DLL..Net doesn't use the registry, most deployments can simply be done with a copy command. There's often no need to develop installation files. Also, Web applications don't lock assemblies, so you don't have to shut down an application to update a DLL. Ease of Deployment

42 Reason 3 Microsoft is on the Web service bandwagon in a major way, and it's never been easier to develop Web services than it is with.Net. You can create simple Web services with Notepad and not even have to run them through a compiler; simply call them and.Net compiles them and even generates a test page so you can verify they are working..Net has all the plumbing needed and generates all the files you need, such as the WSDL file. Microsoft is on the Web service bandwagon in a major way, and it's never been easier to develop Web services than it is with.Net. You can create simple Web services with Notepad and not even have to run them through a compiler; simply call them and.Net compiles them and even generates a test page so you can verify they are working..Net has all the plumbing needed and generates all the files you need, such as the WSDL file..Net is also a smart consumer of Web services: Once you set a reference to a Web service, you treat it just like a local assembly. You get full Intelligence and function completion help..Net is also a smart consumer of Web services: Once you set a reference to a Web service, you treat it just like a local assembly. You get full Intelligence and function completion help. Web service support

43 Reason 4 User finally have an integrated set of tools for all your languages like VB.NET,C# etc. User finally have an integrated set of tools for all your languages like VB.NET,C# etc. Standard toolset for any.Net language

44 Reason 5 Soon after the release of Visual Studio.Net, Microsoft released the Microsoft Mobile Internet Toolkit (MMIT) for building mobile applications using.Net. This allows you to visually drag and drop controls on forms aimed at mobile devices. The toolkit handles writing the proper markup language (e.g., WML, WAP, and so forth). Soon after the release of Visual Studio.Net, Microsoft released the Microsoft Mobile Internet Toolkit (MMIT) for building mobile applications using.Net. This allows you to visually drag and drop controls on forms aimed at mobile devices. The toolkit handles writing the proper markup language (e.g., WML, WAP, and so forth). Coming soon will be the.Net Compact Framework, a scaled- down version of the Framework designed to run on Pocket PC devices. This will enable developers to create rich applications to run on Pocket PC computers. Coming soon will be the.Net Compact Framework, a scaled- down version of the Framework designed to run on Pocket PC devices. This will enable developers to create rich applications to run on Pocket PC computers. Support for mobile devices

45 Reason 6 Reduces Bugs Reduces Bugs Build More Scalable Applications Build More Scalable Applications.Net handles.Net handles  Allocating and recovering memory  Creating and destroying threads and processes  handling the access permissions of the running code  handling the access permissions of the running code. Managed code

46 Reason 7.NET Application can also be build and executed in other platforms like LINUX.NET Application can also be build and executed in other platforms like LINUX Platform Independent

47 Reason 8 Net has probably spawned more books than any other programming technology. Net has probably spawned more books than any other programming technology. There are a number of Web sites that provide techniques and tutorials for developers moving to.Net. There are a number of Web sites that provide techniques and tutorials for developers moving to.Net. No lack of learning resources

48 Reason 9 Completely OOPS Completely OOPS The languages were built with an n-tier, component-based approach in mind. The languages were built with an n-tier, component-based approach in mind. Modernized languages

49 Reason 10 One of the banes of VB developers has been that a string in VB was not the same as a string in C++, so when calling Windows API functions, there could be some problems..Net specifies a standard definition for all types, so a string in VB.Net is the same as a string in C#, which is the same as a string in netCOBOL.Net. One of the banes of VB developers has been that a string in VB was not the same as a string in C++, so when calling Windows API functions, there could be some problems..Net specifies a standard definition for all types, so a string in VB.Net is the same as a string in C#, which is the same as a string in netCOBOL.Net. Standard base types across languages

50 THANKS Prepared By : Manu Sharma IBE Team


Download ppt ".NET Session Prepared By : Manu Sharma IBE Team. Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET."

Similar presentations


Ads by Google