Docstoc

Distributed Middleware

Document Sample
Distributed Middleware Powered By Docstoc
					Distributed Middleware
Communication + Synchronisation
   – Deadlock, starvation
   – Marshalling


4 classes of solutions
   – Common Interface
      • Webservices
   – Common Interface Description Language
      • Corba (IDL)
   – Common Intermediate Layer
      • Publish/subscribe systems (Linda, Splice)
   – Common Run-Time Systeem
      • Java (J2EE, RMI), .Net (CLR)


                                         Marko van Eekelen
                                                    1   ISS2005
Agenda
•   What is .NET?
•   Inside the .NET Framework
•   CLR – One Runtime for many languages
•   .NET Framework Classes
•   .NET SDK Tools
•   Compact Framework
•   Shared Source Common Language Infrastructure
•   Opportunities
•   Summary
•   How to get started


                                         2         ISS2005
What is .NET ?

   A COMPONENT MODEL FOR THE INTERNET
     – Multi-language, reliable and secure approach to
       building distributed systems for the Internet
     – Provides the capability to integrate multiple
       devices
     – Cross-language environment that is still simple to
       program and deploy
     – Built around the tools and protocols (XML, WSDL,
       SOAP, HTTP) that are becoming standard on the
       Internet


                                            3        ISS2005
Inside the .NET Framework

 VB   C++    C#     J#    Python     …
                                          ASP.NET
  Web Services           User Interface
                                          High-productivity environment
               ASP.NET                    for building and running Web
                                          services
             Data and XML

            Base Framework
                                               Secure, integrated
  Common Language Runtime (CLR)                   class libraries
                                          • Unifies programming models
            Operating System                across languages
                                          • Enables cross-language
  Common Language                           integration
  Runtime                                 • Factored for extensibility
  Executes code, maintains                • Designed for tools
  security, handles component
  “plumbing” and dependencies
                                                      4           ISS2005
The .NET Framework

  Consists of:
  • Common Language Runtime
     –   Runtime „engine‟ for managed code
     –   Threading, Memory management
     –   Fine-grained, evidence-based security
     –   Cross-language exception handling, diagnostics, debugging

  • .NET Framework Class Libraries
     –   set of hierarchically organized class libraries
     –   spans all .NET programming languages
     –   common type system built-in
     –   object oriented, extensible



                                                           5   ISS2005
The .NET Framework
 • Assemblies are the unit of deployment
    – One or more files, independent of packaging
    – Self-describing via manifest
 • Managed code
    – Code that targets the CLR
    – Source written in any .NET Language, e.g. C#, Visual Basic .Net, J#,
      Perl, etc…
    – Consists of IL instructions, and metadata
 • IL
    – CPU independent machine language
    – „Just in time‟ compiled at runtime
 • Metadata
    – Structured information
    – Describes programming constructs including Classes definitions, field
      and method definitions, parameter lists, return types, etc.



                                                          6           ISS2005
Compilation And Execution

                 Compilation

  Source         Language           Code (IL)
                                    Assembly
   Code          Compiler           Metadata




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

                                        7          ISS2005
One Runtime For Many Languages

 •    CLR is an open standard
      – ECMA, ISO, W3 Consortium
 •    Any language can make use of CLR services
 •    Any language can use classes written in any
      other language (consumer)
  •   Any language can inherit classes written in
      any other language




                                       8      ISS2005
Sample Applications
 //C# Hello World Program – HelloWorld.cs
 using System;
 public class HelloWorld {
    static public void Main() {
         System.Console.WriteLine(“Hello World!”);
    }
 }


 //VB .NET Hello World Program – HelloWorld.vb
 Module HelloWorld
    Sub Main
         System.Console.WriteLine(“Hello World!”)
    End Sub
 End Module


                                                     9   ISS2005
 Sample Applications


//Managed C++ Hello World Program – HelloWorld.cpp
//Reference the .NET Runtime Library, for Console Input/Output
   functionality
#using <mscorlib.dll>
void main() {
        System::Console::WriteLine(“Hello World!”);
}




                                                10        ISS2005
