1 / 28

Introduction to .NET

Introduction to .NET. Manuel Costa Academic Computer Science Program Manager manuelc@microsoft.com. What is .NET?. A development platform: interfaces, components and tools to develop software The biggest change in the Microsoft platform since Windows NT replaced DOS Changes include:

paki-irwin
Télécharger la présentation

Introduction to .NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to .NET Manuel Costa Academic Computer Science Program Manager manuelc@microsoft.com

  2. What is .NET? • A development platform: interfaces, components and tools to develop software • The biggest change in the Microsoft platform since Windows NT replaced DOS • Changes include: • Code formats, compilers, • Code loading and execution models, • Security model, • Object model, metadata, remoting protocols • Class libraries, • …

  3. .NET: PrinciplesThe Microsoft Vision for Computing • Make Internet-scale distributed computing ubiquitous • Exploit inexpensive cycles and bandwidth • Seamless integration of multiple applications and devices • Deliver software as a service • Next generation user experience The .NET Framework is the programming-model substrate for the .NET vision

  4. ASP.NET Web Forms Web Services Mobile Devices Windows Forms .NET Framework • Common Language Runtime (CLR) • Multi-language support • Common type system • Simplified deployment • Code Access Security • Rich Class libraries • Powerful, Consistent Programming Model • Focus on code, not plumbing • Built for Tools • Support for design-time functionality • Debugging, profiling, instrumentation support ADO.NET and XML Base Class Library Common Language Runtime

  5. Compiler Assembly Common Language Runtime DEVELOPMENT public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable("USERNAME"); f=new FileStream(“C:\\test.txt",FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine("Exception:"+e.ToString()); } } public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable("USERNAME"); f=new FileStream(“C:\\test.txt",FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine("Exception:"+e.ToString()); } } Source code C# J# VB Cobol … CIL Metadata Resources

  6. DEVELOPMENT DEVELOPMENT public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable("USERNAME"); f=new FileStream(“C:\\test.txt",FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine("Exception:"+e.ToString()); } } GlobalAssemblyCache (GAC) public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable("USERNAME"); f=new FileStream(“C:\\test.txt",FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine("Exception:"+e.ToString()); } } Compiler Assembly Assembly Source code C# J# VB Cobol … CIL Metadata Resources ApplicationDirectory Download Cache Install Common Language Runtime DEPLOYMENT Setup Copy Browser

  7. DEVELOPMENT Assemblyon Target Machine GlobalAssemblyCache (GAC) Assembly Setup Copy Browser ApplicationDirectory Class Loader Security Assembly Loader IL to NativeCompiler Download Cache Garbage Collection Code Manager Exception Manager Native .exe + GC table Thread Support COM Interop Install Debug Engine Common Language Runtime DEPLOYMENT Policy <?xml version="1.0" encoding="utf-8" ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version="1"> <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="Nothing" Name="All_Code" Description="Code group grants no permissions and forms the root of the code group tree."> <IMembershipCondition class="AllMembershipCondition" version="1"/> <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" EXECUTION

  8. .NET Framework Namespace System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls Protocols System.Drawing Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO SQL XSLT Serialization Design SQLTypes XPath System Collections IO Security Runtime InteropServices Configuration Net ServiceProcess Remoting Diagnostics Reflection Text Serialization Globalization Resources Threading

  9. .NET Framework Design Goals • Simplify application development • Provide a robust and secure execution environment • Support multiple programming languages • Simplify deployment and management

  10. Simplify Development Windows API HWND hwndMain = CreateWindowEx( 0, "MainWinClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain); .NET Framework Form form = new Form(); form.Text = "Main Window"; form.Show();

  11. Simplify Development • Organization • Code organized in hierarchical namespaces and classes • Unified type system • Everything is an object, no variants, one string type, all character data is Unicode • Component Oriented • Properties, methods, events, and attributes are first class constructs • Design-time functionality

  12. Robust And Secure • Automatic lifetime management • All .NET objects are garbage collected • No stray pointers, no circular references • Code correctness and type-safety • IL can be verified to guarantee type-safety • No unsafe casts, no uninitialized variables, no out-of-bounds array indexing • Evidence-based security • Based on origin of code as well as user • Extensible permissions

  13. Multi-Language Platform • The freedom to choose language • All features of .NET platform available to any .NET programming language • Application components can be written in multiple languages • Debuggers, profilers, code coverage analyzers, etc. work for all languages • Available Compilers • From Microsoft: VB, C++, C#, JScript, Java • From other companies/universities: APL, COBOL, Eiffel, Fortran, Haskell, ML, Perl, Python, RPG, Scheme, Smalltalk, …

  14. Consistent API availability regardless of language and programming model .NET Framework RAD, Composition, Delegation Subclassing, Power, Expressiveness Stateless, Code embedded in HTML pages ASP VB Forms MFC/ATL Windows API Unify Programming Models

  15. Broad Language Support VB.NET Dim s as String s = "authors" Dim cmd As New SqlCommand("select * from " & s, sqlconn) cmd.ExecuteReader() C# string s = "authors"; SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn); cmd.ExecuteReader(); C++ String *s = S"authors"; SqlCommand cmd = new SqlCommand(String::Concat(S"select * from ", s), sqlconn); cmd.ExecuteReader();

  16. Broad Language Support J# String s = "authors"; SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn); cmd.ExecuteReader();

  17. Broad Language Support var s = "authors" var cmd = new SqlCommand("select * from " + s, sqlconn) cmd.ExecuteReader() JScript Perl String *s = S"authors"; SqlCommand cmd = new SqlCommand(String::Concat(S"select * from ", s), sqlconn); cmd.ExecuteReader(); Python s = "authors" cmd =SqlCommand("select * from " + s, sqlconn) cmd.ExecuteReader()

  18. ENVIRONMENT DIVISION. CONFIGURATION SECTION. REPOSITORY. CLASS SqlCommand AS "System.Data.SqlClient.SqlCommand"     CLASS SqlConnection AS "System.Data.SqlClient.SqlConnection". DATA DIVISION. WORKING-STORAGE SECTION. 01 str PIC X(50). 01 cmd-string PIC X(50). 01 cmd OBJECT REFERENCE SqlCommand. 01 sqlconn OBJECT REFERENCE SqlConnection. PROCEDURE DIVISION. *> Establish the SQL connection here somewhere. MOVE "authors" TO str. STRING "select * from " DELIMITED BY SIZE,    str DELIMITED BY " " INTO cmd-string. INVOKE SqlCommand "NEW" USING BY VALUE cmd-string sqlconn RETURNING cmd. INVOKE cmd "ExecuteReader". Cobol Broad Language Support

  19. Broad Language Support RPG DclFld MyInstObj Type( System.Data.SqlClient.SqlCommand )  DclFld s Type( *string )  s = "authors"  MyInstObj = New System.Data.SqlClient.SqlCommand("select * from "+s, sqlconn)  MyInstObj.ExecuteReader() Fortran assembly_external(name="System.Data.SqlClient.SqlCommand") sqlcmdcharacter*10 xsqlcmd Cmd x='authors' cmd = sqlcmd("select * from "//x, sqlconn)           call cmd.ExecuteReader() end 

  20. APL Broad Language Support s←String.New ‘authors’ cmd←SqlCommand.New (‘select * from ‘,s.ToString σ) sqlconn cmd.ExecuteReader     |s| := 'authors'.     |cmd| := SqlCommand('select * from '+s, sqlconn).     cmd.ExecuteReader(). Smalltalk

  21. Broad Language Support Scheme (let* ( (s "authors")   (cmd (new-SqlCommand (string-append "select * from " s) sqlconn))) (execute-command cmd)) local       s: STRING       cmd: SQLCOMMAND do      s := "authors"       create cmd("select * from " + s, sqlconn)       cmd.ExecuteReader() end Eiffel ExecuteReader = invoke System.Data.SqlClient.ExecuteReader(); SqlCommand = create System.Data.SqlClient.SqlCommand(String,\ System.Data.SqlClient.SqlConnection); query = sqlconn -> let{ s = "authors"; } in {    cmd <- SqlCommand ("select * from "+s, sqlconn);   cmd # ExecuteReader();    }; Mondrian

  22. Simplify Deployment And Management • Assemblies • The unit of deployment, versioning, and security • Like DLLs, but self-describing through manifest • Zero-impact install • Applications and components can be shared or private • Side-by-side execution • Multiple versions of the same component can co-exist, even in the same process

  23. .NETCalendar .NETContacts .NETInbox XML Web Services: “Anytime, Anywhere, on any Device” SOAP Web App SOAP HTTP HTML SOAP Gateway Custom/ WAP

  24. .NET Compact Framework • .NET Framework for Embedded Devices

  25. Standardizing .NET • CLI and C# standardized by ECMA • Submission with Intel and Hewlett-Packard • On December 13, 2001, the ECMA General Assembly ratified the C# and common language infrastructure (CLI) specifications into international standards. • Some companies are implementing the ECMA specs, e.g. Ximian and Project Mono (.NET on Linux) • Microsoft will provide a shared-source implementation on FreeBSD and Windows • http://msdn.microsoft.com/net/ecma/

  26. How to try the .NET platform? • .NET Framework SDK (essential) • CLR, command line compilers, debuggers, class libraries, documentation, … • Free Download • Size: ~100 MB • Tool Developers Guide • Specs: IL, Metadata, Debugging, Security, etc • Source code: CLisp, Simple C, debugger, profiler, … • Visual Studio .NET (optional) • IDE (Integrated Development Environment) • Size: ~1.5 GB

  27. .NET in Summary • The Microsoft software development platform for the next decade • Based on standards, across languages, across devices • Based on the idea of ubiquitous XML Web Services

  28. More Information … http://msdn.microsoft.com/net

More Related