Distributed Middleware - Institute for Computing and

Download Report

Transcript Distributed Middleware - Institute for Computing and

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#
Web Services
J#
Python
…
User Interface
ASP.NET
Data and XML
Base Framework
Common Language Runtime (CLR)
Operating System
Common Language
Runtime
Executes code, maintains
security, handles component
“plumbing” and dependencies
ASP.NET
High-productivity environment
for building and running Web
services
Secure, integrated
class libraries
• Unifies programming models
across languages
• Enables cross-language
integration
• Factored for extensibility
• Designed for tools
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
Code
Language
Compiler
Native
Code
JIT
Compiler
Execution
Code (IL)
Assembly
Metadata
Before installation or
the first time each
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
//hello world in C#
using System;
public class Hello
{
public static void Main()
{
Console.WriteLine(“Hello
from C#”);
}
}
‘ hello world in VB
Imports System;
Public Module Hello
Sub Main()
Console.WriteLine(“Hello
from VB”);
End Sub
End Module
.class public auto ansi beforefieldinit Hello
extends [mscorlib]System.Object
{
.method public hidebysig static void Main() cil
managed
{
.entrypoint
// Code size
11 (0xb)
.maxstack 1
IL_0000: ldstr
"Hello from C#VB "
IL_0005: call
void
[mscorlib]System.Console::WriteLine(string)
IL_000a: ret
} // end of method Hello::Main
.method public hidebysig specialname
rtspecialname
instance void .ctor() cil managed
{
} // end of method Hello::.ctor
} // end of class MyApp
12
ISS2005
Current List of Languages
Ada
APL
Basic (Visual Basic)
C#
C
C++
COBOL
Component Pascal
(Queensland Univ of Tech)
ECMAScript (JScript)
Eiffel (Monash University)
FORTRAN
Haskell (Utrecht University)
Java Language
lcc
(MS Research Redmond)
Mondrian (Utrecht)
ML
(MS Research Cambridge)
Mercury
(Melbourne U.)
Oberon
(Zurich University)
Oz (Univ of Saarlandes)
Perl
Python
Scheme
(Northwestern U.)
ISS2005
SmallTalk 13
Broad Language Support
VB.NET
Dim s as String
s = "authors"
Dim cmd As New SqlCommand("select * from " & s, sqlconn)
cmd.ExecuteReader()
C#
string s = "authors";
SqlCommand cmd = new SqlCommand("select * from "+s, sqlconn);
cmd.ExecuteReader();
String *s = S"authors";
SqlCommand cmd = new
SqlCommand(String::Concat(S"select * from ", s),
C++
sqlconn);
cmd.ExecuteReader();
14
ISS2005
Broad Language Support
J#
String s = "authors";
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
Scheme
(let* ( (s "authors")
(cmd (new-SqlCommand (string-append "select * from " s)
sqlconn)))
(execute-command cmd))
local
s: STRING
cmd: SQLCOMMAND
Eiffel
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();
};
Mondrian
20
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
Services
Description
UI
HtmlControls
Discovery
WebControls
System.WinForms
Design
Protocols
ComponentModel
System.Drawing
Caching
Security
Drawing2D
Printing
Configuration
SessionState
Imaging
Text
System.Data
System.Xml
ADO
SQL
XSLT
Design
SQLTypes
XPath
Serialization
System
Collections
IO
Security
Configuration
Net
ServiceProcess
Runtime
InteropServices
Diagnostics
Reflection
Text
Remoting
Globalization
Resources
Threading
Serialization
22
ISS2005
.Net Remoting vs Webservices
Webservices
• communication
via soap
• over HTTP only
• full
interoperability
• performance
good
.Net Remoting
• binary
communication
• over TCP or HTTP
• communicates
with .Net only
• performance two
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
–
–
–
•
.NET is open
–
–
•
Use a unified truly object oriented programming model for desktop
as well as mobile devices
Standardized data exchange format (XML)
Extensible model
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
–
•
Get Visual Studio
–
•
Wait for email with accescode and instructions from Ronny Wichers
Schreur
Pick your favorite programming tool
–
–
–
•
Choose a Programming Language
Visual Studio .NET
Notepad
Emacs
Check out following sites
–
–
–
www.gotdotnet.com/student
www.msdnaa.com
www.asp.net
33
ISS2005