Compiling Sample Applications

 • Visual Basic
    vbc.exe /t:exe HelloWorld.exe
 • Visual C#
    csc.exe /t:exe HelloWorld.exe
 • Visual C++
    cl.exe /CLR HelloWorld.cpp




                                     11   ISS2005
    CLI Assembly
                                        .class public auto ansi beforefieldinit Hello
//hello world in C#
                                               extends [mscorlib]System.Object
using System;
                                        {
public class Hello
                                          .method public hidebysig static void Main() cil
{
                                        managed
   public static void Main()
                                          {
   {
                                            .entrypoint
             Console.WriteLine(“Hello
                                            // Code size    11 (0xb)
                        from C#”);
                                            .maxstack 1
   }
                                            IL_0000: ldstr     "Hello from C#VB "
}
                                            IL_0005: call     void
                                        [mscorlib]System.Console::WriteLine(string)
                                            IL_000a: ret
„ hello world in VB                       } // end of method Hello::Main
Imports System;
Public Module Hello                       .method public hidebysig specialname
    Sub Main()                          rtspecialname
             Console.WriteLine(“Hello          instance void .ctor() cil managed
                       from VB”);         {
    End Sub                             } // end of method Hello::.ctor
End Module
                                        } // end of class MyApp



                                                                   12               ISS2005
Current List of Languages
Ada                             lcc
                                      (MS Research Redmond)
APL
                                Mondrian (Utrecht)
Basic (Visual Basic)
                                ML
C#                                    (MS Research Cambridge)
C                               Mercury
C++                                   (Melbourne U.)

COBOL                           Oberon
                                      (Zurich University)
Component Pascal
    (Queensland Univ of Tech)   Oz (Univ of Saarlandes)
ECMAScript (JScript)            Perl
Eiffel (Monash University)      Python
FORTRAN                         Scheme
Haskell (Utrecht University)         (Northwestern U.)
Java Language                   SmallTalk 13            ISS2005
Broad Language Support
                                                  VB.NET
Dim s as String
s = "authors"
Dim cmd As New SqlCommand("select * from " & s, sqlconn)
cmd.ExecuteReader()


string s = "authors";
                                                           C#
SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn);
cmd.ExecuteReader();


String *s = S"authors";
                                                     C++
SqlCommand cmd = new
SqlCommand(String::Concat(S"select * from ", s),
                          sqlconn);
cmd.ExecuteReader();
                                            14       ISS2005
  Broad Language Support
String s = "authors";
                                                         J#
SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn);
cmd.ExecuteReader();




                                                 15         ISS2005
  Broad Language Support
                                                   JScript
var s = "authors"
var cmd = new SqlCommand("select * from " + s, sqlconn)
cmd.ExecuteReader()


                                                          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()
                                            16       ISS2005
   Broad Language Support
                                                              Cobol
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".



                                                     17         ISS2005
  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
                                            18       ISS2005
  Broad Language Support
                                                   APL
s←String.New ‘authors’
cmd←SqlCommand.New (‘select * from ‘,s.ToString σ) sqlconn
cmd.ExecuteReader



                                                Smalltalk
|s| := 'authors'.
|cmd| := SqlCommand('select * from '+s, sqlconn).
cmd.ExecuteReader().




                                           19        ISS2005
 Broad Language Support
(let* ( (s "authors")                              Scheme
  (cmd (new-SqlCommand (string-append "select * from " s)
sqlconn)))
(execute-command cmd))
local
        s: STRING
                                                      Eiffel
        cmd: SQLCOMMAND
do
        s := "authors"
        create cmd("select * from " + s, sqlconn)
        cmd.ExecuteReader()
end
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();
};                                          20    Mondrian
                                                     ISS2005
Framework Classes

•   Spans all programming languages
•   Object-oriented and consistent
•   Common type system built-in
•   Extensible
•   Secure




                                  21   ISS2005
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

                                      System
  Collections         IO                 Security              Runtime
  Configuration       Net                ServiceProcess        InteropServices
  Diagnostics         Reflection         Text                  Remoting
  Globalization       Resources          Threading             Serialization
                                                              22              ISS2005
.Net Remoting vs Webservices
Webservices          .Net Remoting
• communication      • binary
  via soap             communication
