1 / 20

Lecture 1: .NET

Lecture 1: .NET. What Is It And Why Use It?. Software from Components. In the industrial revolution, engineers learned to build things in a consistent, predictable, repeatable way Design once, build many identical parts

marv
Download Presentation

Lecture 1: .NET

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.

E N D

Presentation Transcript


  1. Lecture 1: .NET What Is It And Why Use It? .NET - What and Why

  2. Software from Components • In the industrial revolution, engineers learned to build things in a consistent, predictable, repeatable way • Design once, build many identical parts • They learned to use assembly lines to assemble multiple items from sets of identical components • Any component of a given type and specification is interchangeable with another of the same type .NET - What and Why

  3. Why not build software the same way? • Multiple languages and incompatibilities • Basic, C, C++, COBOL, Visual Basic, C#, F#, Java, Fortran, Perl, Python, Eiffel, Delphi, SQL, Pascal, PL/I, APL, assembly, Scheme, Smalltalk, Prolog, Lisp, RPG, Ada, Snobol, Forth, Algol, Modula-2, HTML, Haskell, JavaScript, Objective C, ABAP, … • Cannot just take a block of code from a Lisp program, for example, and plug it into a COBOL program and expect it to work • Usually, cannot easily call an Ada method from a Python program, for example .NET - What and Why

  4. Why not build software the same way? • Different Data Types • Many different data types • Not implemented the same way in all languages • Implementations vary in size • Character type may take 1 byte (ASCII or EBCDIC) or 2 or more bytes for Unicode • Integers may occupy 8 bits, 16 bits, 32 bits, 64 bits, 128 bits, . . . .NET - What and Why

  5. Why not build software the same way? • Different conventions • Argument passing may be left-to-right or right-to-left • Arguments in one language may be passed using a stack; others use registers, pointers, or someothermeans; not consistent among languages • Name collisions • Same term may be used differently in different languages – a classname in one language may be a keyword in another .NET - What and Why

  6. Why not build software the same way? • Different platforms and architectures • Addresses and data: 16-bit, 32-bit, 64-bit,… • Big-endian (ABCD) vs. little-endian (DCBA) • Different instructionsets • Differences in registerarchitecture .NET - What and Why

  7. Why not build software the same way? • Different operating systems even on the same hardware • Almost all user software depends on and uses services provided by the OS and its subsystems • Different OperatingSystems have different ways of implementing the services, different API’s, different conventions, different security approaches, different levels of support for various activities .NET - What and Why

  8. Why not build software the same way? • Different Human Languages; Different Cultures • English, French, Japanese, Chinese, German, Spanish, Arabic, Russian, Hebrew, … • In the US, 1.23 represents 1 and 23 hundredths, while in many European cultures, the same value would be represented as 1,23 • Fahrenheit vs. Celsius; in US,30 degrees is cold while in Canada,30 degrees is hot • US Dollars vs. Canadian Dollars, Euros, Yen, Rubles, Riyals, Dirhams, Pesos, Yuan, ... • Dates: 03/04/2014 is March 4, 2014 in the US, but it is April 3, 2014 in much of Europe • Inches, miles, gallons, pounds vs. centimeters, kilometers, liters, and kilograms . . . .NET - What and Why

  9. COM, CORBA, Enterprise Java Beans • Various companies and groups of companies came up with approaches that could be used to standardize things and allow components to work together • Problems: • All approaches were proprietary • Approaches incompatible with each other • Not based on open standards .NET - What and Why

  10. .NET • Based on a standard developed by Microsoft, Intel, IBM, and others • Approved as a standard by ECMA • Approved as a standard by ISO • Standards cover CTS, CLS, C#, and other items • Designed to be languageagnostic • Platformneutral • Open to development by anyone .NET - What and Why

  11. Many others including IronPython, IronRuby, Cobol, Delphi, JavaScript, etc. The virtual machine runs this .NET - What and Why

  12. Common Type System (CTS) • All .NET languages support common types – though not necessarily using the same names • System.Int32 is called int in C++ and in C#, and Integer in VB, but they are same type and can be passed back and forth as arguments • System.Single is called Single in VB and float in C++ and C#, but all are the same type and are interchangeable in the .NETlanguages .NET - What and Why

  13. Common Language Runtime (CLR) • All .NET compilers emit platform-neutralIntermediate Language (IL) object code (like byte-code in Java) rather than native machine language code • IL is the same regardless of hardware, OS, or .NETlanguage • Output of a project is called an Assembly: may be either a .EXE or a .DLL • Only the CLR needs to know on what platform it is running .NET - What and Why

  14. CLR, continued • CLR contains a Just-In-Time (JIT) compiler that turns IL into nativemachinelanguageoptimized for its targetmachine • Very fast and efficient • Done only once and only if needed • Thus code is compiled, not interpreted as in some languages • CLR also handles garbage-collection, exceptionhandling, cross-language debugging, and distributeddebugging, and other common features • Includes runtimesupport for thousands of .NETclasses .NET - What and Why

  15. IL Example .method public hidebysig static void Main() cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = Code size 14 (0xe) .maxstack 8 IL_0000: nop IL_0001: newobj instance void ManageDB.frmTblMgmt::.ctor() IL_0006: call void [System.Windows.Forms]System.Windows.Forms.Application::Run(class [System.Windows.Forms]System.Windows.Forms.Form) IL_000b: nop IL_000c: nop IL_000d: ret } // end of method frmTblMgmt::Main .NET - What and Why

  16. Which language? VB.NET compiler MSIL C# Compiler JIT compiler Runtime Compilation and Execution Form1 C# code Visual Basic .NET code CLR Nativecode .NET - What and Why

  17. Platform Neutral • Because the IL code is not targeted at any platform, it is portable between systems of different HW, SW, etc. • A (.NET) .exe and a (.NET) .dll compiled on a Windows system will run on a Mac, a Sun, or an IBMmainframe . . . IF. . . the target machine has its ownCLR with a JIT compiler to convert the IL code to nativecode targeted to the machine on which it is to run and to provide the runtime support for the .NET classes .NET - What and Why

  18. Language Interoperability • The standards that are part of .NET insure that: • A Windows control developed in VB.NET can be used in a C# program • A method written in a business-tierclass in COBOL.NET can be invoked by a VB.NETWindowsForms front end • A .NETstring in a Delphi.NET program compiled using a Borland compiler on a Windows computer can be passed to a C# method written using a SSCLI compiler running on an Apple OS-X platform .NET - What and Why

  19. .NET Implementations • Implementations of .NET include • Microsoft’s .NETFramework and Visual Studio.NET • The SharedSourceCommonLanguageInitiative (SSCLI) that runs on BSDUnix and AppleOS-X • Mono - opensource effort up until recently led by Novell and others • More than 30 languages support .NET: • Microsoft: VB.NET, C#, managed C++, Cω, Spec#, F# • Python, Perl, Cobol, Delphi, Pascal, Eiffel, Fortran, RPG, Scheme, Smalltalk, Ruby, Forth, and many others by non-Microsoft vendors • Thousands of tools are available from third-party vendors to aid in .NET Framework development, including more than 1000 add-ins for VisualStudio.NET, as well as compilers with their own IDE’s from Borland and Macromedia .NET - What and Why

  20. Thus, … • Solutions/Applications can be developed in any .NETlanguage or languages (by project) that fully supports the features used by the application and that adheres to the standards • Differentparts of the application (solution) can be developed in differentlanguages • A VB main program can use a class developed in C# that uses another class developed in F#, for example • In a .NET web application, each web page at a web site could be developed in a separate .NET language .NET - What and Why

More Related