MicrosoftMicrosoft .NET.NET FrameworkFramework 7th Brazilian Symposium on Programming Languages Ouro Preto, MG, Brazil - May 28-30, 2003

AlissonAlisson SolSol SoftwareSoftware DesignDesign EngineerEngineer LeadLead MicrosoftMicrosoft CorporationCorporation AcknowledgementsAcknowledgements

RedmondRedmond teamsteams MicrosoftMicrosoft BusinessBusiness SolutionsSolutions InformationInformation WorkerWorker –– NewNew MarketsMarkets PartPart II basedbased onon presentationpresentation byby BradBrad AbramsAbrams MicrosoftMicrosoft BrasilBrasil UniversityUniversity RelationsRelations LegalLegal WarningWarning OpinionsOpinions inin thisthis presentationpresentation dodo notnot necessarilynecessarily representrepresent thosethose ofof MicrosoftMicrosoft CorporationCorporation

Microsoft .NET Framework - 2 SummarySummary

PartPart II –– .NET.NET FrameworkFramework OverviewOverview Concepts Architecture Features PartPart IIII –– ApplicationApplication DevelopmentDevelopment Samples Tools NoteNote Some concepts from C# language presented on another lecture Will not explain programming language details

Microsoft .NET Framework - 3 .NET.NET FrameworkFramework OverviewOverview

MicrosoftMicrosoft .NET.NET FrameworkFramework -- PartPart II DefinitionDefinition

OldOld .NET.NET isis thethe MicrosoftMicrosoft platformplatform forfor XMLXML WebWeb services.services. NewNew .NET.NET isis thethe setset ofof MicrosoftMicrosoft technologiestechnologies forfor connectingconnecting youryour worldworld ofof information,information, ,people, systems,systems, andand devices.devices. .NET.NET isis infusedinfused intointo thethe MicrosoftMicrosoft platformplatform providingproviding thethe abilityability toto build,build, host,host, deploydeploy andand consumeconsume XMLXML WebWeb serviceservice connectedconnected solutions.solutions.

Microsoft .NET Framework - 5 DesignDesign GoalsGoals

SimplifiedSimplified developmentdevelopment UnifiedUnified programmingprogramming modelsmodels WebWeb standardsstandards andand bestbest practicespractices SimpleSimple toto deploy,deploy, run,run, && maintainmaintain

Microsoft .NET Framework - 6 Framework,Framework, Languages,Languages, AndAnd ToolsTools

VB C++ C# JScript …

Common Language Specification Visual Studio.NET

ASP.NET

Data and XML

Base Class

Common Language Runtime Microsoft .NET Framework - 7 Framework,Framework, Languages,Languages, AndAnd ToolsTools

VB C++ C# JScript …

Common Language Specification Visual Studio.NET

ASP.NET Windows Forms

Data and XML

Base Class Library

Common Language Runtime Microsoft .NET Framework - 8 CLRCLR DesignDesign GoalsGoals

DramaticallyDramatically simplifysimplify applicationapplication developmentdevelopment ProvideProvide aa robustrobust andand securesecure executionexecution environmentenvironment SupportSupport multiplemultiple programmingprogramming languageslanguages SimplifySimplify deploymentdeployment andand managementmanagement

Microsoft .NET Framework - 9 TheThe .NET.NET EvolutionEvolution

Application

Code and data structures

Before COM, applications were completely separate entities with little or no integration

Microsoft .NET Framework - 10 TheThe .NET.NET EvolutionEvolution

COM provides a way for components to integrate. However, each component must provide the “plumbing” and objects cannot directly interact. Microsoft .NET Framework - 11 TheThe .NET.NET EvolutionEvolution

With the .NET Framework common language runtime, components are built on a common substrate. No “plumbing” is needed and objects can directly interact

Microsoft .NET Framework - 12 SimplifySimplify DevelopmentDevelopment

CompletelyCompletely eliminateseliminates COMCOM plumbingplumbing NoNo more…more… RegistrationRegistration =>self described apps GUIDsGUIDs =>hierarchical namespaces .IDL.IDL filesfiles =>unified object model HRESULTsHRESULTs =>structured exceptions IUnknownIUnknown =>common root object AddRef/releaseAddRef/release =>garbage collector CoCreateInstanceCoCreateInstance =>”new” operator