• over HTTP only     • over TCP or HTTP
• full               • communicates
  interoperability     with .Net only
• performance        • performance two
  good                 times better


                          23     ISS2005
.NET SDK
http://msdn.microsoft.com/netframework/

  • Tools to create, manage and deploy
    applications included in the SDK
  • Includes all command line compilers
     – C#, VB, C++, IL
  • Run all tools from the command line




                                     24   ISS2005
.NET SDK Tools

 •   Configuration and Deployment Tools
 •   Debugging Tools
 •   Security Tools
 •   General Tools




                                    25    ISS2005
Configuration and Deployment Tools

•   Assembly Cache Viewer (Shfusion.dll)
•   Global Assembly Cache tool (gacutil.exe)
•   Installer tool (installutil.exe)
•   .NET Framework Configuration Tool
    (mscorcfg.msc)
•   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)
                                      26       ISS2005
System Requirements
.NET Framework
 • Microsoft Windows® 2000 and higher (with
   with the latest Windows service pack)
 • Processor – Intel P3 or higher
 • RAM – Min 128 MB
 • Hard Disk – 600 MB to install, 370 MB
   consumed
 • Internet Explorer 5.01 or later for Web
   applications (ASP .NET)



                                  27      ISS2005
SSCLI

 • CLI (Common Language Infrastructure)
    – ECMA/ISO specification of loose coupling and interaction for
      component based computing
 • SS (Shared Source)
    – Licensing of source code available to academics for
      teaching, research, experimentation
 • SS + CLI = SSCLI
    – Source code of a CLI implementation from Microsoft
      available under shared source licensing




                                                  28         ISS2005
Visual Studio.NET


  • “Drag and Drop” Web application and services
    development
  • Fully supports .NET Framework
  • Multi-language support
  • Open, extensible development environment
      – Languages focus on compiler – not UI
      – Consistent set of tools across languages



                                          29       ISS2005
.NET Compact Framework

•   Designed specifically for smart devices
•   Lightweight architecture
•   Compatible subset of desktop platform
•   Visual Studio.NET used for app development
•   Adaptable to different application needs
•   Smart Device Extensions for Visual Studio .NET
•   Broad availability
    – Across multiple CPUs
    – Across Windows CE and third-party RTOSes
    – Across a variety of physical form factors
                                         30       ISS2005
An Opportunity?

  • Terrarium (www.gotdotnet.com/terrarium)
    – Freely downloadable Peer to Peer sample
      application built on .NET
    – 2D Game that simulates the ecosystem of a
      Terrarium
    – Each creature is a compiled class library
    – OO Model where creatures react to „events‟
    – Exposes OOP, Web Server Hosting, Web
      Services, Security, Networking concepts to
      students
    – Server Code also available for self hosting or
      exploring
                                           31          ISS2005
Summary
•   .NET Framework enables a new generation of
    distributed web applications and services
    –   Use a unified truly object oriented programming model for desktop
        as well as mobile devices
    –   Standardized data exchange format (XML)
    –   Extensible model
•   .NET is open
    –   Open protocols are the core building block
    –   Standardization is important (W3C, ECMA, ISO)
•   .NET is about all kinds of computing devices
    –   Common framework, consistent paradigm
    –   Apps and platform are portable, adaptable
    –   Devices grow richer by adding secure code
    –   Devices plug natively into Web Services



                                                     32         ISS2005
    How to get started
    when you get the practicum exercise
•     Get the .NET Framework SDK
      Includes command line compilers, doc‟s, samples, etc
      – FREE download from http://msdn.microsoft.com/net
      – FREE download for the SSCLI from
           http://msdn.microsoft.com/net/sscli
      –   Choose a Programming Language
•     Get Visual Studio
      –   Wait for email with accescode and instructions from Ronny Wichers
          Schreur
•     Pick your favorite programming tool
      –   Visual Studio .NET
      –   Notepad
      –   Emacs
•     Check out following sites
      –   www.gotdotnet.com/student
      –   www.msdnaa.com
      –   www.asp.net
                                                         33          ISS2005

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:3
posted:10/5/2011
language:English
pages:33