CS 5381 Topics in Software Development: Goals
CS 5381 Topics in Software Development: Goals
3 4
DB
Browser Web
Client Page
Server
Generic
Client
Web Server DB
GUI
Client Server
Host Process
Server
6
Microsoft .NET Influences
component-based
design n-tier design
7 8
• .NET supports VB, C# (C-sharp), C++, J# (Java 1.2), Eiffel, etc. • Compiled .NET apps run on any supported platform:
?
Win64 Win32 WinCE
app.exe (XP,2K,98)
9 10
• Goal?
– FCL is a portable operating system
11 12
(2) Managed execution Implications of .NET's execution model
• Common Language Runtime must be present to execute code: 1. Clients need CLR & FCL to run .NET apps
– available via Redistributable .NET Framework
APP.exe – 20MB download
– runs on 98 and above, NT (sp6a) and above
OS Process
Underlying OS and HW
13 14
.NET vs Java
Monolithic Component-based
• Monolithic app: all source code compiled into one .EXE • Component-based app: .EXE + 1 or more .DLLs
compute.dll
GUI.exe
APP.exe data.cs
data.dll
17 18
Why component-based? Example: n-tier design
object
• FCL ships as a set of components!
19 20
Assemblies
Development Tools
.EXE / .DLL
assembly
22
OS Process
Underlying OS and HW
23 24
GAC? Summary
25 26
Recall assemblies
Development Tools
.EXE / .DLL
assembly
28
• other platforms?
– FreeBSD / Mac OS X via Rotor (i.e. SSCLI) 3) free IDEs
– Linux via Mono project • #develop, a simplified clone of VS.NET
• WebMatrix, for building web-based applications
29 30
Hello World in C# Why System.Console prefix?
• Here's the source code: • In .NET, all code & data must live within a class
• Often nested within namespaces to help organize things
/* hello.cs */ – a namespace is really just a named collection
WriteLine
subroutine
31 32
• To compile C# with Framework SDK, use the C# compiler • IL = Microsoft's Intermediate Language (i.e. generic asm)
– open Visual Studio .NET command prompt window to set path • ILDasm = IL Disassembler
– csc is the command-line C# compiler
– use /t:exe option to specify console-based EXE as target c:\> ildasm hello.exe
c:\> hello.exe
Hello World!
33 34
35 36
Language options
• Standard choices:
– VB.NET: fully-OOP, case-insensitive, friendly syntax
– C#: the equivalent of Java on the .NET platform
– J#: Java 1.4 syntax, Java 1.2 class library
– C++:
• managed mode: generates .NET assembly
• unmanaged mode: generates traditional Windows binary
37 38
• Here's the source code for a simple Customer class: • Here's the source code for Main, using our Customer class:
/* customer.cs */
/* main.cs */
public class Customer
{ public class App
public string Name; // fields {
public int ID;
public static void Main()
public Customer(string name, int id) // constructor {
{ Customer c;
this.Name = name; c = new Customer("joe hummel", 94652);
this.ID = id; System.Console.WriteLine( c.ToString() );
} }
c:\> app.exe
Customer: joe hummel
41 42
Example Compiling a component
43 44
• Compile using C# compiler as before, except… • Within assembly as part of assembly manifest
– reference component so compiler can locate Customer class! • Visible via ILDasm
– reference also stored inside assembly so CLR can locate
c:\> ildasm app.exe
c:\> csc /t:exe /out:app.exe main.cs /r:customer.dll
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
c:\> app.exe
Customer: joe hummel
45 46
CLR
Underlying OS and HW
47 48
Summary Resources
49 50
References
• Web sites:
– http://msdn.microsoft.com/net
– http://www.gotdotnet.com/
– MSDNAA: http://www.msdnaa.net/
– Rotor (SSCLI): http://msdn.microsoft.com/net/sscli
– Mono: http://www.go-mono.com/
– Free IDEs:
• http://www.icsharpcode.net/OpenSource/SD/default.asp
• http://www.asp.net/webmatrix/
– Anakrino reverse-engineering tool:
• http://www.saurik.com/net/exemplar/
51