microsoft.net a introduction to the new set of microsoft software technologies course of software...

55
Microsoft .NET Microsoft .NET A introduction A introduction to the new set of to the new set of Microsoft software Microsoft software technologies technologies Course of Software Engineering 2 A.A. 2001-2002 Presented by: Fabio Rossi [email protected]. unige.it

Upload: jaylyn-humphrys

Post on 16-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Microsoft .NETMicrosoft .NET A introduction A introduction

to the new set ofto the new set of

Microsoft software technologies Microsoft software technologies

Course ofSoftware Engineering 2

A.A. 2001-2002

Presented by:Fabio [email protected]

ContentsContents

.NET History.NET History What is .NET?What is .NET? .NET goals.NET goals Basic elementsBasic elements Five servicesFive services Example: The Hospital and the DoctorExample: The Hospital and the Doctor .NET versus J2EE.NET versus J2EE ConclusionConclusion ReferencesReferences

.NET History.NET History

COM

COM +

DCOM

.NET

MTS

1993

1997

1999

What is .NET? What is .NET?

Idea: Idea:

Web as a collaborative environment.Web as a collaborative environment.

More automated, voice-activated, More automated, voice-activated, anywhere, anytime Web anywhere, anytime Web environment.environment.

1/3

What Is .NET? What Is .NET?

A set of services and technologies A set of services and technologies (an infrastructure) that will enable a (an infrastructure) that will enable a programmable, next generation programmable, next generation Internet.Internet.

A complete remake of the company’s A complete remake of the company’s entire product line.entire product line.

2/3

What Is .NET? What Is .NET?

software integration through the use of software integration through the use of XML Web services. XML Web services.

small, discrete, building-block small, discrete, building-block applications that connect to each other—applications that connect to each other—as well as to other, larger applications—as well as to other, larger applications—via the Internet. via the Internet.

3/3

.NET goals.NET goals

1.1. Cross-platform interoperabilityCross-platform interoperability2.2. Multi-language supportMulti-language support3.3. Code reuseCode reuse4.4. Automatic resource managementAutomatic resource management5.5. Type safetyType safety7.7. DebuggingDebugging8.8. Error handlingError handling9.9. Elimination of DLL hellElimination of DLL hell10.10. SecuritySecurity

InteroperabilityInteroperability

ExamplesExamples A routine written in a language L1 may call A routine written in a language L1 may call

another routine written in a different language L2. another routine written in a different language L2. A module in L1 may declare a variable whose A module in L1 may declare a variable whose

type is a class declared in L2, and then call the type is a class declared in L2, and then call the corresponding L2 routines on that variable. corresponding L2 routines on that variable.

If both languages are object oriented, a class in If both languages are object oriented, a class in L1 can inherit from a class in L2. L1 can inherit from a class in L2.

Exceptions triggered by a routine written in L1 Exceptions triggered by a routine written in L1 and not handled on the L1 side will be passed to and not handled on the L1 side will be passed to the caller, which—if written in L2—will process it the caller, which—if written in L2—will process it using L2's own exception-handling mechanism. using L2's own exception-handling mechanism.

Multi-language supportMulti-language support

The .NET platform supports many programming languages. A new compiler must be implemented for each language.

Programmers do not need to be retrained in a completely new language in order to gain the benefits of .NET.

Code ReuseCode Reuse

Apps do not need to be rewritten in a completely new language in order to gain the benefits of .NET.

For example all the billions of lines of COBOL code with some porting effort, could become useable within the .NET environment.

Automatic resource managementAutomatic resource management

No need to allocate memoryNo need to allocate memory No need to deallocate memoryNo need to deallocate memory

• Garbage collectorGarbage collector the runtime automatically handles object the runtime automatically handles object

layout and manages references to objects, layout and manages references to objects, releasing them when they are no longer releasing them when they are no longer being used. This automatic memory being used. This automatic memory management resolves the two most management resolves the two most common application errors, memory leaks common application errors, memory leaks and invalid memory references. and invalid memory references.