Microsoft .NET Framework - 13 SimplifySimplify DevelopmentDevelopment

CommonCommon TypeType SystemSystem CommonCommon instanceinstance andand typetype definitiondefinition EnablesEnables cleanclean OOOO programmingprogramming ClassesClasses andand InterfacesInterfaces Constructors,Constructors, Properties,Properties, MethodsMethods CrossCross languagelanguage inheritanceinheritance

Microsoft .NET Framework - 14 InheritanceInheritance

Animal C#C#

Mammal Bird JavaJava VBVB

Microsoft .NET Framework - 15 CommonCommon LanguageLanguage RuntimeRuntime

Base Class Library Support

Thread Support COM Marshaler

Type Checker Exception Manager

Security Engine Debug Engine

IL to Native Code Garbage Compilers Manager Collector

Class Loader

Microsoft .NET Framework - 16 CompilationCompilation andand ExecutionExecution

Compilation

Code Source Language MSIL Code Compiler Metadata

Native JIT Code Compiler Before installation or the first time each Execution method is called

Microsoft .NET Framework - 17 MetadataMetadata

KeyKey toto simplersimpler programmingprogramming modelmodel GeneratedGenerated automaticallyautomatically StoredStored withwith codecode inin executableexecutable filefile (.dll(.dll oror .exe).exe) UsesUses existingexisting COFFCOFF formatformat Via existing extension mechanism StoredStored inin binarybinary formatformat ConvertibleConvertible to/fromto/from XMLXML SchemaSchema ConvertibleConvertible to/fromto/from COMCOM typetype librarieslibraries

Microsoft .NET Framework - 18 Metadata:Metadata: CreationCreation AndAnd UseUse

Source Reflection Serialization Code (e.g. SOAP) Designers Other Compiler Compiler Debugger

Type Browser MetadataMetadata Profiler (and code)

Schema Proxy Generator Generator XML encoding (WSDL)

Microsoft .NET Framework - 19 RobustRobust AndAnd SecureSecure

AutomaticAutomatic lifetimelifetime managementmanagement AllAll .NET.NET objectsobjects areare garbagegarbage collectedcollected NoNo straystray pointers,pointers, nono circularcircular referencesreferences MultiMulti--generationalgenerational markmark--andand--compactcompact GCGC SelfSelf configuring,configuring, dynamicallydynamically tunedtuned ExceptionException handlinghandling ErrorError handlinghandling isis aa 1st1st classclass conceptconcept (not(not boolbool oror HRESULTs)HRESULTs) DramaticallyDramatically improvedimproved errorerror reportingreporting IntegratedIntegrated withwith windowswindows SEHSEH Microsoft .NET Framework - 20 RobustRobust AndAnd SecureSecure

Native code compilation MSIL No interpreter Install-time or run-time IL to native compilation C++ managed extensions 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 Policy grants permissions based on evidence (signatures, origin) Extensible permissions and policy

Microsoft .NET Framework - 21 MultiMulti--languagelanguage PlatformPlatform

TheThe freedomfreedom toto choosechoose languagelanguage AllAll featuresfeatures ofof .NET.NET platformplatform availableavailable toto anyany .NET.NET programmingprogramming languagelanguage ApplicationApplication componentscomponents cancan bebe writtenwritten inin multiplemultiple languageslanguages HighlyHighly leveragedleveraged toolstools Debuggers,Debuggers, profilers,profilers, codecode coveragecoverage analyzers,analyzers, etc.etc. WorkWork forfor allall languageslanguages

Microsoft .NET Framework - 22 DeploymentDeployment AndAnd ManagementManagement

AssembliesAssemblies TheThe unitunit ofof deployment,deployment, versioning,versioning, andand securitysecurity LikeLike DLLs,DLLs, butbut selfself--describingdescribing throughthrough manifestmanifest ZeroZero--impactimpact installinstall ApplicationsApplications andand componentscomponents cancan bebe sharedshared oror privateprivate SideSide--byby--sideside executionexecution MultipleMultiple versionsversions ofof thethe samesame componentcomponent cancan coco--exist,exist, eveneven inin thethe samesame processprocess

Microsoft .NET Framework - 23 AssembliesAssemblies

