Com S 430
Com S 430
Overview
Types of software systems
The .NET architecture
Managed code and CLR
Visual Studio .NET
Types of applications
References
Jeffrey Richter, “Applied Microsoft .NET Framework
Programming”, Microsoft Press, 2002
Andrew Troelsen, “C# and the .NET Platform”, Apress, 2001
http://www.devhood.com/training_modules/
Com S 430
Types of Software Systems
Desktop solutions
Desktop software is the most commonly deployed “service
solution” in existence.
It is a chameleon that takes many shapes, colors, and sizes
depending on the service it is aimed to deliver.
Client/server solutions
Desktop applications are broken into logical pieces and
distributed throughout a network of computers.
Internet solutions
The Internet is the computer.
A Web browser is the user interface or client, the Internet is
the server.
Com S 430
Challenges of Software
What is the right operating system?
Why a target platform?
Why not the best platform for the solution (such as the one
that offers the most complementary or required features)?
The operating system limits choice of development
languages and tools.
.NET is not available on Linux/Solaris platforms.
Are you experienced? (Language and tool experience)
Once you have made your choice there is no turning
back!
Com S 430
Why .NET?
Com S 430
Internet Distributed Software
Second-Tier
(database or Second-Tier Second-Tier
other server)
Client Client
Com S 430
Supported Standards
Hypertext Transfer Protocol (HTTP)
eXtensible Markup Language (XML)
Simple Object Access Protocol (SOAP)
HyperText Markup Language (HTML)
TCP/IP
Universal Description Discovery Integration
(UDDI)
Web Service Description Language (WSDL)
Extensible Stylesheet Language (XSL)
Com S 430
Defining the .NET Framework
The .NET Framework is
A software development environment
A runtime engine for Managed Code
A platform designed for Internet-
Distributed software
Com S 430
Abstract View of .NET
Web Services Building blocks
.NET Applications
Enterprise Servers
Languages: SQL Server …
C#, Visual Basic, Perl
Runtime
Service: .NET & COM+
Common Common
Type Language
System Runtime .NET Framework
Windows/FreeBSD
Com S 430
.NET Components
In the .NET framework, the unit of
deployment is an assembly.
An assembly contains:
Code that is executed on a virtual machine for the
common language runtime (CLR),
Metadata,
Additional resources.
Com S 430
A First Look at Managed Code
HelloGUI.cs:
program entry point
using System.Windows.Forms;
using System.Drawing;
class MyForm:Form{
public static void Main(){
Application.Run(new MyForm());
}
new paint method
protected override
void OnPaint(PaintEventArgs e){
e.Graphics.DrawString( "Hello World!",
new Font("Arial", 35),
Brushes.Blue, 10, 100);
}
}
Com S 430
Compile & Run
c: \> csc /target:winexe HelloGui.cs
Com S 430
Managed Code and the CLR
The Common Language Runtime (CLR) is a
runtime engine
Manages .NET Code (such as C# applications)
Provides features such as memory management,
thread management, object type safety, security,
etc.
Is a part of the .NET Framework
Managed code
Code that targets the CLR
Any .NET Language, including C#, Visual Basic,
C++, Java, Cobol, etc.
Com S 430
The CLR and Managed Code
Managed Executable
Reusable
Legacy Managed Components
Software
(unmanaged code)
Common Language Runtime
(JIT compilation, memory management, etc.)
Windows
(or other operating oystem)
Com S 430
IL and Metadata
All Managed executables consist of
Intermediate Language (IL) instructions
Metadata
IL
CPU independent machine language
Just-in-time compiled at runtime
Metadata
Structured information
describes programming constructs including
Classes definitions, field and method definitions,
parameter lists, return types, etc.
Com S 430
From Source Code to Managed .exe
HelloGui.cs
using System.Windows.Forms;
using System.Drawing;
class MyForm:Form{
public static void Main(){
Application.Run( new MyForm() );
} C# Compiler
protected override
void OnPaint(
PaintEventArgs e){
e.Graphics.DrawString( "Hello World!",
new Font("Arial",35),
Brushes.Blue, 10, 100);
HelloGui.exe
Metadata
A Managed
Application IL
Com S 430
Just-in-Time Compiling
All managed code runs in native machine language
Com S 430
Executing a Managed Application
At execution time the IL and
Metadata are JIT compiled
HelloGui.exe
Metadata
Running Process’ Memory
IL
JIT Compiler
Native
Machine Language
10010100 10110000 10000000 10111010
11011011 11010111 11000010 01110110
Pointer-less environment
Com S 430
Cross Language Support
The .NET Framework supports many languages.
Any compiler can be modified to emit managed
executables.
IL and metadata
Languages that target the .NET Framework
C#, Visual Basic, C++, Java, PERL, COBOL, SmallTalk
Dozens more existing and on the way
Regardless of source language, all managed code can
Use the same tools
Use the same reusable components
Take advantage of features of the CLR
Developers use their language of choice.
Com S 430
Visual Studio.NET
A Integrated Development Environment
To develop managed and unmanaged applications
Supports C#, C++, Visual Basic, JavaScript
Many useful tools and wizards
Com S 430
Creating a New Project
Com S 430
First Look
Com S 430
Running the Project
Com S 430
The Framework Class Library
Included with the .NET Framework is a set of .NET
Framework Class Library (FCL) assemblies that
contains several thousand type definitions.
Classes, interfaces, enumerations and structures
Types for
Common tasks such as collections, file IO, memory and
thread management
GUI and window manipulation
Web form and web service applications
Totally object oriented toolbox for developers
Ships as part of the .NET Framework
Com S 430
Kinds of Applications
The CLR and the FCL allow developers to
build the following kinds of applications:
Com S 430
ASP.NET XML Web Services
XML Web services are methods that can
be accessed over the Internet.
Com S 430
ASP.NET Web Forms
Web Forms are HTML-based applications
(Web sites).
Com S 430
Windows Forms
Windows Forms are used to develop rich Windows
GUI applications.
Com S 430
Windows Console Applications
Applications with very simple user
interface demands.
Com S 430
Windows Services
Windows Services are service applications
controllable via the Windows Service Control
Manager (SCM).
Settings…
Administrative Tools…
Services…
Com S 430
Component Library
Com S 430
Managed Applications - Summary
Common application
GUI Windows applications (Windows Forms)
Console applications or command line applications
Web applications (ASP.NET)
Web Forms applications
Web services
Scripted code
Applications like word processors or database servers can
host the CLR
Use any managed language (C#, VB, etc.) as a script or
macro language
Wherever you use managed code.
Com S 430
Open Source C# IDE
#develop (short for SharpDevelop) is a free IDE for C# and
VB.NET projects on Microsoft's .NET platform.
It is open-source (GPL), and you can download both sourcecode
and executables from http://www.icsharpcode.net.
Com S 430