Type safetyType safety

Every data structure in all .NET Every data structure in all .NET supported languages has the same supported languages has the same layout.layout.

This means that some code can This means that some code can consume types and instances consume types and instances declared in other languages. declared in other languages.

DebuggingDebugging

During a debugging session, you may During a debugging session, you may move freely and seamlessly across move freely and seamlessly across modules written in L1 and L2. modules written in L1 and L2.

Error handlingError handling

.NET provides structured exception .NET provides structured exception handling, similar to that in C++ or handling, similar to that in C++ or Java, as a fundamental feature Java, as a fundamental feature available to all languages.available to all languages.

This architecture solves many of the This architecture solves many of the problems that have dogged error problems that have dogged error handling in the past.handling in the past.

DLL hell

Maintaining a Windows PC is a chore, because applications are quite complex. They consist of many files, registry entries, shortcuts, and so on.

Different applications can share certain DLLs, and installing a new application can overwrite a DLL an existing application depends on, possibly breaking an old application (“DLL hell”).

Removing an application is complex and is often imperfectly done.

DLL

Stands for “Dynamic Link Library”.Stands for “Dynamic Link Library”.

Pieces of code that apps could take Pieces of code that apps could take runtime.runtime.

SecuritySecurity

Managed components are awarded Managed components are awarded varying degrees of trust, depending on a varying degrees of trust, depending on a number of factors that include their origin number of factors that include their origin (such as the Internet, enterprise network, (such as the Internet, enterprise network, or local computer). or local computer).

This means that a managed component This means that a managed component might or might not be able to perform file-might or might not be able to perform file-access operations, registry-access access operations, registry-access operations, or other sensitive functions.operations, or other sensitive functions.

1/2

SecuritySecurity

The runtime enforces code security. The runtime enforces code security. For example, users can trust that an For example, users can trust that an

executable embedded in a Web page can executable embedded in a Web page can play an animation on screen or sing a play an animation on screen or sing a song, but cannot access their personal song, but cannot access their personal data, file system, or network.data, file system, or network.

The security features of the runtime thus The security features of the runtime thus enable legitimate Internet-deployed enable legitimate Internet-deployed software to be exceptionally feature rich.software to be exceptionally feature rich.

2/2

Basic Elements Basic Elements of .NET of .NET

Smart ClientsSmart Clients

"Smart" client "Smart" client application software application software and operating systems and operating systems enable PCs and other enable PCs and other smart computing smart computing devices to act on XML devices to act on XML Web services, allowing Web services, allowing anywhere, anytime anywhere, anytime access to information access to information

XML Web ServicesXML Web Services

A core set XML WebA core set XML Web services that can beservices that can be combined with othercombined with other XML Web services orXML Web services or used directly withused directly with smart clientsmart client applications. applications.

ServersServers Microsoft provides Microsoft provides

server infrastructureserver infrastructure

Microsoft Windows® Microsoft Windows® 2000 server family 2000 server family

.NET Enterprise .NET Enterprise ServersServers

For deploying, For deploying,

managing, and managing, and orchestrating XML orchestrating XML Web services Web services

Developer ToolsDeveloper Tools

Microsoft Visual Microsoft Visual Studio .NET is the Studio .NET is the solution proposed solution proposed for developers to for developers to build and deploy build and deploy XML Web services. XML Web services.

Transition Transition

The 5 Services The 5 Services

Framework .NetFramework .Net ASP .NetASP .Net Web ServicesWeb Services Windows FormWindows Form ADO .NetADO .Net

Framework .NetFramework .Net The .NET Framework is the programming The .NET Framework is the programming

model of the .NET platform. model of the .NET platform.

It manages much of the plumbing, It manages much of the plumbing, enabling developers to focus on writing enabling developers to focus on writing the business logic code for their the business logic code for their applications. applications.