UnitUnit ofof deploymentdeployment One or more files, independent of packaging Self-describing via manifest VersioningVersioning Provided by compiler use of attributes Policy per-application as well as per-machine SecuritySecurity boundaryboundary Assemblies are granted permissions Methods can demand proof that a permission has been granted to entire call chain TypesTypes namednamed relativerelative toto assemblyassembly

Microsoft .NET Framework - 24 SeamlessSeamless IntegrationIntegration

AnyAny .NET.NET classclass cancan bebe usedused asas aa COMCOM classclass withwith zerozero extraextra workwork COMCOM classesclasses cancan bebe importedimported asas .NET.NET classesclasses .NET.NET classesclasses utilizeutilize com+com+ servicesservices TransactionsTransactions ObjectObject poolingpooling Etc…Etc… DLLDLL entryentry pointspoints C++C++ managedmanaged extensionsextensions Microsoft .NET Framework - 25 Framework,Framework, Languages,Languages, AndAnd ToolsTools

VB C++ C# JScript …

Common Language Specification Visual Studio.NET

ASP.NET Windows Forms

Data and XML

Base Class Library

Common Language Runtime Microsoft .NET Framework - 26 FrameworkFramework DesignDesign GoalsGoals

MakeMake itit simplesimple toto useuse FactoredFactored andand extensibleextensible WebWeb standardsstandards andand practicespractices asas thethe foundationfoundation UnifyUnify applicationapplication modelsmodels

Microsoft .NET Framework - 27 MakeMake ItIt SimpleSimple ToTo UseUse

OrganizationOrganization CodeCode organizedorganized inin hierarchicalhierarchical namespacesnamespaces andand classesclasses UnifiedUnified typetype systemsystem EverythingEverything isis anan object,object, nono variants,variants, oneone stringstring type,type, allall charactercharacter datadata isis UnicodeUnicode ComponentComponent OrientedOriented Properties,Properties, methods,methods, events,events, andand attributesattributes areare firstfirst classclass constructsconstructs DesignDesign--timetime functionalityfunctionality

Microsoft .NET Framework - 28 HowHow MuchMuch Simpler?Simpler? Windows API

