140 likes | 377 Views
COMS W4156: Advanced Software Engineering. Prof. Gail Kaiser Kaiser+4156@cs.columbia.edu http://york.cs.columbia.edu/classes/cs4156/. .NET Components. What is .NET?. An object-oriented software development platform, with
E N D
COMS W4156: Advanced Software Engineering Prof. Gail Kaiser Kaiser+4156@cs.columbia.edu http://york.cs.columbia.edu/classes/cs4156/ Kaiser: COMS W4156 Fall 2007
.NET Components Kaiser: COMS W4156 Fall 2007
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 representationbased on XML • TheC# language is the most comfortable for .NET, but not the only one and not mandatory Kaiser: COMS W4156 Fall 2007
How Does Multi-Language Support Work? • A compiler from any languagecompiles an application into CIL (also referred to asMS IL – Microsoft Intermediate Language) • The compiler also generatesmetadata in XML – information on the types and named entities (classes, methods, fields, etc.) defined and used in the application • At runtime, the CIL code isJust-in-Time (JIT)compiledinto the target platform’s native code • The CLR uses the metadata to perform runtime checks for type-safety and security (“managed code”) Kaiser: COMS W4156 Fall 2007
Ngen Common Language RuntimeExecution Model Source code VB C# C++ Compiler Compiler Compiler Assembly Assembly Assembly MSIL Common Language Runtime JIT Compiler CLR Native code Managed Code Managed Code Managed Code Unmanaged Code CLR Services Operating System Services Kaiser: COMS W4156 Fall 2007
So Where’s the Component Model? COM+ (and Web Services) Kaiser: COMS W4156 Fall 2007
.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 Kaiser: COMS W4156 Fall 2007
Example Kaiser: COMS W4156 Fall 2007
Example using 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; } } } Kaiser: COMS W4156 Fall 2007
.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) Kaiser: COMS W4156 Fall 2007
.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 Kaiser: COMS W4156 Fall 2007
IDA #3 Due Next Week! • Tuesday 2 October, 10am • Assignments posted on course website • Submit via CourseWorks • Individual Development Assignment #3 Kaiser: COMS W4156 Fall 2007
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 Kaiser: COMS W4156 Fall 2007
COMS W4156: Advanced Software Engineering Prof. Gail Kaiser Kaiser+4156@cs.columbia.edu http://york.cs.columbia.edu/classes/cs4156/ Kaiser: COMS W4156 Fall 2007