Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Information Systems

Similar presentations


Presentation on theme: "Distributed Information Systems"— Presentation transcript:

1 Distributed Information Systems
.NET Architecture Overview Markus A. Wolf & Elena I. Teodorescu

2 Some history Every 10 years or so, a new technology arrives that changes the way we think about application development In the 80s there was Unix and C. The 90s brought Windows and C++ In the .NET framework appeared - synthesising many good ideas of previous environments I'm going to start my talk today with a little bit of a historical perspective to take you from the early days of computing to where we are now. I'm sure if you look back at the history of computing and distributed applications you'll see that every decade or so there is a shift in the center of gravity. Go back to the 70s with mainframes, all of computing was done on a server in the back room and connected with proprietary protocols and dumb terminals. And then in the 80s the center of gravity shifted toward computing on the client. In fact, file servers would just sort of serve up files. There wouldn't be a lot of computing happening on the server; it would all happen on the client. Now in the 90s with the Internet the center of gravity shifted back to a server model. The Net is very much like really an old IBM 3270 terminal, except you can connect to multiple different sites instead of just one server in the back room and, of course, HTML is a much richer protocol. We finally have a protocol set, an infrastructure that allows us to have intelligence on both ends of the wire, and thats XML and Web services. One of the things about XML Web services, of course, is that a shift of that dramatic nature, you know, if you look at the vision for .NET its about information anywhere on any device at any time. But really no matter who you ask about their vision for distributed computing in the future, its all about distributed applications, connected applications. And we believe that XML and Web services are going to be the infrastructure for these distributed applications. But, of course, a shift like that also takes a new toolset. And looking at where we are today, here are a little bit of the history of the tools that have led us today with each of the previous decades really had their own toolsets with text mode applications, GUI applications and then leading up to the Internet and the next set of tools in that evolution 2 2 2

3 The state of the art In 2005, it evolved and incorporated lessons learned: .NET Framework 2.0 The latest incarnation is .NET 3.0 Not widely deployed at the moment For the curious only: .NET 3.5 Beta – still in development In this lecture we will talk about .NET Framework 2.0 3 3

4 So what is .NET? .NET is a platform that provides a standardized set of services. It’s just like Windows, except distributed over the Internet. It exports a common interface so that it’s programs can be run on any system that supports .NET. A specific software framework Includes a common runtime

5 .NET Framework Programming model for .NET
Platform for running .NET managed code in a virtual machine Provides a very good environment to develop networked applications and Web Services Provides programming API and unified language-independent development framework

6 The Core of .NET Framework: FCL & CLR
Common Language Runtime Garbage collection Language integration Multiple versioning support (no more DLL hell!) Integrated security Framework Class Library Provides the core functionality: ASP.NET, Web Services, ADO.NET, Windows Forms, IO, XML, etc.

7 .NET Framework Common Language Runtime
CLR manages code execution at runtime Memory management, thread management, etc. Let me first give you a block diagram overview of what the framework is. It starts with at the bottom the operating system and on top of that we have what we call the common language runtime. This is a component that in day-to-day use of the framework you don't actually see this component. It provides all of the sort of core system services such as class loading, compilation, exception handling, garbage collection, security, etc etc. In effect it is a black box that allows you to execute code in the .NET world. Common Language Runtime Operating System 7

8 .NET Framework Base Class Library
Object-oriented collection of reusable types Collections, I/O, Strings, … On top of the common language runtime we have a whole set of class libraries, starting with the base class library that provides a bunch of common functionalities such as file IO, string handling, access to TCPIP, for example. .NET Framework (Base Class Library) Common Language Runtime Operating System 8

9 .NET Framework Data Access Layer
Access relational databases Disconnected data model Work with XML ADO .NET and XML Built on top of that then we have ADO .NET, which is the next generation XML Web service-enabled version of ADO, and also our XML stack that starts all the way down at a low level XML parser, works its way up through a W3C DOM compliant XML document model and also supports X-PATH and a bunch of the other XML standards. .NET Framework (Base Class Library) Common Language Runtime Operating System 9

10 .NET Framework ASP.NET & Windows Forms
Create application’s front-end – Web-based user interface, Windows GUI, Web services, … ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO .NET and XML At the top of the class library stack we have two bundles. We have the server-side bundle and the client-side bundle. In the server side bundle we find ASP .NET, our application server, Web Forms, which is a programming model for writing forms in ASP .NET, support for Web services and the Mobile Internet Toolkit that allows you to build a UI for mobile devices. And on the client side we have Windows Forms, which is in a sense you can think of as an evolution of Visual Basic forms and MFC put together. You get the best of both worlds in Windows Forms. .NET Framework (Base Class Library) Common Language Runtime Operating System 10