1/8

Framework .NetFramework .Net

The .NET Framework includes:The .NET Framework includes:

1.1. The Common Language Runtime The Common Language Runtime

2.2. The Class Libraries.The Class Libraries.

2/8

The Common Language RuntimeThe Common Language Runtime

Intermediate Language called Intermediate Language called

MSILMSIL(Microsoft Intermediate Language)(Microsoft Intermediate Language)

CLR: environment for MSIL CLR: environment for MSIL

JITer (Just in Time compiler)JITer (Just in Time compiler)

3/8

The Common Language RuntimeThe Common Language Runtime

The CLR is responsible for run-time The CLR is responsible for run-time services such as:services such as:

1.1. Language integration Language integration 2.2. Security enforcementSecurity enforcement3.3. MemoryMemory4.4. Process Process 5.5. Thread management.Thread management.6.6. Versioning Versioning

4/8

The Common Language RuntimeThe Common Language Runtime InteroperabilityInteroperability

How does the interoperability work in How does the interoperability work in practice? The first key idea is to map all practice? The first key idea is to map all software to the .NET Object Model. Once software to the .NET Object Model. Once compiled, classes don't reveal their compiled, classes don't reveal their language of origin. language of origin.

5/8

C++ C# Eiffel

Object model

Platform

Compilers

More…

The Common Language RuntimeThe Common Language Runtime Type safetyType safety

The runtime enforces code robustness by The runtime enforces code robustness by implementing a strict type- and code-implementing a strict type- and code-verification infrastructure called the verification infrastructure called the Common Type System (CTS). Common Type System (CTS).

The CTS ensures that all managed code is The CTS ensures that all managed code is self-describing. self-describing.

The various Microsoft and third-party The various Microsoft and third-party language compilers generate managed language compilers generate managed code that conforms to the CTS. code that conforms to the CTS.

6/8

The Common Language RuntimeThe Common Language Runtime VersioningVersioning

.NET introduce a mechanism to .NET introduce a mechanism to obviate to the “DLL hell” problem.obviate to the “DLL hell” problem.

Every app have to specify what DLL Every app have to specify what DLL use, and what version.use, and what version.

every DLL version needed by apps is every DLL version needed by apps is host in the system host in the system

7/8

The Class LibrariesThe Class Libraries

• Base classesBase classes : : provide standard provide standard functionality.functionality.

• Data Data classesclasses

: : support persistent support persistent data management.data management.

• XML classesXML classes : : XML data XML data manipulation manipulation and XML and XML translations.translations.

• XML Web Services classesXML Web Services classes : : develop of develop of lightweight lightweight distributed distributed components.components.

• Web Forms classesWeb Forms classes : : rapid develop of Web GUI applications. rapid develop of Web GUI applications.

8/8

Asp .NetAsp .Net The new version of The new version of ASPASP

A set of technologies for building Web A set of technologies for building Web applications and XML Web Services. applications and XML Web Services.

ASP.NET pages execute on the server and ASP.NET pages execute on the server and generate markup such as XML that is sent to generate markup such as XML that is sent to a desktop or mobile browser. a desktop or mobile browser.

ASP.NET pages use a compiled, event-driven ASP.NET pages use a compiled, event-driven programming model that enables the programming model that enables the separation of application logic and user separation of application logic and user interface. interface. More…

XML Web ServicesXML Web Services

Cornerstone of the .NET programming Cornerstone of the .NET programming model. model.

Applications access Web Services via Applications access Web Services via ubiquitous Web protocols and data ubiquitous Web protocols and data formats with no need to worry about how formats with no need to worry about how each Web Service is implemented. each Web Service is implemented.

1/2

More…

XML Web ServicesXML Web Services

Microsoft will distribute a set of default Microsoft will distribute a set of default XML web services called “My Services”XML web services called “My Services”

