Upload
drew-bray
View
66
Download
0
Embed Size (px)
DESCRIPTION
COMS W4156: Advanced Software Engineering. Prof. Gail Kaiser [email protected] http://york.cs.columbia.edu/classes/cs4156/. .NET Components. What is .NET?. An object-oriented software development platform, with - PowerPoint PPT Presentation
Citation preview
27 September 2007 Kaiser: COMS W4156 Fall 2007 1
COMS W4156: Advanced Software Engineering
Prof. Gail Kaiser
http://york.cs.columbia.edu/classes/cs4156/
27 September 2007 Kaiser: COMS W4156 Fall 2007 2
.NET Components
27 September 2007 Kaiser: COMS W4156 Fall 2007 3
What is .NET?
• An object-oriented software development platform, with– peer to peer multi-language interoperability (as
opposed to Java’s “native methods”)– common intermediate language (CIL)– common language runtime (CLR)– common data representation based on XML
• The C# language is the most comfortable for .NET, but not the only one and not mandatory
27 September 2007 Kaiser: COMS W4156 Fall 2007 4
How Does Multi-Language Support Work?
• A compiler from any language compiles an application into CIL (also referred to as MS IL – Microsoft Intermediate Language)
• The compiler also generates metadata in XML – information on the types and named entities (classes, methods, fields, etc.) defined and used in the application
• At runtime, the CIL code is Just-in-Time (JIT) compiled into the target platform’s native code
• The CLR uses the metadata to perform runtime checks for type-safety and security (“managed code”)
27 September 2007 Kaiser: COMS W4156 Fall 2007 5
Common Language RuntimeExecution Model
CLR
VBSource code
Compiler
C++C#
Assembly AssemblyAssembly
Operating System Services
MSIL
Common Language Runtime JIT Compiler
Compiler Compiler
Native code
ManagedCode
ManagedCode
ManagedCode
UnmanagedCode
CLR Services
Ngen
27 September 2007 Kaiser: COMS W4156 Fall 2007 6
So Where’s the Component Model?
COM+(and Web Services)
27 September 2007 Kaiser: COMS W4156 Fall 2007 7
.NET Serviced Components
• COM+ 1.5 = COM 1.0 with performance and scaling improvements
• .NET components derive from the System.EnterpriseServices.ServicedComponent class and use the System.EnterpriseServices namespace
• Must be registered with a COM+ application• But can also use COM+ services outside
components
27 September 2007 Kaiser: COMS W4156 Fall 2007 8
Example
27 September 2007 Kaiser: COMS W4156 Fall 2007 9
Exampleusing System.EnterpriseServices; using System.Runtime.CompilerServices; using System.Reflection; // Supply the COM+ application name. [assembly: ApplicationName("BankComponent")] // Supply a strong-named assembly. [assembly: AssemblyKeyFileAttribute("BankComponent.snk")]namespace BankComponent
{ [Transaction(TransactionOption.Required)] public class Account : ServicedComponent { [AutoComplete]
public bool Post(int accountNum, double amount) { /* Updates the database; no need to call
SetComplete. Calls SetComplete automatically if no exception is generated. */
return false; } } }
27 September 2007 Kaiser: COMS W4156 Fall 2007 10
.NET vs. COM+
• No IUnknown base interface• No reference counting, uses garbage
collection• No class factories, the .NET runtime
resolves to a particular class within an assembly
• No apartments, programmer synchronizes (or uses automatic .NET synchronization domains)
27 September 2007 Kaiser: COMS W4156 Fall 2007 11
.NET vs. COM+
• No IDL (Interface Definition Language) files, the compiler generates the assembly metadata and dependencies are captured during compilation (in manifests)
• No GUIDs (globally unique identifiers), instead uses scoping based on namespaces and “strong names” (unique digital signature using an encryption key)
• Evidence-based security (where component came from), in addition to role-based
• Doesn’t rely on registry, reduces DLL Hell
27 September 2007 Kaiser: COMS W4156 Fall 2007 12
IDA #3 Due Next Week!
• Tuesday 2 October, 10am
• Assignments posted on course website
• Submit via CourseWorks
• Individual Development Assignment #3
27 September 2007 Kaiser: COMS W4156 Fall 2007 13
Upcoming Deadlines
• Revised project concept due October 9th – first iteration begins
• First iteration plan due October 16th • First iteration progress report due October 23rd • First iteration demo week October 30th –
November 8th • First iteration final report due November 9th
27 September 2007 Kaiser: COMS W4156 Fall 2007 14
COMS W4156: Advanced Software Engineering
Prof. Gail Kaiser
http://york.cs.columbia.edu/classes/cs4156/