HWND hwndMain = CreateWindowEx( 0, "MainWClass", "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();

Microsoft .NET Framework - 29 FactoredFactored AndAnd ExtensibleExtensible

TheThe FrameworkFramework isis notnot aa “black“black box”box” AnyAny .NET.NET classclass isis availableavailable forfor youyou toto extendextend throughthrough inheritanceinheritance UnlikeUnlike COM,COM, you’reyou’re usingusing andand extendingextending thethe classclass itself,itself, notnot aa “wrapper”“wrapper” PlugPlug--andand--playplay componentscomponents andand subsystemssubsystems CrossCross--languagelanguage inheritance!inheritance!

Microsoft .NET Framework - 30 WebWeb Standards/PracticesStandards/Practices

TheThe .NET.NET FrameworkFramework supportssupports HTML, XML, SOAP, XSLT, XPath WebWeb servicesservices enablesenables internetinternet scalescale distributeddistributed appsapps State-full connected model does not work Loosely connected web services enables scalable apps XMLXML supportsupport isis builtbuilt inin deeplydeeply Data, remoting, serialization, documentation, config ThisThis affectsaffects everythingeverything Base services, data access, UI, invocation/activation, programming model, tools

Microsoft .NET Framework - 31 UnifyUnify ProgrammingProgramming ModelsModels

Consistent API availability regardless of language and programming model .NET Framework

RAD, Subclassing, Stateless, Composition, Power, Code embedded Delegation Expressiveness in HTML pages VB Forms MFC/ATL ASP

Windows API

Microsoft .NET Framework - 32 TheThe .NET.NET FrameworkFramework

ASP.NET Windows Forms

Data Xml

Base Class Library

Microsoft .NET Framework - 33 TheThe .NET.NET FrameworkFramework

System.Web System.Windows.Forms 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

System Collections IO Security Runtime Configuration Net ServiceProcess InteropServices Diagnostics Reflection Text Remoting Globalization Resources Threading Serialization Microsoft .NET Framework - 34 BaseBase FrameworkFramework System Collections Security Configuration ServiceProcess Diagnostics Text Globalization Threading IO Runtime Net InteropServices Reflection Remoting Resources Serialization Microsoft .NET Framework - 35 DataData AndAnd XMLXML System.Data ADO SQL Design SQLTypes

System.Xml XSLT Serialization XPath

Microsoft .NET Framework - 36 ASP.NETASP.NET System.Web Services UI Description HtmlControls Discovery WebControls Protocols Caching Security Configuration SessionState

Microsoft .NET Framework - 37 WindowsWindows FormsForms System.Windows.Forms Design ComponentModel

System.Drawing Drawing2D Printing Imaging Text

Microsoft .NET Framework - 38 Framework,Framework, Languages,Languages, AndAnd ToolsTools

VB C++ C# JScript …

Common Language Specification Visual Studio.NET

ASP.NET Windows.Forms

Data and XML

Base Class Library

Common Language Runtime Microsoft .NET Framework - 39 LanguagesLanguages

TheThe .NET.NET PlatformPlatform isis LanguageLanguage NeutralNeutral All .NET languages are first class players You can leverage your existing skills CommonCommon LanguageLanguage SpecificationSpecification Consumer: Can use the .NET Framework Extender: Can extend the .NET Framework WeWe areare providingproviding VB, C++, C#, JScript ThirdThird--partiesparties areare buildingbuilding APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…

Microsoft .NET Framework - 40 SummarySummary

SimplifiedSimplified developmentdevelopment UnifiedUnified programmingprogramming modelsmodels MultiMulti--language,language, OOOO platformplatform WebWeb standardsstandards andand bestbest practicespractices SimpleSimple toto deploy,deploy, run,run, && maintainmaintain

Microsoft .NET Framework - 41 ApplicationApplication DevelopmentDevelopment

MicrosoftMicrosoft .NET.NET FrameworkFramework -- PartPart IIII TheThe ToolsTools

VisualVisual StudioStudio .NET.NET CommandCommand LineLine ToolsTools

Microsoft .NET Framework - 43 InheritanceInheritance

Animal C#C#

Mammal Bird JavaJava VBVB

Microsoft .NET Framework - 44 SampleSample ApplicationsApplications

FocusFocus onon .NET.NET FrameworkFramework ConceptsConcepts .NET.NET ApplicationApplication .NET.NET “Assembly”“Assembly” ReuseReuse classclass fromfrom C#C# inin VBVB ASP.NETASP.NET applicationapplication WebWeb ServiceService

Microsoft .NET Framework - 45 OfOf AcademicAcademic InterestInterest

GenericsGenerics forfor thethe CLRCLR (and(and C#)C#) SharedShared SourceSource CommonCommon LanguageLanguage InfrastructureInfrastructure RunsRuns onon WindowsWindows XP,XP, thethe FreeBSDFreeBSD operatingoperating system,system, andand MacMac OSOS XX 10.210.2 ReleasedReleased underunder aa sharedshared sourcesource initiativeinitiative

Microsoft .NET Framework - 46 NewNew inin .NET.NET FrameworkFramework 1.11.1

MobileMobile WebWeb ApplicationsApplications GranularGranular VersionVersion Control:Control: SideSide--byby--SideSide ExecutionExecution ExecutionExecution ofof WindowsWindows FormsForms fromfrom thethe InternetInternet CodeCode AccessAccess SecuritySecurity forfor ASP.NETASP.NET ApplicationsApplications NativeNative SupportSupport forfor ODBCODBC andand OracleOracle DatabasesDatabases UnifiedUnified ProgrammingProgramming ModelModel forfor SmartSmart ClientClient App.App. SupportSupport forfor IPv6IPv6 Scalability,Scalability, Performance,Performance, DocumentationDocumentation

Microsoft .NET Framework - 47 LinksLinks toto MoreMore InformationInformation

msdn.microsoft.com/netframework/msdn.microsoft.com/netframework/ www.gotdotnet.comwww.gotdotnet.com msdn.microsoft.com/net/ecma/msdn.microsoft.com/net/ecma/ research.microsoft.com/projects/clrgen/research.microsoft.com/projects/clrgen/ msdn.microsoft.com/net/sscli/msdn.microsoft.com/net/sscli/

Microsoft .NET Framework - 48 Questions?Questions? © 2003 Microsoft Corporation. All rights reserved.