11 .NET Framework Common Language Specification
.NET Framework (Base Class Library) ADO .NET and XML ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms Now further on top of that we have this thing that we call the common language specification, and what that really is, it is a standard for the minimum set of functionality that languages must support in order to be implemented on the .NET common language runtime. And supporting that common language specification there are four languages from Microsoft: Visual Basic, C++, C# and J#. There are many third party companies that are building other languages targeting the CLR, at this point there are in excess of 20 languages supported on the runtime. Common Language Runtime Operating System 11

12 .NET Framework Languages supported
C++ C# VB Perl J# Common Language Specification .NET Framework (Base Class Library) ADO .NET and XML ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms And supporting that common language specification there are four languages from Microsoft: Visual Basic, C++, C# and J#. There are many third party companies that are building other languages targeting the CLR, at this point there are in excess of 20 languages supported on the runtime. Common Language Runtime Operating System 12

13 .NET Framework Visual Studio .NET
C++ C# VB Perl J# Visual Studio .NET Common Language Specification .NET Framework (Base Class Library) ADO .NET and XML ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms And then finally, of course, supporting the entire stack is the development tool Visual Studio .NET. Common Language Runtime Operating System 13

14 .NET Framework Standards Compliance
C# Language – Submitted to ECMA C++ C# VB Perl J# Visual Studio .NET Open Language Specification Common Language Specification .NET Framework (Base Class Library) ADO .NET and XML ASP .NET Web Services Web Forms Mobile Internet Toolkit Windows Forms Web services – XML, SOAP-based Inside the .NET Framework Standards Compliance Microsoft .NET is built on standards. Both the Common Language Infrastructure, CLI and Visual C# have been submitted to the ECMA for approval and adoption. The data and Web services are built on XML and SOAP. .Net Framework supports Web standards: HTML- Hyper-Text Markup Language XML - Extensible Markup Language, the universal format for structured documents and data on the Web. WSDL- Web Services Description Language (WSDL) SOAP - Simple Object Access Protocol, a simple, XML-based protocol for exchanging structured and type information on the Web. The protocol contains no application or transport semantics, which makes it highly modular and extensible. (SOAP currently still has no encryption support either) XPATH - XML Path Language XSLT - XSL Transformations (XSLT), is an XML-based language that enables you to transform one class of XML document to another. XML-based data access Common Language Runtime Operating System 14

15 Common Language Runtime
Manages running code – like a virtual machine Threading Memory management No interpreter: JIT-compiler produces native code – during the program installation or at run time Fine-grained evidence-based security Code access security Code can be verified to guarantee type safety No unsafe casts, no un-initialized variables and no out-of-bounds array indexing Role-based security

16 Managed Code Code that targets the CLR is referred to as managed code
All managed code has the features of the CLR Object-oriented Type-safe Cross-language integration Cross language exception handling Multiple version support Managed code is represented in special Intermediate Language (IL) Managed code is computer program code that executes under the management of Microsoft's CLR virtual machine, or another similar virtual machine. It is contrasted with unmanaged code, which is executed directly by the computer's CPU. The benefits of managed code include programmer convenience and enhanced security guarantees. Before the code is run, the IL is compiled into native executable code. And, since this compilation happens by the managed execution environment (or, more correctly, by a runtime-aware compiler that knows how to target the managed execution environment), the managed execution environment can make guarantees about what the code is going to do. It can insert traps and appropriate garbage collection hooks, exception handling, type safety, array bounds and index checking, and so forth. For example, such a compiler makes sure to lay out stack frames and everything just right so that the garbage collector can run in the background on a separate thread, constantly walking the active call stack, finding all the roots, chasing down all the live objects. In addition because the IL has a notion of type safety the execution engine will maintain the guarantee of type safety eliminating a whole class of programming mistakes that often lead to security holes. 16

17 .NET Framework in context
This illustration shows the relationship of the common language runtime and the class library to your applications and to the overall system. The illustration also shows how managed code operates within a larger architecture. 17