2/2

Windows FormWindows Form

Win Forms flow from the System Class Win Forms flow from the System Class LibraryLibrary• System.WinFormsSystem.WinForms

Similar model to existing VB formsSimilar model to existing VB forms

Different technology from VB formsDifferent technology from VB forms

Based on class librariesBased on class librariesMore…

Windows FormWindows Form WF controls have semi-trusted access to a user's WF controls have semi-trusted access to a user's

computer. This means that binary or natively computer. This means that binary or natively executing code can access some of the resources executing code can access some of the resources on the user's system (such as GUI elements and on the user's system (such as GUI elements and limited file access) without being able to access limited file access) without being able to access or compromise other resources. or compromise other resources.

Because of code access security, many Because of code access security, many applications that once needed to be installed on a applications that once needed to be installed on a user's system can now be safely deployed user's system can now be safely deployed through the Web. Your applications can through the Web. Your applications can implement the features of a local application implement the features of a local application while being deployed like a Web page. while being deployed like a Web page.

ADO .NETADO .NET

ADO.NET is an improvement to Microsoft ADO.NET is an improvement to Microsoft ADO that provides platform interoperability ADO that provides platform interoperability and scalable data access. and scalable data access.

Using Extensible Markup Language (XML), Using Extensible Markup Language (XML), ADO.NET can ensure the efficient transfer ADO.NET can ensure the efficient transfer of data to any application on any platform.of data to any application on any platform.

1/2

More…

ADO .NETADO .NETcharacteristic characteristic

New data access technologyNew data access technology Designed for disconnected operationDesigned for disconnected operation Optimized for data viewingOptimized for data viewing XML basedXML based Increased flexibilityIncreased flexibility Increased readability of codeIncreased readability of code No real change from a developer's No real change from a developer's

perspective. perspective.

2/2

Example: Example: The Hospital and the DoctorThe Hospital and the Doctor

Actors:Actors: The Doctor (The Doctor (DD))

• PalmtopPalmtop• Cellular phoneCellular phone

The Secretary (The Secretary (SS))• AppleApple

The Hospital (The Hospital (HH))• PCPC

XML Web ServicesXML Web Services:: Call Services:Call Services:

write in VBwrite in VB

• Calling (for, from)Calling (for, from)• Disp (yes/no)Disp (yes/no)• Other functionOther function

SendSMSSendSMSwrite in c#write in c#

• Send (who, what)Send (who, what)• Other functionOther function

INTERNET

Example: Example: The Hospital and the DoctorThe Hospital and the Doctor

Initial situation

Phone-X

ML

PalmtopWinCE

CLRCALL

Doctor Secretary

AppleMAcOS - CLR

CALL –SendSMS

Hospital

PCLinuxCLRCALL

INTERNET

Example: Example: The Hospital and the DoctorThe Hospital and the Doctor

Hospital need help

Phone-X

ML

PalmtopWinCE

CLRCALL

Doctor Secretary

AppleMAcOS - CLR

CALL –SendSMS

Hospital

PCLinuxCLRCALL

CALLING (D,H)

NoResponse TIMEOUT

CALLING(D,H)

CALLING (D,H)

NoResponse

Send(H,msg)

Disp(OK)

.NET vs J2EE.NET vs J2EE

J2EE and .NET are evolutions of existing application server technology used to build enterprise applications.

The earlier versions of these technologies have historically not been used to build web services.

Now that web services has arrived, both camps are repositioning their solutions as platforms that you can also use to build web services.

.NET vs J2EE.NET vs J2EE

The shared vision between both J2EE and .NET is that there is an incredible amount of 'plumbing' that goes into building web services, such as XML interoperability, load-balancing, and transactions.

Rather than writing all that plumbing yourself, you can write an application that runs within a container that provides those tricky services for you.

.NET vs J2EE.NET vs J2EEANALOGIES

.NET vs J2EE.NET vs J2EE

