Download presentation
2
.NET Framework Overview
.NET and the .NET Framework
3
Objectives Learn basic principles and concepts of.NET and the .NET framework Contents Looking Back .NET and .NET Framework Overview Summary Questions
4
Section 1: Looking Back Challenges for the development organization
Challenges for the corporate customer Missing ????
5
Challenges for Development Organization
Language and operating system choices Delivery CD-ROM: production, packaging, transport Stability DLL compatibility issues Operating system—pollution leads to instability Compatibility tests with “popular” solutions Maintenance Customer involvement, even for critical updates Packaging, production, and delivery of medium
6
Challenges for the Corporate Customer
Deployment Installation often requires time and personnel Testing for compatibility with existing applications and OS License management Stability and security Requires (even more!) testing Can lead to inadvertent breaches of security Can destabilize the system or other solutions [ Registry] Maintenance All the problems of deployment and security revisited!
7
Missing ???? We need all system features to be available to programmers in any language. We’d like our code to be able to run on a variety of platforms. We need help with managing different versions of the same software package. We’d like object-oriented programming features to be available in and between all programming languages. For safety, we want to be able to restrict the operations of pieces of code we don’t fully trust.
8
The .NET Framework Design Goals What were missing are goals !!!!
"Cross-Language Development” Inheritance, Debugging, Exception handling Reliability and Security Simple Development and Deployment Device-agnostic The .NET Framework is all about cross-language development. Languages supported by .NET (move to next slide and come back) … at last count, over 20 of them. These are languages for which compilers that target the Common Language Specification have been written. The code written using Visual C#® .NET (as a matter of fact any .NET compliant language) should be usable in another language such as Visual Basic® .NET. Later on these two code modules should be usable in, yet another language like Jscript® etc and so on. In order to make the above said statement possible there should be a common run time environment, which can understand all these languages. Some of the architectural details of how distributed objects talk to each other remotely in the .NET framework are very similar to existing architectures (CORBA, COM, RMI in Java). So what makes .NET so different? To repeat a point made earlier, the .NET framework is truly language interoperable. Not just by a standardized calling model similar to what COM and CORBA provide, but by a schema that allows classes and objects in one language to be used at the same level in other languages.
9
Section 2: .NET Framework Overview
What Is .NET? Migration Paths—from Anywhere to .NET Key Benefits of .NET
10
Concept of Platform independence & Language Independence
Byte Code Native Code Java Code Java Compiler JRE MS-IL Code Native Code C# Code IL Compiler CLR VB.NET Code IL Compiler
11
Managed code Code running under control of the CLR is called Managed code Platform Independence : Mono - Linux Mono - Mac .NET framework - windows Performance Improvement [JIT] Language interpretability [ IL1 + SC2 = IL2 ]
12
Strong Data typing IL – No ambiguous data type
VB variant (NO) VB.NET Integer - C# no Integer CTS – COMMON TYPE SPECIFICATION Predefined data types that are in IL .NET languages targets code depends on these types VB.NET Integer & C# int – IL’s Int32 CTS defines rich hierarchy of types.
13
What is . NET? .Net = Library + Environment
Library : like extension of API Environment : Layer between OS and Application.
14
.NET Framework Architecture
Data Connectivity C# VB C++ Scheme … Visual Studio.NET XML Services User Interfaces Common Language Specification ASP .NET Windows Forms ADO .NET and XML Base Framework Base Class Library (When you come to this slide – all you will see is the title until you start clicking. Before clicking, say:) The .NET platform is the combination of: .NET Framework, Web Services and .NET Enterprise Servers The .NET Framework, as you will learn, comprises three different elements: The common language runtime, Class libraries, organized into easily comprehensible namespaces and ASP.NET (This is a slide where all the pieces fly in. When the OS component comes in, click until the CLR component comes in. At this point, say: ) The CLR sits on top of the Operating System. (Keep clicking) The base class library sits on top of the CLR. To enable the creation of Web Services as well as the manipulation of data in a web enabled environment, the Framework provides ASP. NET and ADO. NET On top of all this sits the Common Language Specification. This spec lays out how to write a compiler for a language such that it targets the .NET framework. The CLS has been standardized by ECMA. Remember that the main reason you would want to do this is so that the language can take advantage of all the features of the Common Language Runtime. You now know that the .NET Framework is composed of: the common language runtime, class libraries, and ASP.NET. (when you click again, the diagram aggregates. More flying boxes ! When the ‘Base Framework’ box covers the CLR and Base Class Library box:) The Base Framework is composed of the common language runtime and the Base Classes. You will learn more about the common language runtime later, but, in brief, it is the component responsible for making languages natively interoperable. (Click again as you go through the rest) The rest of the Framework: Provides for general input/output (I/O) including file access, XML support, and services. Exposes Web technology and services from protocols like HTTP to standards like XML, XSL, HTML etc. Provides user interface (UI) elements for building Web pages and/or traditional Windows Forms–based UIs. Exposes many other services. (When the VS. NET rectangle appears) Visual Studio® .NET is now a single, unified IDE (integrated development environment) which makes learning simpler, multi-language development more efficient. Shared tools and designers increase efficiency, Debugging has been improved, and it now includes the ability to debug across multiple projects and processes. These changes have been incorporated to help developers be more productive. Altogether, the .NET Framework provides the functionality and services you need to build any desktop application or Web service solution you can imagine! Common Language Runtime Operating System
15
Common Language Runtime
Base Class Library Support Thread Support COM Marshaler Type Checker Exception Manager Security Engine Debug Engine MSIL to Native Compilers (JIT) Code Manager Garbage Collector (GC) (Talk about each element as they come into the screen – this a build-up slide) Here are the features we just talked about and some others as well. We will not be addressing all these features in depth today. Class Loader : Loads the relevant classes from the libraries into memory. [Garbage Collector] A garbage collector automates memory management. It ensures the references to objects in memory are no longer referenced, and also releases resources tied to this object. [Code Manager] At run time, the common language runtime is responsible for managing memory, starting up and stopping threads and processes, and enforcing security policies, as well as satisfying any dependencies that one component may have on any other component. [MSIL to JIT] MS IL (MS Intermediate Language) is a language abstraction layer of the CLR. It is object oriented and any language targeted for the framework is first converted into IL. A just-in-time (JIT) compiler that translates the Microsoft intermediate language (MSIL) code optimizes it for a specific target machine. It does this using metadata. Thus, with .NET, code always executes natively on the system processor. [Security Engine] The runtime provides extensive security based on policies and permissions that allow the dynamic creation of execution environments for dynamically downloaded, mistrusted code. On the other hand, it will grant full access to trusted code. [Exception Manager] The runtime has its own exception-handling model that is integrated with the exception model of the underlying operating system and the exception features of the respective programming languages. This enables you to use a consistent exception model across the entire .NET platform. [Type Checker] The Type checker makes sure that the types used in your language meets the specifications of the framework and will work with the CLR. The Thread Support features of the CLR manages threading efficiently. The runtime also encapsulates and exposes the threading model of the underlying operating system to .NET applications in an object-oriented way. This makes it easy to write applications that take full advantage of the OS features. The runtime also provides profiling support for diagnostics, debugging, and optimizing. Despite its name, the common language runtime actually has a role in a component’s development time as well as the run-time experience. Runtimes are nothing new for programming languages—virtually every programming language has one. The Microsoft Visual Basic development system has a runtime (the aptly named VBRUN), Microsoft Visual C++® has one (MSVCRT), as does Microsoft Visual FoxPro®, JScript, Smalltalk, Perl, Python, and Java and Tcl/Tk. The critical role of the .NET Framework—and what really sets it apart—is that it provides a unified environment across all programming languages. [Click – to get ‘Base Class Library’ rectangle] We won’t address the COM Marshaler today, but we will talk about the Class library later. Class Loader
16
JIT – Just In Time IL is always JIT compiled where java byte code was interpreted IL never compiled to native code in one go, JIT compiler simply each portion of code as it is called (Just In Time) Then resultant native code is stored until the application exits. So no need to recompile Since final stage JIT Compiler know exactly what processor type the program will run on. Take advantage of particular machine code instruction.
17
Garbage Collector Before GC
Make the application code do it manually [ C++ ] Resources never occupied for longer than unnecessary. Code that request memory should explicitly inform the system when it no longer requires that memory. Make objects maintain reference counts [ COM ] COM component maintain a count of how many clients are currently maintaining reference to it. When reference count reaches to zero, component can destroy itself and free up memory and resources.
18
GC – Clean up memory Dynamically requested memory allocated on heap.
When heap gets full and needs tidying up, it calls garbage collector. GC examining references to objects stored on the heap to identify which one are accessible from your code. Objects that are not referred to are deemed to be no longer accessible from your code and therefore be removed. The garbage collector has access to the list of active roots that the just-in-time (JIT) compiler and the runtime maintain. (Strong references)
19
Languages Ada APL Basic (Visual Basic) C# C C++ J# COBOL
Component Pascal (Queensland Univ of Tech) ECMAScript (JScript) Eiffel (Monash University) Haskell (Utrecht University) lcc (MS Research Redmond) Mondrian (Utrecht) ML (MS Research Cambridge) Mercury (Melbourne U.) Oberon (Zurich University) Oz (Univ of Saarlandes) Perl Python Scheme (Northwestern U.) SmallTalk Some of these compilers were built as a result of partnerships with academics and companies. Mondrian and Haskell Beta 5 compilers are available for download from the site. Visual J#TM .NET is an implementation of the Java Language sytnax by Microsoft and provides most of the functionality in JDK Lahey Computer Systems, Inc. and Fujitsu Limited have teamed up to integrate Lahey/Fujitsu Fortran with the Microsoft .NET Framework and Visual Studio.NET development environment. PerlNET Beta 5 is now available for those with access to .NET Framework SDK Beta 2. Python: Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many brands of UNIX, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2. Python and .NET: Python for .NET is a compiler and runtime that implements Python on the Microsoft .NET platform. The .NET platform provides a runtime and metadata system designed to allow complete language interoperability, but to achieve that, the languages have to work in that runtime. For example, if a Python class is made public so that a Visual Basic programmer can inherit from it, the Python class has to be implemented and described in .NET terms, not in CPython terms. has a production level release of ActivePython for Windows.
20
Key Benefits of .NET Ease of Use Freedom to Choose:
Object-oriented model Everything is an object Namespace and Framework structure Easier to comprehend and use Naming scheme of namespaces reflects the underlying functionality Freedom to Choose: The language that meets your needs The development tool that is best for you The “features and functionality” to “plug in to”
21
Key Benefits of .NET Stability Security Say “goodbye” to memory leaks
Garbage collection manages memory Assembly eliminates DLL compatibility issues Deliverables are restricted to an assembly Security Restricting or containing the illegal memory reference Comprehensive security model Assembly specific System wide Code inspection through MSIL
22
Key Benefits of .NET Deployment and Management
Deployment: Code is “Assembled” and Run “Securely” Maintenance: Version Maintenance Simplified The Web the Way You Want It Anywhere Anytime On any device
23
The Framework COM Interoperability
Sample of what’s in the framework COM Interoperability Registry Monitoring System Events Windows® Management Interface Globalization Configuration Diagnostics Reflection Microsoft® .NET Base Class Libraries File IO Networking Database Access XML Security Cryptography Threading Enterprise Services Graphics Examples
24
The .NET Framework Namespaces
System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls Protocols System.Drawing Caching Security Drawing2D Printing Configuration SessionState Imaging Text System.Data System.Xml ADO SQL XSLT Serialization Design SQLTypes XPath Like book organization in a library System Collections IO Security Runtime InteropServices Configuration Net ServiceProcess Remoting Diagnostics Reflection Text Serialization Globalization Resources Threading
25
IL Compilers CSC & vbc out target:exe winexe library o warn: 0-4
nowarn unsafe checked nologo main reference lib
26
Configuration and Deployment Tools
Type Library Exporter (Tlbexp.exe) Type Library Importer (Tlbimp.exe) Web Services Description Language Tool (Wsdl.exe) Web Services Discovery Tool (Disco.exe) XML Schema Definition Tool (Xsd.exe) ASP.NET Install (aspnet_regiis.exe) Global Assembly Cache tool (gacutil.exe) .NET Framework Configuration Tool (mscorcfg.msc) Installer tool (installutil.exe) Talking Guideline: Explain GAC Focus on gacutil.exe and mscorcfg.msc. No need to explain the others in detail, definitions in notes are for reference only. After talking about GAC, gacutil and mscorcfg, explain that there are a number of other tools are well that are included in the .NET SDK. What is the global assembly cache? Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, you do not have to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code. Assemblies must have a strong name to be added to the GAC. Shfusion.dll Allows you to view and manipulate the contents of the global assembly cache using Windows Explorer. Gacutil.exe Allows you to view and manipulate the contents of the global assembly cache and download cache. While Shfusion.dll provides similar functionality, you can use Gacutil.exe from build scripts, makefile files, and batch files. Installutil.exe Allows you to install and uninstall server resources by executing the installer components of a specified assembly. Mscorcfg.msc Provides a graphical interface for managing .NET Framework security policy and applications that use remoting services. This tool also allows you to manage and configure assemblies in the global assembly cache. Tlbexp.exe Generates a type library from a common language runtime assembly. Tlbimp.exe Converts the type definitions found within a COM type library into equivalent definitions in managed metadata format. Wsdl.exe Generates code for XML Web services and XML Web services clients from Web Services Description Language (WSDL) contract files, XML Schema Definition (XSD) schema files, and .discomap discovery documents. Web Services Discovery Tool (Disco.exe) (Disco.exe)Discovers the URLs of XML Web services located on a Web server, and saves documents related to each XML Web service on a local disk. XML Schema Definition Tool (Xsd.exe) Generates XML schemas that follow the XSD language proposed by the World Wide Web Consortium (W3C). This tool generates common language runtime classes and DataSet classes from an XSD schema file.
27
Security Tools Code Access Security Policy Tool (Caspol.exe)
File Signing Tool (Signcode.exe) Permissions View Tool (Permview.exe) PEVerify Tool (PEverify.exe) Secutil Tool (Secutil.exe) Strong Name Tool (Sn.exe) Code Access Security Policy Tool (Caspol.exe) Allows you to examine and modify machine, user, and enterprise-level code access security policies. File Signing Tool (Signcode.exe) Signs a portable executable (PE) file with an Authenticode digital signature. Permissions View Tool (Permview.exe) Displays the minimal, optional, and refused permission sets requested by an assembly. You can also use this tool to view all declarative security used by an assembly. PEVerify Tool (PEverify.exe) Performs MSIL type safety verification checks and metadata validation checks on a specified assembly. Secutil Tool (Secutil.exe) Extracts strong name public key information or Authenticode publisher certificates from an assembly, in a format that can be incorporated into code. Strong Name Tool (Sn.exe) Helps create assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature verification.
28
General Tools Common Language Runtime Minidump Tool (Mscordmp.exe)
mscordmp /pid [pid number] /out [output file] MSIL Assembler (Ilasm.exe) MSIL Disassembler (Ildasm.exe) Resource File Generator Tool (Resgen.exe) Windows Forms Class Viewer (Wincv.exe) Common Language Runtime Minidump Tool (Mscordmp.exe) Creates a file containing information that is useful for analyzing system issues in the runtime. The Microsoft Dr. Watson tool (Drwatson.exe) invokes this program automatically. MSIL Assembler (Ilasm.exe) Generates a PE file from Microsoft intermediate language (MSIL). You can run the resulting executable, which contains MSIL code and the required metadata, to determine whether the MSIL code performs as expected. MSIL Disassembler (Ildasm.exe) Takes a PE file that contains MSIL code and creates a text file suitable as input to the MSIL Assembler (Ilasm.exe). Resource File Generator Tool (Resgen.exe) Converts text files and .resx (XML-based resource format) files to .NET common language runtime binary .resources files that can be embedded in a runtime binary executable or compiled into satellite assemblies. Windows Forms ActiveX Control Importer (Aximp.exe) Converts type definitions in a COM type library for an ActiveX control into a Windows Forms control. Windows Forms Class Viewer (Wincv.exe) Finds managed classes matching a specified search pattern, and displays information about those classes using the Reflection API.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.