Jim Fawcett CSE791 – Distributed Objects Spring 2002 Microsoft .Net Jim Fawcett CSE791 – Distributed Objects Spring 2002
Potential of the Web The web started as an extended library of relatively static web pages (1991-98). Web commercialization added a market place of products, e.g., Amazon.com, Dell.com, … (1998-2001). What’s next?
W3C View - Semantic Web W3C’s Director, Tim-Berners-Lee sees a “Semantic Web”. Web pages with semantic tags and catalogs of definitions and relationships between tags that convey “meaning” to computers. The idea is to develop “automated web services such as highly functional agents.” The focus here is a technical model for the web that supplies more detailed infrastructure.
The Service Bazaar Microsoft and Sun seem to have a vision of the web as a bazaar of services, as well as products. With the product model you make one large payment and get unlimited access to one product version, shipped over the web or via a physical route. In the services model you make a per-use payment and get access to the most current version, over the web.
Web Services Provide a service over the internet Support construction of distributed applications Reuse model – a distributed application may use third-party services as part of their basic functionality. Example – Travel Agency application uses scheduling services provided by airlines, trains, and hotels.
PC Magazine – Secret Services, 13 Nov 01
Web Service Components XML – eXtensible Markup Language SOAP – Simple Object Access Protocol UDDI – Universal Description, Discovery, & Integration WSDL – Web Services Description Language
PC Magazine – Secret Services, 13 Nov 01
XML Tagged, hierarchical markup language intended to describe data. Schemas are used to verify that a given XML document satisfies some structural constraints. eXtensible Stylesheet Language (XSL) is a presentation language used to support the styling and presentation of XML docu-ments. XML documents can also be styled with Cascading Style Sheets (CSS).
SOAP Transaction Simple Object Access Protocol (SOAP) XML data packed in soap wrapper, using HTTP protocol Remote Procedure Call (RPC) model
WSDL Describes the capabilities of a web service Tells other machines how to format their requests and responses to a web service Defines a service’s binding to a network transport protocol, usually HTTP
WSDL According to the W3C: Services are defined using six major elements: types, which provides data type definitions used to describe the messages exchanged. message, which represents an abstract definition of the data being transmitted. A message consists of logical parts, each of which is associated with a definition within some type system. portType, which is a set of abstract operations. Each operation refers to an input message and output messages. binding, which specifies concrete protocol and data format specifications for the operations and messages defined by a particular portType. port, which specifies an address for a binding, thus defining a single communication endpoint. service, which is used to aggregate a set of related ports.
UDDI A specification for an internet-wide registry of Web services. Uses metadata Details about the provider Details about how to access the service White pages general information Yellow pages categories by industry, products, services, and locations Green pages technical details about invoking the services
UDDI Sample UDDI Listings Finding a business. <find_business generic='1.0' xmlns='urn:uddi-org:api'> <name>IBM</name> </find_business> Finding a service from a business <find_service generic='1.0' xmlns='urn:uddi-org:api' businessKey='6827FE60-00E2-F6A9-F6C4-C6113993AA77'> <name>UDDI Inquiry</name> </find_service> Getting Details on a service <get_serviceDetail generic='1.0' xmlns='urn:uddi-org:api'> <serviceKey>68280DC6-00E2-F664-135E-C6113993AA77</serviceKey> </get_serviceDetail> (note, these will see if a company has a UDDI directory. The responses from the UDDI are very long in most cases.)
.Net Architecture http://www.dotnet101.com/articles/art014_dotnet.asp
.Net Architecture Common language runtime library C# language A set of base components provided by the common language runtime Networking, containers, GUI parts, … Win Forms and Web Forms New UI framework, simplifying UI implementation ASP+ Active Server Pages supporting compiled server side components ADO+ Database access components using XML and SOAP Scripts can use common runtime library and can be compiled.
Common Language Runtime (CLR) PC Magazine – Extreme Tech Web Site
Common Language Runtime (CLR) Runs bytecodes in an Intermediate Language (IL) format. This is compiled, not interpreted. Scripts now can be compiled and can use the services and components provided by the CLR.
C# Language Looks a lot like Java. Differences: A strong analogy between: Java Virtual Machine & C# code manager Java bytecodes & C# Intermediate Language Java packages & CRL components and assemblies Both have Just In Time (JIT) compilers Both support reflection, used to obtain class information at run time Both languages lack generics Differences: Java and C# do have significant differences C# has most of the operators and keywords of C++ C# has enumerations C# plans to add generics in the second release of Visual Studio 7 C# code supports attributes – tagged metadata
What can you do with C#? Build console applications Build windows applications Uses a process similar to Visual Basic applications. Build windows controls Very like creating an ActiveX control Create web server programs using ASP ASP pages are a mix of HTML and script. The HTML builds a presentation in the client’s browser The script provides associated processing on the server. Build web controls Provide information to users via browser and web forms Build web services Provide information to other applications on other machines Build .Net components
Support for Components C# is designed to support components: Properties, methods, events, attributes, and documentation are all first-class language constructs. Any class can publish a set of events to which objects of another class can subscribe at run time. Attributes, defined by the designer, can be attached to classes, methods, data members, or properties. The compiler can be asked to generate XML documentation based on class attributes. C# integrates with COM Can build wrappers that create COM objects out of C# assemblies. But C# assemblies themselves have a different architecture, and use manifests instead of the registry.
Base Components from the CLR The Common Language Runtime library has components for: String handling Mathematical operations Containers File and directory access Accessing the registry Security Building user interfaces and handling windows messages Network and internet programming Database access
Win Forms and Web Forms Win forms build user interfaces using techniques borrowed from Visual Basic. Significantly simpler than Win32, MFC, or WTL windows programming. Much less powerful in Visual Basic. I don’t know yet how powerful Win Forms are in C#. Web forms attempt to build user interfaces based on HTML pages. Flexible and integrates well with distributed, web-based systems Not as powerful as MFC programming. Can you drop down to WTL or Win32 programming? I don’t know yet.
ADO+ Emphasizes the Data Set, which is a disconnected, in memory, copy of part of the database, which may have multiple tables. This is a performance improvement that minimizes locking that used to occur with ADO recordsets. You instantiate a DataSet, populate it from the database, and work on the DataSet. Send back only changes to the database when you are done working with the DataSet object. Transmission back and forth now uses XML, rather than COM marshaling, as with ADO.
ASP+ ASP code consists of pages of HTML and script. ASP+ code does a lot of what the ASP scripts did using attribute tags. ASP+ pages are compiled into into a .Net class the first time the page is requested. The compiled class is cached for future requests. ASP+ pages can be changed without stopping the web server. “Script” part of ASP+ pages can be written in any .Net language, not just VBScript or JavaScript. Creation of ASP+ pages is directly supported by Visual Studio 7.
Performance? Microsoft .NET Pet Shop Lies, Damned lies and benchmarks? New! Version 1.5 You need to see it to believe it! We implemented Sun's own J2EE best practices blueprint application, the Java Pet Store, using C# and Microsoft .NET. The result? The exact same application functionality was implemented in just 1/4 the code using C#/ASP.NET, and it performs up to 28 times faster than previously published benchmarks of the J2EE application. Lies, Damned lies and benchmarks? http://www.gotdotnet.com/team/compare/petshop.aspx
ECS Courses with .Net Content Dr Furmanski offers courses on Mobile Computing that focus on .Net remoting CSE791 - Distributed Objects: Mostly COM based Discuss C# and .Net Framework in 4 lectures. Projects that may be done with either COM or .Net CSE691/891 – Internet Programming (summer) Almost entirely .Net centered Focus on C#, remoting, ASP.NET, ADO
When can I start using .Net? Visual Studio.Net has been released. Generally available around March 1 Beta 2 has been installed in ECS clusters in Link 010 and 202. You can no longer get the Beta2 from Microsoft downloads. ECS is acquiring the license for MSDN. That implies: In a few days you will be able to get CDs of the Beta2 from CIT When they get the Visual Studio release version, probably in march, that will be available on CDs I am trying to get the Computer Department in Schine to carry Visual Studio at the academic price Books are starting to become available now – see the references on the next slide.
References C# Programming, Harvey et al., Wrox Press, 2000 Covers a lot of the .Net framework as well as C#. C# and the .Net Platform, Troelsen, Apress, 2001 Professional C#, Robinson et al, Wrox Press, 2001 Microsoft .Net vs. J2EE, Jim Farley, www.java.oreilly.com/news/farley_0800.html Comparison of .Net with Java 2.0 Enterprise Edition Deep Inside C#, An Interview with Microsoft Chief Architect Anders Hejlsberg, John Osborn, www.windows.oreilly.com/news/hejlsberg_800.html Interview with the principal developer of C#, who also was the author of the original Turbo Pascal.
More References C# Primer, Stanley Lippman, Addison-Wesley, 2002 C# Web Services, Banerjee et. al., Wrox, 2001 Professional .Net Framework, Hoffman, et. al., Wrox, 2001 Professional ASP.NET, Anderson, et. al., Wrox, 2001