Time-to-Market Features

Both provide runtime mechanisms that insulate software developers from particular dependencies.

Sun J2EE and Microsoft .NET offer language-level intermediation via the Java Runtime Environment (JRE) and the Common Language Runtime (CLR) respectively.

.NET vs J2EE.NET vs J2EE

State management services enable developers to write less code and not worry about managing state, resulting in a higher degree of rapid application development. State management services enable you to build components that hold state.

Persistence services (entity beans) enable developers to write applications without coding data access logic; database-independent applications are easier to build and maintain.

Time-to-Market Features – J2EE better than .NET

.NET vs J2EE.NET vs J2EE

ASP.NET is independent of client device, and allows for user interfaces to be rendered to alternative user interfaces without rewriting code.

Microsoft also offers Queued Components which are superior to MessageDriven Beans.

Microsoft has tried to simplify server-side programming greatly by removing support for features found in traditional enterprise applications, such as stateful servers and simple transactions.

Microsoft also provides business process management and E-Commerce capabilities, which are available in some J2EE implementations but not all.

Time-to-Market Features – .NET better than J2EE

.NET vs J2EE.NET vs J2EE

J2EE promotes Java-centric computing, and all components deployed into a J2EE deployment (such as EJB components and servlets) must be written in the Java language.

To use J2EE, you must commit to coding at least some of your eBusiness systems using the Java programming language. Other languages can be bridged into a J2EE solution through web services, CORBA, JNI, or the JCA, however, these languages cannot be intermixed with Java code.

In theory, JVM bytecode is language-neutral, however in practice, this bytecode is only used with Java.

Language Support – J2EE

.NET vs J2EE.NET vs J2EE

.NET supports development in any language that Microsoft's tools support due to the new CLR. With the exception of Java, all major languages will be supported.

Microsoft has also recently introduced its new C# language which is equivalent (with the exception of portability) to Java and is also available as a programming language within the Visual Studio.NET environment.

All languages supported by the CLR are interoperable in that all such languages, once translated to IL, are now effectively a “common” language. A single .NET component can therefore be written in several languages.

Language Support – .NET

.NET vs J2EE.NET vs J2EE

ADO.NET is built on the premise of ADO.NET is built on the premise of XML data interchange (between XML data interchange (between remote data objects and layers of remote data objects and layers of multi-tier apps) on top of HTTP multi-tier apps) on top of HTTP (SOAP…). (SOAP…).

EJB, JDBC, etc. leave the data EJB, JDBC, etc. leave the data interchange protocol at the interchange protocol at the developer's discretion, and operate developer's discretion, and operate on top of either HTTP, RMI, etc…on top of either HTTP, RMI, etc…

Data Access

Today and the FutureToday and the Future

References References

The Introduction to .NET and its The Introduction to .NET and its componentscomponentsDavid S. PlattDavid S. PlattIntroducing Microsoft .NETIntroducing Microsoft .NETMicrosoft Press – 2001Microsoft Press – 2001

The basic elements of .NET and otherThe basic elements of .NET and otherwww.microsoft.com\netwww.microsoft.com\net

.NET Framework Resource Management .NET Framework Resource Management www.gotdotnet.comwww.gotdotnet.com

Articles on components and architectureArticles on components and architecturewww.itportal.comwww.itportal.com

1/2

References References

J2EE vs .NETJ2EE vs .NET1.1. java.oreilly.com/news/farley_0800.htmljava.oreilly.com/news/farley_0800.html

2.2. Chad Wavter and Ed Roman – J2EE vs .NETChad Wavter and Ed Roman – J2EE vs .NETwww.middleware-company.comwww.middleware-company.com

About InteroperabilityAbout Interoperability www.sdmagazine.com/documents/s=7134/sdm0205j/0205j.htmwww.sdmagazine.com/documents/s=7134/sdm0205j/0205j.htm

2/2