Sei sulla pagina 1di 25

The .

NET framework
Course Organisers: Bruce Scharlau (CS3514) Judith Masthoff (CS5540)
Judith Masthoff, University of Aberdeen, 2004

Background
Client-side scripting (e.g. Javascript) Server-side scripting
PERL (Good at Pattern matching) ColdFusion (Looks like HTML) Python (0bject oriented, started from Unix) PHP Active Server Pages (ASP)

Judith Masthoff, University of Aberdeen, 2004

.NET What is it?


Software platform Language neutral Not a language! Framework Class Library: Object oriented collection of reusable classes Common Language Runtime
Judith Masthoff, University of Aberdeen, 2004

.NET What is it?


Designed to solve the challenges of: Software integration Language silos
(no need to learn library for each new language)

Memory bugs Security And more..


Judith Masthoff, University of Aberdeen, 2004

.NET What is it?


VB C++
ASP .NET
Web Forms Web Services ASP.NET Mobile Controls

C#

J#

Visual Studio .NET

Common Language Specification Web Matrix Windows Forms


Or

ADO .NET: Data and XML Base Class Library Common Language Runtime

Judith Masthoff, University of Aberdeen, 2004

CLR
Common Language Runtime
Compilation (Just-in-time compiler) Code execution Memory management Thread execution Error-handling Security support

Initially only for Windows, but others have appeared (Mono for Linux, Rotor for Mac).
Judith Masthoff, University of Aberdeen, 2004

CLS and CTS


Common Language Specification (CLS):
Set of specifications that language and library designers need to follow

Common Type System (CTS):


Implements various types (int, double, etc) and operations on those types

Judith Masthoff, University of Aberdeen, 2004

Compilation in .NET
Code in VB.NET Code in C#
Code in another .NET Language

VB.NET compiler

C# compiler IL(Intermediate Language) code

Appropriate Compiler

CLR (Common Language Runtime) just-in-time compilation


Judith Masthoff, University of Aberdeen, 2004

Intermediate Language
.NET languages are compiled to an Intermediate Language (IL), not machine code.
CLR recompiles the IL code into machine code, just-in-time (JIT): done when a function is called. The JIT code stays in memory for subsequent calls (if memory allows).
Judith Masthoff, University of Aberdeen, 2004

Languages supported
Microsoft provides:
Visual Basic, C#, C++, J#, Jscript

Others are building:


APL, Pascal, Cobol, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk ..

Judith Masthoff, University of Aberdeen, 2004

C#
New language developed specifically for .NET Looks like JAVA or C++ Simpler than C++

Judith Masthoff, University of Aberdeen, 2004

Framework Class Library


Common library across languages (VB, C#, C++, ..) across application types (Windows, Web, ..)

Judith Masthoff, University of Aberdeen, 2004

Framework Class Library


System.Web
Services Description Discovery Protocols Caching Configuration UI HtmlControls WebControls Security SessionState

System.Windows.Forms
Design ComponentModel

System.Drawing
Drawing2D Imaging Printing Text

System.Data
OleDb Common SqlClient SQLTypes XSLT XPath

System.Xml
Serialization

System
Collections Configuration Diagnostics Globalization IO Net Reflection Resources Security ServiceProcess Text Threading Runtime InteropServices Remoting Serialization

Judith Masthoff, University of Aberdeen, 2004

ASP.NET
ASP.NET, the platform services that allow to program Web Applications and Web Services in any .NET language
ASP.NET uses .NET languages to generate HTML pages. HTML page is targeted to the capabilities of the requesting Browser. ASP.NET Program is compiled into a .NET class and cached the first time it is called. All subsequent calls use the cached version.
Judith Masthoff, University of Aberdeen, 2004

ASP.NET
Logical Evolution of ASP
Supports multiple languages Improved performance Control-based, event-driven execution model More productive Cleanly encapsulated functionality

Judith Masthoff, University of Aberdeen, 2004

Web Applications
User browses to a web page Code runs on the server Pure HTML is sent to the browser Nothing to install on client machine Programming model is just like a Windows application
Event handling

Judith Masthoff, University of Aberdeen, 2004

Web Applications
Separation of UI and code
Helps productivity Allows better team work

Drag and drop web controls Validation controls


Client and server side validation

Rich controls
Calendar, datagrid, etc All represented as HTML
Judith Masthoff, University of Aberdeen, 2004

Web Services
It is just an application that exposes its features and capabilities over the network using XML to allow for the creation of powerful new applications that are more than the sum of their parts

Judith Masthoff, University of Aberdeen, 2004

Windows Forms
Consistent way to create Windows applications across languages
Same designers Same event model Same controls

Powerful and useful controls Simplified deployment


But user must have .NET Framework

Judith Masthoff, University of Aberdeen, 2004

Mobile Development
Visual Studio supports building for smart devices. Same tools, controls, classes
Leverage skills

Emulator included in Visual Studio

Judith Masthoff, University of Aberdeen, 2004

ADO.NET
Language neutral data access New objects (e.g., DataSets) Separates connected / disconnected issues Uses same types as CLR Great support for XML

Judith Masthoff, University of Aberdeen, 2004

Visual Studio.NET
Development tool that contains a rich set of productivity and debugging features We will be using a freeware alternative: Web Matrix.

Judith Masthoff, University of Aberdeen, 2004

.NET What is it?


VB C++
ASP .NET
Web Forms Web Services ASP.NET Mobile Controls

C#

J#

Visual Studio .NET

Common Language Specification Web Matrix Windows Forms


Or

ADO .NET: Data and XML Base Class Library Common Language Runtime

Judith Masthoff, University of Aberdeen, 2004

Conclusions
.Net provides way of implementing enterprise systems Different parts can be written in different languages, run in different environments (web, windows, etc), and still reuse code and skills

Judith Masthoff, University of Aberdeen, 2004

Tutorials
In the next three weeks, you will build an ASP.NET front end, using C#. Tutorial 1: Providing a user-interface for the application, and logic. Tutorial 2: Connecting your application to a database. Tutorial 3: Cleaning up the application, by separating the C# code out.
Judith Masthoff, University of Aberdeen, 2004

Potrebbero piacerti anche