320 likes | 466 Views
Ingegneria del software I. Seminario 2: Microsoft .NET. Microsoft .NET piattaforma. Visual Studio.NET. .NET Enterprise Servers. .NET Building Block & Services. .NET Devices, User Experience. Microsoft .NET piattaforma. Visual Studio.NET. .NET Enterprise Servers.
E N D
Ingegneria del software I Seminario 2: Microsoft .NET
Microsoft.NET piattaforma Visual Studio.NET .NET Enterprise Servers .NET Building Block & Services .NET Devices, User Experience
Microsoft.NET piattaforma Visual Studio.NET .NET Enterprise Servers .NET Building Block & Services .NET Devices, User Experience
Visual Studio.NET • Framework per sviluppo ed integrazione dei .NET Enterprise Servers sia con .NET building block services che .NET devices. [6] VB C++ C# Scripts … CLS (Common Language Specification) ASP.NET Web Service Web Form Integrates into the system ADO.NET : Data and XML Base Class Library CLR (Common Language Runtime)
CLS (Common Language Specification) • È un insieme di specifiche per l’interoperabilità tra linguaggi. [7] • È un insieme di specifiche di compilazione per l’indipendenza dai linguaggi. [8] • Sono definiti: tipi, metodi, campi, proprietà, enumerazioni, eccezioni, interfacce, eventi, etc.
CLR (Common Language Runtime) • Carica ed esegue codice scritto in runtime-aware per i linguaggi di programmazione. [14] • Le caratteristiche dell’ambiente runtime [14] : • cross-language integration • self-describing components • simple deployment and versioning • integrated security services. • Un unico framework per il progetto, lo sviluppo, l’implementazione, e l’esecuzione di componenti ed applicazioni distribuiti. [9]
Microsoft.NET Platform Visual Studio.NET .NET Enterprise Servers .NET Building Block & Services .NET Devices, User Experience
.NET Enterprise Server Configuration Exchange Server 2000 Mainframe / Other Data Sources SQL Server 2000 Host Integration Server 2000 COM+ Mobile Information Server 2000 Mobile Devices BizTalk Server 2000 Internet Security & Acceleration Server 2000 Supplier / Consumer of XML e-documents Application Center 2000 Internet Information Server Clients on the web
Microsoft .NET Framework ASP+ Win Forms Web Forms Web Services Services FrameWork Base Data Debug . . . Common Language Runtime System Services
Service Framework • Fornisce classi di oggetti a supporto degli sviluppatori per .NET. [14] Base Classes Programming Tools Type System Debugging/Trace I/O and Network Resources Component Model Configuration/Install Drawing (GDI+) EventLog/PerfCounter Threading Globalization Cryptography Serialization
Il linguaggio C# • Caratteristiche del C# [16] • Semplicità • Type safe • Consistenza • Supporto alle versioni • Object Orientation • Flessibilità
C# - caratteristiche • Complessità del C++, • “->” / “::” / “.” notazioni criptiche • Particolari tipo di dato “wchar_t”, “__int64” … • Utilizzo degli interi come booleani, • problema del ‘==‘ e ‘=‘ • In C#, • Notazione principale è il “.”. • È stato introdotto il tipo bool per eliminare confusioni
C# - caratteristiche • In C# non ci sono puntatori. • La gestione della memoria è a carico del garbage collector fornito con l’ambiente .NET • Usando la modalità “unsafe” si può comunque accedere alla memoria direttamente.
C# - Object Orientation • Incapsulamento, ereditarietà, polimorfismo • I metodi della classi non sono virtual per default • public, private, protected e internal • L’ereditarietà permessa è singola
C# - Type Safety • Le variabili non inizializzate non sono ammesse • Il casting dei tipi ad UNSAFE non è permesso • Data overflow, array index boundary checking
Un semplice esempio in C# • hello world. using System; class Hello { public static void Main(string[] args) { Console.WriteLine(“hello, world”); // print the command line arguments for (int i = 0; arg < args.Length; i++) Console.WriteLine(“arg [0],[1]”, i, args[i]); } }
SDC (Self-Describing Components) • I servizi forniti dal runtime sono metadata driven, questi metadati aggiungono informazioni agli eseguibili, come le definizioni di interfacce che prima specificate in IDL, TLB, proxy/stubs.
Architettura dei Web Services Web Service Developer Web Application Developer Request SCL Author class, ASMX Author Page that calls the Proxy Web Service : ASMX Deploy Application Web Server Web Application : ASMX Run Method SDL ASPX Run Proxy Generator Deploy Application C#, VB Deploy Application Web Server Call Methods Web Form Proxy
Web Service, ASMX • Web service server salvato come “asmx” file. • Richieste di web services basate su comunicazioni XML / SOAP. • Oggetti e risorse accessibili via URL
Web Service Development Web Service Developer Web Application Developer Request SCL Author class, ASMX Author Page that calls the Proxy Web Service : ASMX Deploy Application Web Server Web Application : ASMX Run Method SDL ASPX Run Proxy Generator Deploy Application C#, VB Deploy Application Web Server Call Methods Web Form Proxy
1Author Class, ASMX <%@ WebService Language="C#" Class=“MyService" %> using System; using System.Web.Services; public class MyService { [WebMethod] public String MyServiceFunction1(String strParm1, String strParm2) { ... } [WebMethod] public void MyServiceFunction2(Integer intParm) { ... } }
Deploy Application • Per implementare l’applicazione web va copiato il file ASMX nel web folder.
Web Application, ASPX • Per utilizzare i web services va creato un “Proxy”. • Proxies sono creati in DLL compilando il codice stub genrato dal proxy generator. • Il proxy generator genera il codice stub dal SDL che è esportato dai web services.
Web Application Development Web Service Developer Web Application Developer Request SCL Author class, ASMX Author Page that calls the Proxy Web Service : ASMX Deploy Application Web Server Web Application : ASMX Run Method SDL ASPX Run Proxy Generator Deploy Application C#, VB Deploy Application Web Server Call Methods Web Form Proxy
Request SCL + Run Proxy Generator • Creazione del codice del Proxy da SDL. • Webserviceutil /c:proxy/pa:http://hostname/MyService.asmx?SDL /l:Csharp /n:MyServices /c:proxyCrea codice del Proxy dal SDL /pa:URLSpecifica URL per il SCL(SDL) /l:languageSpecifica il linguaggio sorgente /n:namespaceSpecifica il namespace del proxy
Deploy (Proxy) Application • Compila il codice generato e copia il file DLL nel web folder per implementare il proxy. • csc/out:..\bin\MyService.dll /t:library /r:system.data.dll /r:system.web.services.dll /r:system.xml.serialization.dll MyService.cs
Author ASPX <%@ Import Namespace="System.Web.UI.WebControls" %> <%@ Import Namespace=“MyServices" %> <HTML> <HEAD> <TITLE>My Service Page</TITLE> <SCRIPT LANGUAGE="C#" RUNAT="SERVER"> MyService s = new MyService(); // my service String strResult; strResult = s.MyServiceFunction1(“Hello”, “World”); s.MyServiceFunction2(12345); ...
Deploy (Web) Application • Per implementare l’applicazione web va copiato il file ASPX nel web folder.
The innovative feature MyService.ASPX ... <SCRIPT LANGUAGE="C#" RUNAT="SERVER"> Calendar c; SelectedDatesCollection dtSelectedPeriod; ... c = CALENDAR; ... dtSelectedPeriod = calendar.SelectedDates; ... </SCRIPT> ... <ASP:CALENDAR id="CALENDAR" runat="server" ALIGN=LEFT CellPadding="3" CellSpacing="1" DayNameFormat="FirstLetter" FirstDayOfWeek="Default" NextMonthText=">“ ... />
References [1] “Microsoft.NET”, http://www.microsoft.com/net/default.asp [2] “The simplest way to define .NET”, http://www.microsoft.com/net/defining.asp [3] “An Introduction to Microsoft Hailstorm”, http://www.microsoft.com/net/hailstorm.asp [4] “Bill Gates’ Web Site – Speeches”, http://www.microsoft.com/billgates/speeches/2001/03-19hailstorm.asp [5] “Microsoft Announces ‘Hailstorm’, a New Set of XML Web Services Designed …, http://www.microsoft.com/presspass/features/2001/mar01/03-19hailstorm.asp [6] G. Lee, “Paradigm shift in software development environment, MS Visual Studio.NET”, Microsoftware, pp. 202 ~ 213, Korea, Jan. 2001. [7] “Introduction to the Common Language Specification (CLS)”, http://msdn.microsoft.com/library/dotnet/cpapndx/_cor_introduction_to_the_common_language_specification__cls_.htm [8] “What is Common Language Specification?”, http://msdn.microsoft.com/library/dotnet/cpguide/cpconwhatiscommonlanguagespecification.htm [9] “Overview of the Common Language Runtime”, http://msdn.microsoft.com/library/dotnet/cpapndx/_cor_overview_of_the__common_language_runtime.htm
References [10] “Microsoft.NET in Retail and Hospitality”, http://www.microsoft.com/technet/net/NETRetal.asp [11] “Microsoft.NET for Manufacturing: Extending the Enterprise Through Open Protocols”, http://www.microsoft.com/technet/ecommerce/netmanu.asp [12] “Microsoft .NET Platform – What it is”, http://www.microsoft.com/ISN/IndOutlook_Trends/NET_Platform_what_it_is.asp [13] “Overview of Microsoft.NET”, http://www.microsoft.com/ISN/IndOutlook_Trends/ms_net_overview.asp [14] “The Programmable Web”, http://msdn.microsoft.com/msdnmag/issues/0900/webplatform/webplatform.asp [15] “Build Web Applications Faster and Easier Using Web Services and XML”, http://msdn.microsoft.com/msdnmag/issues/0900/VSNET/VSNET.asp [16] “Sharp New Language : C# Offers the Power of C++ and Simplicity of Visual Basic”, http://msdn.microsoft.com/msdnmag/issues/0900/csharp/csharp.asp [17] G. Kim, “The announcement of Hailstorm composed of XML web services”, Microsoftware, p. 172, Korea, Apr. 2001.