18 Robust Environment Automatic lifetime management Exception handling
All objects are garbage collected Exception handling Error handling first class and mandatory Type-safety No buffer overruns, No unsafe casts, Uninitialized variables I think another key thing that the .NET Framework provides is a robust and durable execution environment. In the .NET Framework all objects are garbage collected. Memory management is automatic. A key thing to providing a robust execution environment is exception handling. You're familiar in VB with "on error go to" and it certainly gives you some modicum of structured error handling. But still exception handling goes way further. When an exception is raised in the .NET Framework, every exception carries along a descriptive error message. You can obtain a stack dump from the exception and learn precisely what went wrong and where. And perhaps most importantly error handling is mandatory in the .NET Framework. If you look at how the Windows API has worked traditionally and how languages actually have worked traditionally up until now with C, C++ and so forth, error handling has always been an optional thing. An API may have a function that returns an error code or a result code that says whether the API worked or not, but unless you actually write code to check the error result, you know, nothing will happen even when it goes wrong. Indeed, your application will so to speak muddle on and then three or four API calls later something blows up because of a null point or whatever and you have no idea how you ended up there. Not so with exception handling. With exceptions if an exception occurs and if your application does not handle the exception, then the application will be shut down. It will be shut down in an orderly fashion, mind you, and you have ample opportunities to sort of unroll your state and so forth, but we will not muddle on by default, and that will definitely remove lots of bugs. Type safety is another thing that brings about robustness. In the .NET Framework it is simply impossible to have unsafe typecast. You cant cast a pointer of one type to a pointer of another type; the execution engine will simply refuse to do it. Its impossible to have uninitialized variables. You cant index an array out of its bounds and so forth. 18

