Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

20
Süsteemprogrammeerimine C# keeles (Microsoft .NET, .NET Framework 2.0) Vladimir Kjahrenov

Transcript of Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Page 1: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Süsteemprogrammeerimine C# keeles(Microsoft .NET, .NET Framework 2.0)

Vladimir Kjahrenov

Page 2: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

What Is .NET? (1)

Unified development, regardless of language Common functionality available via a class library –

language independent Integrated Development Environment that behaves

similarly for all languages Unified development, regardless of platform

Class library, templates, etc. allow development on many platforms

Web development, desktop development, mobile development are all programmed in the same type of fashion

Page 3: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

What Is .NET? (2)

Unified development, regardless of…operating system? In theory, quite possible - .NET applications could

be run on other operating systems! Just need the key .NET elements ported to the platform

Such efforts already exist – Mono (.NET apps on *nix), Rotor (open source .NET CLI)

Microsoft is supporting and even sponsoring many of these initiatives

Page 4: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Microsoft. NET

.NET is NOT a new operating system .NET is a new infrastructure (Windows, Web based)

.NET delivers software as Web Services .NET is a framework for universal services .NET is a server centric computing model .NET will run in any browser on any platform .NET is based on the newest Web standards .NET Framework is FREE (including the compilers!) .NET development is made MUCH easier by using Visual

Studio .NET

Page 5: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

.NET Internet Standards

HTTP, the communication protocol between Internet Applications

XML, the format for exchanging data between Internet Applications

SOAP, the standard format for requesting Web Services UDDI, the standard to search and discover Web Services

Page 6: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

.NET Benefits Productivity Increases

Reduced development time (class library, more efficient coding constructs) - example

Keep existing language skills intact Allows more interoperation between developers

Better Code Means less support and help desk calls! Again, accomplished in large part by the class library Also due to better coding constructs and patterns

Faster Code Fewer lines of code Better memory management JIT compiling

Page 7: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Technical Advancements (1)

The Class Library! (FCL) No longer need languages like C++ to get difficult tasks accomplished Don’t have to rely on the Win32 API (though you still can) Continuing evolution

New Languages C# (C-Sharp)

The power of C++, the ease of Java Ideal candidate for new development

Visual Basic .NET Not just a new version of Visual Basic Brings new functionality to the platform – has almost all the power of any

other .NET language, including C++ Very easy to pickup by current VB developers

Page 8: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Technical Advancements (2)

Interoperability You don’t need to get rid of existing code!

Upgrade it Connect to it

You can use .NET from legacy applications Expose .NET components as COM (ActiveX) objects Transparent calling

Interoperate with other platforms Connect with Java Connect with objects on other platforms: Unix/Linux,

mainframes

Page 9: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Interoperability - Databases

Data is all-important to the .NET strategy Built in “managed providers” for SQL Server, and now

for Oracle Managed providers are much faster than their ODBC

counterparts Can be easier to use as well

Other databases are not left out – Access, DB2, MySQL, etc. can be handled through the OLEDB provider

Non-traditional “databases” like Excel can also be accessed easily

Page 10: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Advancements in Web Applications Web Services

A very big selling point for .NET - .NET was built with web services in mind!

Very easy to build web services – usually involves adding one line of code to an object

Even easier to consume web services, including those running on Java platforms

ASP.NET Forget everything you knew about ASP ASP.NET applications can be built in any .NET language They are compiled – very high performance Useful tools built into Visual Studio

WYSIWYG interface for design Drag and drop components on to forms Validation, authentication and other objects are easily leveraged

Page 11: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.
Page 12: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

New .NET Software

Windows .NET Windows Vista

Office .NET Microsoft Office 2007

ASP .NET Visual Studio .NET

Page 13: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

.NET’s Future

Windows VISTA A whole new set of programming interfaces – bye-

bye Win32! New advancements in technology

Avalon, a whole new graphics interface WinFS, a new file system architecture Indigo, unified messaging

Page 14: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Visual Studio (.NET) 2005

“Design” and “Code” views Help IntelliSense Keyboard Mapping

Page 15: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

C# Overview

Object oriented Everything belongs to a class

no global scope Complete C# program:

using System;namespace ConsoleTest{

class Class1 {static void Main(string[] args) { … }

}}

Page 16: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

C# Overview (2)

C# is the first “component oriented” language in the C/C++ family

Component concepts are first class:

Properties, methods, events

Design-time and run-time attributes

Integrated documentation using XML

Enables one-stop programming

No header files, IDL, etc.

Can be embedded in web pages

Page 17: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

C# Overview (3)

Garbage collection

No memory leaks and stray pointers

Exceptions

Error handling is not an afterthought

Versioning

Pervasive versioning considerations in all aspects of language design

Page 18: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Hello World

using System;using System;

class Helloclass Hello

{{

static void Main() {static void Main() {

Console.WriteLine("Hello world");Console.WriteLine("Hello world");

}}

}}

Page 19: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

C# Program Structure

Namespaces Contain types and other namespaces

Type declarations Classes, interfaces, delegates

Members Constants, fields, methods, properties, indexers, events,

operators, constructors, destructors

Organization No header files, code written “in-line” No declaration order dependence

Page 20: Süsteemprogrammeerimine C# keeles (Microsoft.NET,.NET Framework 2.0) Vladimir Kjahrenov.

Statements and Comments

Case sensitive (myVar != MyVar) Statement delimiter is semicolon ; Block delimiter is curly brackets { } Single line comment is // Block comment is /* */

Save block comments for debugging!