1 / 63


MICROSOFT.NET OVERVIEW. By:- Rahul Puri. .NET OVERVIEW. What is .Net? The .NET FRAMEWORK Why is this Important? Metadata Language Neutrality Safety The class library What it’s all for Is this MS’s[latest] attempt to kill Java .NET and COM Visual Studio.NET .NET and standards

Download Presentation


An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.


Presentation Transcript


  2. .NET OVERVIEW • What is .Net? • The .NET FRAMEWORK • Why is this Important? • Metadata • Language Neutrality • Safety • The class library • What it’s all for • Is this MS’s[latest] attempt to kill Java • .NET and COM • Visual Studio.NET • .NET and standards • Imagine Cup • Questions

  3. What is .NET? • It is a "software platform".  It's a language-neutral environment for writing programs that can easily and securely interoperate.  Rather than targeting a particular hardware/OS combination, programs will instead target ".NET", and will run wherever .NET is implemented. • .NET is also the collective name given to various bits of software built upon the .NET platform.  These will be both products (Visual Studio.NET and Windows.NET Server, for instance) and services (like Passport, HailStorm, and so on).

  4. What is .NET? • The components that make up .NET-the-platform are collectively called the .NET Framework. • This article will concentrate on the .NET Framework; a follow-up will tackle .NET-the-software.  Also within this article will be discussion of the standardization process happening in parallel, and a discussion of the differences between .NET and its major rival, J2EE.

  5. The .NET FRAMEWORK The .NET Framework has two main parts: • The Common Language Runtime (CLR). • A hierarchical set of class libraries

  6. Common Language Runtime The most important features are: • Conversion from a low-level assembler-style language, called Intermediate Language (IL), into code native to the platform being executed on. • Memory management, notably including garbage collection. • Checking and enforcing security restrictions on the running code. • Loading and executing programs, with version control and other such features.

  7. Common Language Runtime Before talking in more detail about the CLR I would like clear few bits of terminology: • Managed code • Managed data • Common type system • Assemblies

  8. Common Language Runtime When you target .NET with your compiler, what gets generated isn't native code.  Instead, it's a small PE wrapper around three blocks of data.  PE (Portable Executable) is the binary format used to contain Win32 programs.

  9. Common Language Runtime • The first block of data within the PE wrapper is the IL itself. • The second is called the metadata.  • The third is the manifest. 

  10. Common Language Runtime When running the executable, the CLR uses Just-In-Time compilation.  As each method within the executable gets called, it gets compiled to native code; subsequent calls to the same method don't have to undergo the same compilation, so the overhead is only incurred once. JIT compilation raises some issues.  One is that it demands resources — memory and processor particularly.  To solve this, MS have two JIT compilers: a normal one, that optimizes compiled code fairly well, but can be processor and/or memory intensive; and an "EconoJIT". 

  11. Common Language Runtime • A third kind of compiler has been hinted at (though hasn't made it into the version 1 release), called the "OptJIT".  It will work a little differently; it will use a subset of IL (OptIL) with additional information to suggest to the OptJIT compiler how to generate its output; there may also be greater optimization of the IL.  The idea is to reduce the overhead due to the JIT compilation without sacrificing the quality of the emitted machine code. • The other issue is, of course, performance.  JIT compilation can provide good results once a program is up and running, but can be very slow at load time (as it has to both load and compile the program), and can't necessarily perform some of the more expensive (time-wise) optimizations that optimizing compilers perform.  To tackle this, there's a mechanism for compiling the executable and storing that compiled form — ahead-of-time (AOT) compilation.

  12. Common Language Runtime A number of the core Framework files are compiled in this way, to reduce their start-up overhead.  The IL version is still kept around, and if the system is unhappy with the PreJITted copy for some reason, it can fall back on JIT compilation.  Unfortunately, version 1 of the CLR doesn't regenerate AOT files should they become invalidated in any way; they have to be manually generated instead.

  13. Why Is This Important? It eliminates ".dll hell".  Multiple versions of "the same" assembly can co-exist in the GAC(Global Assembly Cache ), which means that libraries no longer have to maintain backwards compatibility with their predecessors, and that a program will always get the version it's expecting.  This can be done even within the same program — if you have a web server, you can run multiple versions of the same application within it, side-by-side.

  14. Why Is This Important? The quite rigorous protection against tampering with files provides some guarantees that the files won't be modified after release; this should provide some protection against, for instance, viruses (were a virus to infect a file it'd refuse to run).  

  15. METADATA An important feature of managed code is the metadata. Metadata is data describing data, and all manner of metadata is used in .NET.  As mentioned, there's information identifying a particular assembly, and the assemblies that assembly relies upon.  The security privileges required by the assembly are also listed. There's detailed information about the types/classes provided by the assembly, along with descriptions of methods, interfaces, and members.

  16. Language Neutrality The ability to use any language that can target IL is a fundamental feature of .NET.  This is achieved through the Common Type System (CTS).  The CTS defines how classes (or "types", in .NET) are defined.  It describes a number of different features a class can have; member functions (methods), member variables ("fields"), events, and properties (fields that silently use accessors to get/set their values, which can, for instance, allow the creation of a read-only field).  It defines the different kinds of "visibility" that these items can have (for instance, whether a method is public, and can be called by any class, or private, and only callable by the same kind of class).  And it describes how such things as inheritance work for the class, with some constraints; all classes must ultimately derive from System.Object, and only single inheritance is supported.

  17. Language Neutrality The ideas that it formalizes should be familiar to anyone who has programmed with an OO language.  This standardization is important, because it allows different compilers to create compatible objects.  Whether you define your class in C#, VB, JScript, or any other language, it'll generate the same output. And because the output is known to work in a certain way, it no longer matters what was used to create it.  You can start off with a class written in C# and inherit from it in VB.  Then you can seamlessly use it from C++.  It makes no difference — it just works transparently.

  18. Language Neutrality Whilst the CTS was designed to be as transparent as possible (to be compatible with existing language constructs) it does enforce some constraints.  C++ programmers will lose multiple inheritance (like other such systems, you can have only a single base class, but multiple interfaces).  A number of languages will lose case sensitivity (names exposed to classes in other assemblies have to be differentiated by more than case alone; names internal to a class's implementation can still be distinguished only by case).

  19. Language Neutrality The language neutral aspects of .NET run deep.  There are many languages that are in a beta (or better) state, and a number of groups working on these languages have had input into the design of .NET.  One repercussion of this is that IL has certain specialized instructions.  An example of this is that it has a "tail call" instruction.  A tail call is a function call that is the final call of a routine (in imperative languages, returning the unmodified result of another function call would be a tail call).  They are of particular importance to functional languages, which typically use recursion instead of iteration.  When a recursive function is written to use a tail call, a significant optimization of the generated code can be performed. 

  20. Language Neutrality IL can readily express such calls with its tail call instruction.  This makes writing compilers that perform such optimizations easier, and ensures that the JIT can produce optimal code.

  21. Safety Another thing the CLR ensures is that programs don't attempt to do anything dangerous.  The language most changed by this is C++.  Regular C++ permits all sorts of tricks and mistakes.  One can allocate a block of memory and then write too much data to that block, overwriting whatever happened to be lying beyond the allocated block of memory.  Or one can pretend that one type is another type (deliberately or accidentally).  And one can (attempt to) access any location in memory and modify its contents.

  22. Safety Whilst some of these can be innocuous (deliberate treating of one type as another type, for instance) a number can be dangerous.  The most famous of these being the buffer overflow. To counter these problems, the runtime simply states that you can't do that kind of thing (unless you have permission to do so; one can run so-called unsafe programs that can't be verified as safe — indeed, they may not be safe at all).  If you try to write past the end of a buffer, it'll catch it and throw an exception.  If you try to use types in a way that isn't safe, it will catch it and throw an exception. 

  23. Safety One issue with this is that there are ways of generating code that is safe but which the runtime can't verify to be safe.  To permit such code to be run, there's a privilege that can be assigned to users to permit them to run, for instance, unverified code from trusted sources.

  24. The Class Library .NET provides a single-rooted hierarchy of classes.  The root of the namespace is called System; this contains basic types like Byte, Double, Boolean, and String, as well as Object. All objects derive from System.Object.  As well as objects, there are value types. Value types can be allocated on the stack (which is generally quicker to some degree than allocation on the heap), which can provide useful flexibility.  There are also efficient means of converting value types to object types if and when necessary.

  25. The Class Library The set of classes is pretty comprehensive, providing collections, file, screen, and network I/O, threading, and so on, as well as XML and database connectivity. The class library is subdivided into a number of sets, each providing distinct areas of functionality, with dependencies between the sets kept to a minimum.  The aim is to make stripped-down implementations (for small devices) easier to create, as an implementation need only provide those sets of classes that it needs.

  26. What Is It All For? These two things — the CLR and its libraries — provide a versatile platform for software development.  Whilst a lot has been made of the server/web applications, .NET is aimed at client-side development also.  This includes traditional applications (both bespoke business applications and mass market off-the-shelf applications), but also more powerful web-based applications; because finer control over security is possible, as well as more powerful UI capabilities, more capable web applications can be written, more easily; the insecure ActiveX functionality that Microsoft said would change web applications has now come of age, with a truly securable implementation.  .NET (using Windows Forms) aims to provide an alternative to (and perhaps eventual replacement for) traditional Win32 development using VB or MFC or [your favourite GUI toolkit].

  27. What Is It All For? • One key feature of server application development is Web Services.  A Web Services is a component running on a web server that is "consumed" (i.e., used) by a traditional client application, a web-based client application, or another Web Service.  Web Services are consumed using Simple Object Access Protocol (SOAP), a remote procedure call mechanism using XML over HTTP, as their access protocol, in conjunction with WSDL (Web Service Description Language).  WSDL is used to describe the interface(s) published on the web, so that consumers of the service know how to use it.  SOAP is used during the actual execution of the consumer.  The .NET library provides a number of classes to make this easy.

  28. What Is It All For? .NET is also happy to use code that exists outside the CLR, and unmanaged code within .NET.  Unmanaged code can still take advantage of .NET's class library, for instance, and still compile to IL, but it doesn't, say, use the garbage-collected heap.  One can write native code and expose it to .NET, for better performance — an example of this is the Windows Forms classes, which are implemented as native code.

  29. What Is It All For? The Framework has two components, the CLR and the class library.  MS, however, views .NET as having three main components (well, some of the time — they're not entirely consistent on what the platform is).  The first two are the CLR and the class library.  The third is ASP.NET.  This is misleading.  ASP.NET is, as its name would suggest, a version of Active Server Pages that use .NET technologies.  ASP.NET provides a nice environment for writing web applications.  However, it's not true to say that it's a fundamental technology.  Instead, it is an example of a .NET hosting application.  It runs applications within the .NET environment, and provides classes to those applications, but it isn't, in and of itself, a key part of .NET. 

  30. What Is It All For? This ability to host the CLR is open to other programs (in a similar, but far more capable, way in which programs can host ActiveX scripting languages to provide extensibility).

  31. Is This MS Attempt To Kill Java?? When one hears of what .NET is and does, a comparison to Java seems inevitable.  The two platforms are similar in a number of respects.

  32. Is This MS Attempt To Kill Java?? Java is used to refer to three distinct things. • The Java language.  An object-oriented C-style language. • The Java class library.  A comprehensive (if occasionally inconsistent) class library hierarchy. • The Java Virtual Machine (JVM).  Source code is compiled to Java bytecode, which executes inside the JVM; traditionally, it wouldn't be compiled into native code; high-performance JVMs, however, typically compile on-the-fly to instructions native to the underlying hardware.

  33. Is This MS Attempt To Kill Java?? .NET was designed to be language agnostic.  One can readily take a C# class, derive a VB.NET class from it, and then use it in a Managed C++ program — the use of different languages is invisible to the programmer. Whilst a number of languages can compile to Java Bytecode, this is not sufficient to make Java-language-neutral.  Many of those languages are merely script interpreters written in Java (they do not create Java bytecode, the scripts are not aware of running on the Java platform, and hence, cannot use any Java features); many of the projects are simply abandoned.

  34. Is This MS Attempt To Kill Java?? Whilst some (for instance, Jython) can interoperate with Java classes, this represents the minority.  The ability to mix and match the languages being used — to write a class in one language, inherit from it in another, and use it in a third — doesn't exist. The class libraries have a fair degree of commonality.  Java's is currently somewhat more extensive; .NET's is arguably better-developed in some areas (creating forms, for instance).

  35. Is This MS Attempt To Kill Java?? There are differences in the nature of the intermediate languages.  IL would be unsuitable for interpreting because, for instance, it uses generic instructions (for instance, the instruction to add two numbers is the same whether the numbers are integers or floating point), which would require the interpreter to carry around all sorts of type information — type information that with Java bytecode is specified in the instruction itself; Java bytecode has one instruction for adding integers and a different one for adding floating-point numbers.  On the other hand, Java bytecode is tied in some respects to the constructs that the Java language have; IL is more generic.

  36. Is This MS Attempt To Kill Java?? These differences add up. The first is the most obvious to developers — they can use the language they prefer, or is most appropriate (assuming it has a compiler targetting .NET) rather than the language the environment forces upon them.  It should provide an easy route for existing C++ or Visual Basic programmers.  Further, MS have released betas of a product called Visual J#.  It provides an upgrade for Visual J++ programmers.  There is a .NET compiler and a set of class libraries.  These implement the Java language and the Java class library in their entirety as they stood at version 1.1.4.

  37. .NET AND COM MS have been pushing a language and platform independent interoperability mechanism for some years now.  It's called Component Object Model (COM).  There is a degree of overlap between the two.  .NET hides many of the messy details that COM makes programmers (or at least C/C++ programmers; VB programmers will see far fewer differences in this regard) deal with.  COM is all native code, and requires programmers to be conscious of many low-level details which make development using the full power of the technology more burdensome.  .NET makes these issues disappear.  It takes care of the details for you.

  38. .NET AND COM • On the other hand, COM still has some things in its favour.  COM/DCOM has a huge installed base (it can be used on pretty much any Win32 machine), and is used quite extensively (particularly in newer versions of Windows).  Lots of bits of Windows rely on COM components (for instance, Explorer/Internet Explorer), and lots of applications similarly rely on them.  For the time being, at any rate, pure .NET can't replace COM.  It does become, however, a legacy technology.

  39. .NET AND COM But the good news is, you can use COM components from .NET, and you can expose .NET objects as COM components.  The necessary details are worked out for you; all the programmer needs to do is to add some attributes to their code and their .NET classes can be used just like COM components.  Thus the gap between .NET and COM is bridged.  All the messy parts are taken care of by the attributes (this is a demonstration of why attributes are so powerful; two distinct technologies are painlessly integrated using a few lines of code, despite the complexity of what must go on to permit this).

  40. Visual Studio.NET The launch of Visual Studio.Net (VS.Net) marks the official debut of Microsoft .Net -- the ambitious, bet-the-company initiative that aspires to weave a fabric of XML-enabled software and services across the Internet. As Microsoft's flagship integrated development environment (IDE), VS.Net contains the first release versions of two major new programming languages -- C# and Visual Basic.Net (VB.Net) -- and signals the end of the old Visual Basic line.

  41. Visual Studio.NET Together, VS.Net and its languages provide all the tools necessary to build and deploy applications on Microsoft's bold new platform. For Microsoft developers, the best news is that VS.Net is by far the best IDE Microsoft has ever produced. The hidden gem of VS.Net, however, is Active Server Page.Net (ASP.Net), a vast improvement over previous ASP versions that takes the development, performance and maintenance of interactive Web pages to a new level.

  42. Visual Studio.NET VS.Net also instantly establishes itself as the leading IDE for developing Web services -- a new breed of discrete, XML-enabled software component now hailed as the future of application development throughout the industry. In VS.Net, developers can easily create Web services without having to get their hands dirty with XML code.

  43. Visual Studio.NET Despite these benefits, the fact remains that the relentless rise of Java has forced Microsoft to take a huge risk. With C#, VB.Net, and the .Net framework, Microsoft is clearly trying to retain its developer base by providing much of the same functionality offered by Java and the J2EE framework. This is a dramatic break with the past -- particularly for Visual Basic developers, who will now be forced to graduate to object-oriented programming.

  44. Visual Studio.NET Among developers, Microsoft has long been recognised as a leader in creating fully-featured, easy-to-use programming tools. Visual Studio.Net represents a real breakthrough, enabling developers to employ a single, richly appointed environment to write, test and debug code regardless of programming language. Thanks to VS.Net integration and MSIL, a developer can use a single, integrated workspace with a sole debugger that minimises previous stability problems incurred by developing multi-language applications that require simultaneous use of several development tools

  45. Visual Studio.NET VS.Net contains numerous code-generating wizards to help development projects get off the ground quickly and to automate mundane tasks. In large enterprises, where decentralised development teams have diverse requirements, VS.Net offers a substantial productivity boost. Code reuse can occur not just within a single language, but also among various .Net languages -- a VB.Net shop and a C# shop, for example, can easily integrate and reuse code. Language syntaxes may be different, but when different languages instantiate and manipulate the same base classes, shorter learning curves result. As developers grow comfortable with a single unified IDE and its tools, efficiency goes up and training costs go down.

  46. Visual Studio.NET Big surprise for VB users The C# language is clearly the star of the whole .Net mega-production, with Visual Basic.Net as its sidekick. C# and its 'Java-like' qualities -- such as garbage collection and hierarchical namespaces -- have received lots of attention. But VB.Net has had far less coverage, making it easy to overlook a simple fact: VB.Net is so similar to C#, it's worth wondering why Microsoft bothered to create two separate languages. True, VB.Net syntax remains verbose, while C# more closely resembles C -- but both languages access the same programming framework and compile to nearly identical MSIL code.

  47. Visual Studio.NET VB.Net's similarity to previous Visual Basic versions can only be called superficial. With VB.Net, Microsoft is trying to position Visual Basic as a viable enterprise application development language, adding such key features as inheritance, namespaces, multi-threading, and so on -- while preserving some semblance of easy syntax.

  48. Visual Studio.NET Yet Microsoft can't conceal the difficulty of shifting from a glorified scripting language to a truly object-oriented one. The real question is: will millions of Visual Basic 6.0 developers decide that VB.Net is the way to go based on some syntactic similarities? In fact, most Visual Basic 6.0 developers would find it just as easy or difficult to make the leap to the more powerful C# or, for that matter, to Java.

  49. Visual Studio.NET VS.Net comes not only with C# and VB.Net, but also with Visual C++ .Net and Visual J# (actually, in the form of a coupon redeemable when Visual J# launches late this year). All of the languages included with VS.Net compile to MSIL code as do 20 other languages that currently have MSIL compilers, including COBOL, Perl and Python. But by giving C# the most power, Microsoft has made it absolutely clear that C# is the language of choice for Microsoft .Net development.

  50. Visual Studio.NET Both C# and VB.Net protect developers from themselves through managed code. This means that the code is processed within a run-time environment (or 'sandbox'), in which all calls to the underlying OS and memory addresses are to an API -- and therefore 'safe' -- hiding some of the more powerful, difficult features of C++. In a pinch, however, expert C# developers can mark sections of code as 'unsafe' and gain direct access to memory and underlying OS libraries, trading some of the protection of managed code for added power. For better or worse, Java doesn't offer this option (nor, of course, does VB.Net).

More Related