19 Secure Environment Security designed-in
Code access security enforcement Security based on the identity of code Administratively configurable via policy ASP.NET integrated authentication of user Windows identity, Passport®, forms-based, … Cryptography library with XML DSIG support Digital signature for XML ( The key elements of .NET Evidence Based Security consists of Policy, Permission and Evidence subsystems. Policy The XML inscribed policy defines what resources code in executing assemblies can access and in preventing the malicious harming of the integrity of data. Permission Permissions describe resources and associated rights, and implement methods for demanding and asserting access. Developers can extend permissions definitions to include application-defined resources. Allows developers granular permission requests within assemblies. Evidence At runtime, the CLR determines permission requests by evaluating the assembly’s evidence. (EX: Code origin (URL,site, etc.); Crypto namespaces, Authenticode, etc.) ASP.NET Security The .NET Framework provides a security mechanism called Code Access Security. Code access security allows code to be trusted to varying degrees, depending on where the code originates and on other aspects of the code's identity. Code Access Security in CLR Every application that targets the common language runtime (CLR) must interact with the runtime's security system. To enable code to benefit from code access security, application and component developers must use a compiler that generates verifiably type-safe code. Security requests are evaluated by the runtime when the code is loaded into memory. Code access security allows class libraries to specify the permissions they require in order to be accessed. Cryptographic Services The .NET Framework security system implements an extensible pattern of derived class inheritance. From top down, the pattern is as follows: Algorithm type, for example SymmetricAlgorithm or HashAlgorithm. This level is abstract. Algorithm, for example RC2 or SHA1. This level is abstract. Implementation of algorithm, for example RC2CryptoServiceProvider or SHA1Managed. This level is fully implemented. The common language runtime (CLR) uses a stream-oriented design for cryptography. The core of .NET Cryptographic design is CryptoStream. Any cryptographic objects that implement CryptoStream can be chained together, so that the streamed output from one object can be fed into the input of another object. 19

20 Simplify Deployment And Management
Zero-impact install Applications and components can be shared or private Side-by-side execution Multiple versions of the same component can co-exist on a system Assemblies Contain dependency information A key thing too is the Zero-Impact Install feature. With the .NET Framework when you write an application there is absolutely no requirement that anything be registered in order for that application to run. You can create a subdirectory, drop the application in there, run it and when you're done with it you can delete the subdirectory and it leaves no trace whatsoever on your machine. Side-by-side execution is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Assemblies will be discussed later on in the lecture. 20

21 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 uninitialised variables Pointerless environment There is actually a difference here between how memory management works in COM and how it works in the .NET Framework. In COM there is also automatic memory management, but its done with a methodology called reference counting where you count the number of references outstanding for each object. And it works pretty well, if it wasn't for one intractable problem that no one has actually managed to solve so far. And that's the circular reference problem. If you have two objects that each holds references to each other, it looks to the memory manager as if these objects are still alive, yet no one else references them and so you create a little island of memory that never gets garbage collected. The .NET Framework uses a different technology for memory management called mark and sweep, and it circumvents entirely the problem of reference counting. 21

22 Intermediate Language
.NET languages are compiled to an Intermediate Language (IL) IL is also known as MSIL or CIL CLR compiles IL in just-in-time (JIT) manner – each function is compiled just before execution The JIT code stays in memory for subsequent calls Recompilations of assemblies are also possible MSIL are simple binary structures that are similar to the instruction sets of the CPU. Like the instruction set, it encodes a wide spectrum of operations such as loading, storing, arithmetic and logical operations and control flow. The similarity to the machine code enables the code to be compiled quickly in the Just in time (JIT) compiler. The type verification also becomes simpler because the DotNet binary contains tables of metadata. The metadata defines each type and its signatures and also the other data that the runtime locates and extracts from the file at the time of execution. The presence of the metadata makes the module self descriptive and eliminates the need for IDL files and header files. However, unlike the CPU instruction set, MSIL expresses object oriented concepts such as object creation, method invocation, property access and exception handling. It is the Microsoft Intermediate Language (MSIL) which makes applications language independent. Applications may be created by programmers in any language of their choice—ASP.NET or VB.NET—in a machine on which the .NET framework has been installed. The compiler then, gives an output in the Microsoft Intermediate language. This language can be defined as a kind of assembly language at a higher level of abstraction. The language is designed in a manner that makes it possible to convert it into any kind of native machine code with ease. The CLR detects the Intermediate language and invokes the Just-in-time compiler to convert the language into machine code. 22

23 It is the Microsoft Intermediate Language (MSIL) which makes applications language independent. Applications may be created by programmers in any language of their choice—ASP.NET or VB.NET—in a machine on which the .NET framework has been installed. The compiler then, gives an output in the Microsoft Intermediate language. This language can be defined as a kind of assembly language at a higher level of abstraction. The language is designed in a manner that makes it possible to convert it into any kind of native machine code with ease. The CLR detects the Intermediate language and invokes the Just-in-time compiler to convert the language into machine code. 23

24 Example of MSIL Code .method private hidebysig static void Main() cil managed { .entrypoint // Code size 11 (0xb) .maxstack 8 IL_0000: ldstr "Hello, world!" IL_0005: call void [mscorlib]System.Console::WriteLine(string) IL_000a: ret } // end of method HelloWorld::Main 24

25 Common Type System (CTS)
All .NET languages have the same primitive data types. An int in C# is the same as an int in VB.NET When communicating between modules written in any .NET language, the types are guaranteed to be compatible on the binary level Types can be: Value types – passed by value, stored in the stack Reference types – passed by reference, stored in the heap Strings are a primitive data type now The common type system defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime's support for cross-language integration. The common type system performs the following functions: Establishes a framework that helps enable cross-language integration, type safety, and high performance code execution. Provides an object-oriented model that supports the complete implementation of many programming languages. Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other. The common type system supports two general categories of types, each of which is further divided into subcategories: Value types Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations. For a list of built-in value types, see the .NET Framework Class Library. Reference types Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates. Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. All types derive from the System.Object base type. 25

26 Type classification This diagram illustrates how these various types are related. Note that instances of types can be simply value types or self-describing types, even though there are subcategories of these types. 26

27 Common Language Specification (CLS)
Any language that conforms to the CLS is a .NET language A language that conforms to the CLS has the ability to take full advantage of the Framework Class Library (FCL) CLS is standardized by ECMA To fully interact with other objects regardless of the language they were implemented in, objects must expose to callers only those features that are common to all the languages they must interoperate with. For this reason, the Common Language Specification (CLS), which is a set of basic language features needed by many applications, has been defined. The CLS rules define a subset of the common type system; that is, all the rules that apply to the common type system apply to the CLS, except where stricter rules are defined in the CLS. The CLS helps enhance and ensure language interoperability by defining a set of features that developers can rely on to be available in a wide variety of languages. The CLS also establishes requirements for CLS compliance; these help you determine whether your managed code conforms to the CLS and to what extent a given tool supports the development of managed code that uses CLS features. The European Computer Manufacturers Association (ECMA) standard has defined the Common Language Specification (CLS); this enforces that software development languages should be interoperable between them. The language compilers generate an Intermediate Language code, called Microsoft Intermediate Language (MSIL), which makes programs written in the .NET languages interoperable across languages. 27

28 Common Language Specification
The code written in a CLS should be compliant with the code written in another CLS-compliant language. Because the code supported by CLS-compliant language should be compiled into an intermediate language (IL) code. The CLR engine executes the IL code. This ensures interoperability between CLS-compliant languages. The CLS was designed to be large enough to include the language constructs that are commonly needed by developers, yet small enough that most languages are able to support it. In addition, any language construct that makes it impossible to rapidly verify the type safety of code was excluded from the CLS so that all CLS-compliant languages can produce verifiable code if they choose to do so. 28 28

29 .NET Languages Languages provided by Microsoft Third-parties languages
C++, C#, J#, VB.NET, JScript Third-parties languages Perl, Python, Pascal, APL, COBOL, Eiffel, Haskell, ML, Oberon, Scheme, Smalltalk… Advanced multi-language features Cross-language inheritance and exceptions handling Object system is built in, not bolted on No additional rules or API to learn Microsoft .NET Framework supports Languages like Microsoft Visual Basic .NET, Microsoft Visual C#, Microsoft Visual C++ .NET, and Microsoft Visual J# .NET. , and others from third party suppliers. 29

30 Code Compilation and Execution
Also called Assembly (.EXE or .DLL file) Source Code Language Compiler Code MSIL Metadata Before installation or the first time each method is called The Common Language Runtime Compilation and Execution The above diagram illustrates the process used to compile and execute managed code, or code that uses the CLR. Source code written in Visual C#, Visual Basic .NET or another language that targets the CLR is first transformed into MSIL by the appropriate language compiler. Before execution, this MSIL is compiled by the Just-in-Time (JIT) complier into native code for the processor on which the code will operate. The default is to JIT compile each method when it is first called, but it is also possible to “preJIT” MSIL code to native code at assembly install-time. With this option, all methods are compiled before the application is loaded so as to avoid the overhead of JIT compilation on each initial method call. You use the Native Image Generator (Ngen.exe) to create a native image from a managed assembly and install it into the native image cache. Once the code is compiled and cached, the CLR does not need to re-compile the MSIL code until the assembly is updated, the Just-In-Time compiled code is removed from the cache, or the machine is restarted. All languages targeting the CLR *should* exhibit a similar performance. While some compilers may produce better MSIL code, large variations in execution speed are unlikely. Execution Native Code JIT Compiler 30

31 Assemblies DLL or EXE file Smallest deployable unit in the CLR
Have unique version number No version conflicts (known as DLL hell) Contains IL code to be executed Security boundary – permissions are granted at the assembly level Type boundary – all types include the assembly name they are a part of Self-describing manifest – metadata that describes the types in the assembly The CLR doesn’t actually work with modules; it works with assemblies. An assembly is an abstract concept, which can be difficult to grasp at first. First, an assembly is a logical grouping of one or more managed modules or resource files. Second, an assembly is the smallest unit of reuse, security, and versioning. Depending on the choices you make with your compilers or tools, you can produce a single-file assembly or you can produce a multi-file assembly. What is an assembly? An Assembly is a logical unit of code Assembly physically exist as DLLs or EXEs One assembly can contain one or more files The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs When you compile your source code by default the exe/dll generated is actually an assembly Unless your code is bundled as assembly it can not be used in any other application When you talk about version of a component you are actually talking about version of the assembly to which the component belongs. Every assembly file contains information about itself. This information is called as Assembly Manifest. What is assembly manifest? Assembly manifest is a data structure which stores information about an assembly This information is stored within the assembly file(DLL/EXE) itself The information includes version information, list of constituent files etc. What is private and shared assembly? The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application. Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies. What is Global Assembly Cache? Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under <drive>:\WinNT\Assembly folder. How assemblies avoid DLL Hell? As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example : You created assembly Assembly1 You also created a client application which uses Assembly1 say Client1 You installed the client in C:\MyApp1 and also placed Assembly1 in this folder After some days you changed Assembly1 You now created another application Client2 which uses this changed Assembly1 You installed Client2 in C:\MyApp2 and also placed changed Assembly1 in this folder Since both the clients are referring to their own versions of Assembly1 everything goes on smoothly Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form: major.minor.build.revision If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match. When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied. 31

32 In this figure, we are passing the file names of some managed modules and resource (or data) files to a tool. This tool produces a single PE file that represents the logical grouping of files. This PE file contains a block of data called the manifest, which is simply another set of metadata tables. These tables describe the assembly: the files that make it up, the publicly exported types implemented by the files in the assembly, and the resource or data files that are associated with it. By default, compilers actually do the work of turning the emitted managed module into an assembly. That is, the C# compiler emits a managed module that contains a manifest. The manifest indicates that the assembly consists of just the one file. So for projects that have just one managed module and no resource files, the assembly will be the managed module, and you don’t have any additional steps to perform during your build process. If you wish to group a set of files into an assembly, then you will have to be aware of more tools (such as the assembly linker, AL.exe) and their command-line options. An assembly allows you to decouple the logical and physical notions of a reusable, deployable, versionable component. The way in which you partition your code and resources into different files is completely up to you. For example, you could put rarely used types or resources in separate files that are part of an assembly. The separate files could be downloaded from the web as needed. If the files are never needed, they're never downloaded, saving disk space and reducing installation time. An assembly lets you break up the physical deployment of the files but still treat them as a single collection. 32

33 Metadata in Assembly Type Descriptions Classes Base classes
Implemented interfaces Data members Methods Assembly Description Name Version Culture The modules in an assembly also include information, including version numbers, about referenced assemblies. This information makes an assembly self-describing. In other words, the CLR knows everything that an assembly needs in order to execute. No additional information is required in the registry or in the Active Directory, so deploying assemblies is much easier than deploying unmanaged components. Other assemblies Security Permissions Exported Types 33

34 Applications One or more assemblies Assemblies conflict resolution
Using metadata Local (preferred) Global Assembly Cache (GAC) Different applications may use different versions of an assembly Easier software updates Easier software removal 34

35 Visual Studio .NET Development tool that contains a rich set of productivity and debugging features Supports managed and unmanaged applications Supports C#, C++, VB.NET, … Many useful tools and wizards Windows Forms Designer ASP.NET Web Forms Designer Web Services support SQL Server integration with ADO.NET and XML VS.NET is not part of the .NET Framework Not necessary to build or run managed code The .NET Framework SDK includes command line compilers Microsoft Visual Studio is Microsoft's flagship software development product for computer programmers. It centers on an integrated development environment which lets programmers create standalone applications, web sites, web applications, and web services that run on any platforms supported by Microsoft's .NET Framework (for all versions after Visual Studio 6). Supported platforms include Microsoft Windows servers and workstations, PocketPC, Smartphones, and World Wide Web browsers. Visual Studio .NET is not part of the .NET Framework, despite the naming. .NET code can be written on a text editor like Notepad, and compiled from command line compilers. However, it is much much easier using Visual Studio. 35

36 The .NET Framework Library
Windows Forms Web Forms Web Services Mobile Internet Toolkit ASP.NET ADO.NET and XML The .NET framework class library, as the name suggests, is a library of classes, interfaces and value types. The applications, components and controls for applications are built on this framework and it provides the developer the access to the system functionality. In other words, the classes and structures can be leveraged as base building blocks for application development. These classes are often described as an API and form a boundary interface between the application and the operating system. Though the concept is not new to Visual basic Developers who have been using the ADO library, the Win 32 API and COM + services, it forms a massive code base on which the application can be built. Base Class Library 36

37 .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 The .NET Framework class Library is organized into namespaces. The namespace is a container for functionality. Similar classes and constructs are grouped together in a namespace to define parent-child relationships. Namespaces can be nested into namespaces. All namespaces stem from the root namespace called System Namespace. It contains all data types including the Object data type. Though all namespaces are subordinated to the System namespace, User defined libraries can also coexist with the System namespace. They can have their own root namespace which can be language focused namespaces such as Microsoft.Csharp, Microsoft.VisualBasic. Design SQLTypes XPath System Collections IO Security Runtime InteropServices Configuration Net ServiceProcess Remoting Diagnostics Reflection Text Serialization Globalization Resources Threading 37

38 Base Class Library Namespaces
System Collections Security Configuration ServiceProcess Diagnostics Text Globalization Threading IO Runtime First, let’s drill into the Base Framework. The Base Framework is important because no matter what kind of application you are building are using you’ll end up needing to use this functionality. The system namespace contains all the base data types for the platform. Ints, floats, are defined here – arrays, strings, the root object and so forth. Within that, we have a whole slew of various base services that are consistently available in the base platform. Collections: growable arrays, hash table IO: file, streams NET: stuff that allows you to do tcpip, sockets InteropServices Net Remoting Reflection Serialization Resources 38

39 Base Class Library Data types, conversions, formatting
Collections: ArrayList, Hashtable, etc. Globalization: Cultures, sorting, etc. I/O: Binary and text streams, files, etc. Networking: HTTP, TCP/IP sockets, etc. Reflection: Metadata and IL emit Security: Permissions, cryptography Text: Encodings, regular expressions 39

40 Data And XML Namespaces
System.Data OleDb SQLClient Common SQLTypes System.Xml On top of the base classes we have the Data and Xml support. The ADO.NET supports both the tightly connected ADO style record set support that many applications use today as well as a new more loosely coupled model called that uses DataSets. This model allows for a more distributed nature style of programming that is becoming more common. We also provide the SQLTypes namespace that provide datatypes that map directly onto the types that you're accustomed to when you do database programming, say in TSQL. Nullable datatypes. Things that can basically have an int value, or be NULL. In the System.xml namespace we have all of the xml support. It truly is a world class set of functionality we’re providing here. There is of course a parser, and an xml writer – both of which are fully w3c compliant. There is a w3c dom implementation. On top of that there is an xslt for doing xsl transformations. We have an implementation of xpath that allows you to navigate data graphs in xml. And we have the serialization namespace that provides all of the core infrastructure for moving objects to xml representation and vice versa. XSLT Serialization XPath 40

41 ADO.NET And XML ADO.NET consumes all types of data
XML (hierarchical), relational, etc. Powerful in-memory data cache (DataSet) DataSet contains various data objects: tables, views, relations, constraints, etc. Lightweight, stateless, disconnected Supports both relational and XML access High-performance, low overhead stream access Great XML support including: W3C DOM, XSL/T, XPath, and Schema Data processing has traditionally relied primarily on a connection-based, two-tier model. As data processing increasingly uses multi-tier architectures, programmers are switching to a disconnected approach to provide better scalability for their applications. The ADO.NET DataSet is the core component of the disconnected architecture of ADO.NET. The DataSet is explicitly designed for data access independent of any data source. As a result it can be used with multiple and differing data sources, used with XML data, or used to manage data local to the application. The DataSet contains a collection of one or more DataTable objects made up of rows and columns of data, as well as primary key, foreign key, constraint, and relation information about the data in the DataTable objects. XML and ADO.NET ADO.NET leverages the power of XML to provide disconnected access to data. ADO.NET was designed hand-in-hand with the XML classes in the .NET Framework — both are components of a single architecture. The design of the DataSet enables you to easily transport data to clients over the Web using XML Web services, as well as allowing you to marshal data between .NET components using .NET Remoting services. You can also remote a strongly typed DataSet in this fashion. 41

42 Windows Forms Windows Forms is framework for building rich GUI applications RAD (Rapid Application Development) component-based event-driven Rich set of controls Data aware components ActiveX® Support Printing support Unicode support UI inheritance The Windows Forms classes contained in the .NET Framework are designed to be used for GUI development. You can easily create command windows, buttons, menus, toolbars, and other screen elements with the flexibility necessary to accommodate shifting business needs. The topics in this section provide details about how to use the features offered by Windows Forms. Windows Forms are a combination of the best from both Visual Basic and MFC. It gives you both a RAD compositional model, along with inheritance all with a completely object oriented framework. So you can build components through inheritance, then you can visually aggregate these components using a visual forms designer. It provides a very rich component model that has a lot of design time support so you can fairly easily build new components that can have very rich and seamless integration into the platform and into any available visual design tools. 42

43 Windows Forms Namespaces
System.Windows.Forms Design ComponentModel System.Drawing The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system. The slide shows the classes in System.Windows.Forms namespace grouped into categories. Drawing2D Printing Imaging Text 43

44 ASP.NET Framework for building Web applications and Web services in any .NET language C#, C++, VB.NET, JScript, etc. Automatic multiple clients support DHTML, HTML 3.2, WML, small devices Compilation of ASP.NET Web applications into .NET assemblies Cached the first time when called All subsequent calls use the cached version Separation of code and content Developers and designers can work independently ASP.NET is the latest version of Microsoft's Active Server Pages technology (ASP). What is Classic ASP? Microsoft's previous server side scripting technology ASP (Active Server Pages) is now often called classic ASP. ASP 3.0 was the last version of the classic ASP. ASP.NET is Not ASP ASP.NET is the next generation ASP, but it's not an upgraded version of ASP. ASP.NET is an entirely new technology for server-side scripting. It was written from the ground up and is not backward compatible with classic ASP. ASP.NET is a major part of the Microsoft's .NET Framework. What is ASP.NET? ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server. ASP.NET is a Microsoft Technology ASP stands for Active Server Pages ASP.NET is a program that runs inside IIS IIS (Internet Information Services) is Microsoft's Internet server IIS comes as a free component with Windows servers IIS is also a part of Windows 2000 and XP Professional 44

45 ASP.NET Namespaces System.Web Services UI Description HtmlControls
Discovery WebControls Protocols For development of applications and services that run on the server, we have the ASP.NET architecture. In System.Web.UI we have support for dynamically generating UI on the server and sending it down to clients. This is commonly in HTML, but it could also be in DHTML or even WAP for cell phones. The ASP.NET model allows you to build applications in much the same way you build client applications today: Just click and drag buttons and even higher level controls on a form. The infrastructure provides all the state management and other support. In System.Web.Services you’ll find the infrastructure for building great Xml based web services. With this support you just write classes and methods and the infrastructure handles turning the calls into SOAP. At the bottom you will find at the lower level things that are shared between web services and web ui: things like caching, configuration, security, state management and so forth. Caching Security Configuration SessionState 45

46 Web Services Technical definition – “A programmable application component accessible via standard Web protocols” Built on XML and SOAP Expose functionality from Web Sites Almost like component programming over the Web Functionality exposed using XML/HTML Standard Web Services include Calendar MSN Passport For situations where a Web site has data to send or receive from non-browser applications, it makes sense to provide structured data in a universally accepted format.  The SOAP specification defines an XML-based, extensible format for doing just that.  And instead of calling these Web locations Web Sites, we instead refer to them as Web Services.  It also turns out that the loosely-coupled, interface-first approach toward designing Web services fits perfectly into the service-oriented design approach toward building connected systems that has such broad industry support today. Web services are small units of code built to handle a limited task. What are Web Services? Web services are small units of code Web services are designed to handle a limited set of tasks Web services use XML based communicating protocols Web services are independent of operating systems Web services are independent of programming languages Web services connect people, systems and devices Benefits of Web Services Easier to communicate between applications Easier to reuse existing services Easier to distribute information to more consumers Rapid development 46

47 XML Web Services Foundation
Simple, Open, Broad Industry Support Open standards: Publish, Find, Use Services: UDDI Service Interactions: SOAP XML Based Web Protocols Web services use the standard web protocols HTTP, XML, SOAP, WSDL, and UDDI. HTTP HTTP (Hypertext Transfer Protocol) is the World Wide Web standard for communication over the Internet. HTTP is standardized by the World Wide Web Consortium (W3C). XML XML (eXtensible Markup Language) is a well known standard for storing, carrying, and exchanging data. XML is standardized by the W3C. SOAP SOAP (Simple Object Access Protocol) is a lightweight platform and language neutral communication protocol that allows programs to communicate via standard Internet HTTP. SOAP is standardized by the W3C. WSDL WSDL (Web Services Description Language) is an XML-based language used to define web services and to describe how to access them. WSDL is a suggestion by Ariba, IBM and Microsoft for describing services for the W3C XML Activity on XML Protocols. UDDI (Universal Description, Discovery and Integration) is a directory service where businesses can register and search for web services. UDDI is a public registry, where one can publish and inquire about web services. Universal Data Format: XML Ubiquitous Communications: Internet 47

48 ASP.NET Web Services Simple programming model
Author .ASMX files with class methods ASP.NET compiles on demand, generates WSDL contract, exposes HTML test page Incoming HTTP/SOAP messages invoke methods No special HTTP, SOAP or XML knowledge required Supports multiple message wire formats HTTP GET, POST, and SOAP Requests Web services make it easier to communicate between different applications. They also make it possible for developers to reuse existing web services instead of writing new ones. Web services can create new possibilities for many businesses because it provides an easy way to distribute information to a large number of consumers. One example could be flight schedules and ticket reservation systems. We can now use ASP.NET to create Web Service that is based on industrial standards included XML, SOAP and WSDL. ASP.NET Web Services support clients using HTTP-POST, HTTP-GET and SOAP protocols to invoke methods exposed, depends on your specific requirement you choose one method over the others. The main difference between HTTP-GET or HTTP-POST and SOAP is the data types supported by SOAP is much richer because SOAP used XSD schema to represent complex data types. 48

49 .NET Framework on Linux Mono Project
Open Source C# compiler, CLR and Framework Class Library Runs on various platforms and hardware: Linux, Unix, FreeBSD, Windows – JIT-compiler for x86 Supports also: ADO.NET and XML Windows Forms (not fully) ASP.NET Web Services Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell, the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications. What technologies are included in Mono? Mono contains a number of components useful for building new software: A Common Language Infrastructure (CLI) virtual machine that contains a class loader, Just-in-time compiler, and a garbage collecting runtime. A class library that can work with any language which works on the CLR. Both .NET compatible class libraries as well as Mono-provided class libraries are included. A compiler for the C# language. In the future they might work on other compilers that target the Common Language Runtime. 49

50 Summary .NET Framework is a code execution platform – the environment which .NET programs run .NET Framework consists of two primary parts: Common Language Runtime and .NET Class Libraries The CLS (Common Language Specification) allows different languages to interact seamlessly. The CTS (Common Type System) allows all languages to share base data types.

51 Summary (2) .NET languages are compiled to MSIL by their respective compilers MSIL code is compiled to machine code by the JIT compiler All .NET languages have equal access to the FCL (Framework Class Library) which is a rich set of classes for developing software Base Class Library is set of basic classes: Collections, I/O, Networking, Security, etc. ADO.NET provides .NET applications with access to relational databases

52 Summary (3) .NET has great XML support including: DOM, XSLT, XPath, and XSchema Windows Forms provides GUI interface for the .NET applications ASP.NET allows creating web interface to .NET applications Web Services expose functionality from web sites and make it remotely accessible through standard XML-based protocols Visual Studio .NET is powerful development IDE for all .NET languages and technologies

53 .NET Framework – Resources
Visit following web sites: .NET Framework Home Site – The Microsoft .NET Framework Community – ASP.NET – .NET Windows Forms – Code Project – Mono – Open Source .NET Framework – Rotor – Shared Source .NET CLI – Read the news groups: news://msnews.microsoft.com/microsoft.public.dotnet.framework


Download ppt "Distributed Information Systems"

Similar presentations


Ads by Google