Traditional Architectures Java Architecture .NET Architecture
Total Page:16
File Type:pdf, Size:1020Kb
Traditional Architectures Web Local Distributed Other Distribution and Integration applications applications applications applications Technologies GUI Network Scripts Data Other Services Services Web Access Services Libraries .NET Architecture Execution environment (Posix, Win32, ...) Operating System .NET Architecture 2 Java Architecture .NET Architecture Web Local Distributed Other Web Local Distributed Other applications applications applications applications applications applications applications applications Swing Enterprise Java Server JDBC Others Windows Enterprise ASP.NET ADO.NET Others Java Beans Pages Forms Services Standard Java Packages .NET Framework Class Library (FCL) Java Virtual Machine (JVM) Common Language Runtime (CLR) Operating System Operating System .NET Architecture 3 .NET Architecture 4 Common Language Runtime (CLR) Common Type System (CTS) All .NET applications use the CLR All the languages able to generate code The CLR is OO for the CLR make use of the CTS (the CLR It is independent from high level languages implements the CTS) heap The CLR supports: There is 2 type categories: string . A common set of data types for all languages (CTS) . Value “abcdef” . An intermediate language independent from the stack • Simple types native code (CIL) • Allocated in the stack top class A . A common format for compiled code files 41 String: (assemblies) . Reference Double: 271.6 All the software developed using the CLR is • Complex types known as managed code • Allocated in the heap • Destroyed automatically by garbage collection .NET Architecture 5 .NET Architecture 6 The CTS Value and Reference Types Object class Ref { public int x; } struct Val { public int x; } r1: x = 5 … Class ValueType x = 8 v1: x = 5 void Method ( ) { Ref r1 = new Ref( ); Interface UInt16 Single r2: Byte Int16 Val v1 = new Val( ); r1.x = 5; v2: Array Char Int32 UInt32 Double v1.x = 5; x = 5 … x = 9 UInt64 String Int64 Enum Ref r2 = r1; Val v2 = v1; r2.x = 8; Delegate Decimal Structure v2.x = 9; … Others Boolean Others } Stack Heap Reference types Value types .NET Architecture 7 .NET Architecture 8 Value and Reference Types Intermediate Code Compilation Int32: 169 Common Source Intermediate Char: A Compiler Language code (CIL) String: Hello Int16: 43 For the first time Stack Heap that a method is called Native JIT Value type code compiler Reference type Execution .NET Architecture 9 .NET Architecture 10 Execution in the CLR Application domains Class Y 1) Calls Several .NET applications can run in the a method same process (CLR) but in different Class X Method 1 7) Calls 4) Calls a a method domains Method 1 method Method 2 Class Z Method 2 Method 3 MethodMétodo 1 The domains are isolated from each other Method 3 MethodMétodo 4 Method 2 Domains can communicate using some inter process communication techniques 8) Calls next 2) Compiles 3) Replaces method . CIL code CIL by native 5) Compiles Domains can run several threads 6) Replaces code CIL code CIL by native An application can be made code CIL code JIT compiler multithreaded easily Native code .NET Architecture 11 .NET Architecture 12 Application domains Application domain and CLR App Domain App Domain 1 App Domain 2 Assembly Threads Assembly D Class X Class Y Class Z Assembly A Method 1 Method 1 Method 1 Assembly E Method 2 Method 2 Method 2 Assembly B Method 3 Method 3 App Domain 3 Method 4 Assembly C Assembly F Metadata for the Classes X, Y and Z Stack Heap Common Language Runtime Loader JIT Compiler Garbage Collector An OS process Common Language Runtime .NET Architecture 13 .NET Architecture 14 Assemblies Assemblies Class X … When we do a compilation from a high level Compiler Class Y … .NET language we create modules of managed (C#,…) Class Z … code Class X Class Y Class Z One or more modules can constitute an Manifest CIL CIL CIL assembly (one or more files) Metadata for classes X, Y and Z The modules also contain metadata describing app1.exe types, methods, fields, … Assembly A One of the assembly modules contains a manifest, describing the assembly components Class P Class Q Class R (modules) Manifest Metadata for classes P and Q Metadata for class R A private assembly gets installed by a simple copy app2.dll app3.netmodule . There is no registry entries, include files, etc. Assembly B .NET Architecture 15 .NET Architecture 16 Languages Framework Class Library (FCL) Any language capable of supporting a It is very broad well defined subset of the CLR/CTS (CLS - Accessible from any .NET language Common Language Specification) can be It’s written in C# (most of it) used as a high level .NET language It’s organized is several namespaces . One of them is the new C# language (follows closely the CTS and CLR specifications) . Base: namespace System . From Microsoft: VB.NET, C++.NET, J#, F# Contains thousands of classes, structs and JScript.NET and enums . Others: APL, COBOL, Pascal, Eiffel, Haskell, Many more thousands of methods, ML, Oberon, Perl, Python, Scheme, Smalltalk, properties and events Fortran, etc. .NET Architecture 17 .NET Architecture 18 Ports to other platforms For Linux / Solaris / Mac OS: Mono - CLR (with JIT), C# Compiler and other tools and a very substantial part of FCL Cross platform, open source, .NET development framework http://www.mono-project.com For iPhone and iPad (iOS): Xamarin.iOS – Apps with .NET and C# integrated in Xcode and UI designer http://xamarin.com/platform For Android: Xamarin.Android - .NET and C# for Android platform integrated with VS http://xamarin.com/platform .NET Architecture 19.