Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 1: .NET What Is It And Why Use It? 9/18/2018

Similar presentations


Presentation on theme: "Lecture 1: .NET What Is It And Why Use It? 9/18/2018"— Presentation transcript:

1 Lecture 1: .NET What Is It And Why Use It? 9/18/2018
.NET - What and Why

2 Software from Components
In the industrial revolution, engineers learned to build things in a consistent, predictable, repeatable way They learned to use assembly lines to assemble items from components Any component of a given type and specification is interchangeable with another of the same type 9/18/2018 .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, … 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 9/18/2018 .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 be 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, . . . 9/18/2018 .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 some other means; not consistent among languages Name collisions Same term may be used differently in different languages – a class name in one language may be a keyword in another 9/18/2018 .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 instruction sets Differences in register architecture 9/18/2018 .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 Operating Systems have different ways of implementing the services, different API’s, different conventions, different security approaches, different levels of support for various activities 9/18/2018 .NET - What and Why

8 Why not build software the same way?
Different Human Languages; Different Cultures English, French, Japanese, Chinese, German, 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, ... Dates: 03/04/2012 is March 4, 2012 in the US, but it is April 3, 2012 in much of Europe Inches, miles, gallons, pounds vs. centimeters, kilometers, liters, and kilograms 9/18/2018 .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 9/18/2018 .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 language agnostic Platform neutral Open to development by anyone 9/18/2018 .NET - What and Why

11 Many others including IronPython, IronRuby, Cobol, Delphi, etc.
The virtual machine runs this 9/18/2018 .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 .NET languages Languages are free to add types, but added types may not always be compatible with other CTS languages 9/18/2018 .NET - What and Why

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

14 CLR, continued CLR contains a Just-In-Time (JIT) compiler that turns IL into native machine language optimized for its target machine 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, exception handling, cross-language debugging, and distributed debugging, and other common features Includes runtime support for thousands of .NET classes 9/18/2018 .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 (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 9/18/2018 .NET - What and Why

16 Runtime Compilation and Execution
Form1 Which language? C# code Visual Basic .NET code C# Compiler VB.NET compiler MSIL JIT compiler CLR Native code 9/18/2018 .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 IBM mainframe . . . IF . . . the target machine has its own CLR with a JIT compiler to convert the IL code to native code targeted to the machine on which it is to run and to provide the runtime support for the .NET classes 9/18/2018 .NET - What and Why

18 Common Language Runtime Base Class Library Support
Class Loader IL to Native Compilers Code Manager Garbage Collector Security Engine Debug Engine Type Checker Exception Manager Thread Support COM Marshaler Base Class Library Support 9/18/2018 .NET - What and Why

19 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-tier class in COBOL.NET can be invoked by a VB.NET Windows Forms front end A .NET string 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 9/18/2018 .NET - What and Why

20 .NET Implementations Implementations of .NET include
Microsoft’s .NET Framework and Visual Studio.NET The Shared Source Common Language Initiative (SSCLI) that runs on BSD Unix and Apple OS-X Mono - open source 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 over 1000 add-ins for Visual Studio .NET, as well as compilers with their own IDE’s from Borland and Macromedia 9/18/2018 .NET - What and Why

21 The .NET Framework Components
Visual Basic C++ C# Perl Python XML Web Services User Interface ASP.NET Web Apps and Services ADO.NET and XML Database support Base Class Library .NET Framework Class Library Common Language Runtime Web Server JIT, GC, Exceptions, Debugging, etc. Message Queuing COM+ (Transactions, Partitions, Object Pooling) IIS WMI Win32 and Win64 Base OS API 9/18/2018 .NET - What and Why

22 Thus, … Solutions/Applications can be developed in any .NET language or languages (by project) that fully supports the features used by the application and that adheres to the standards Different parts of the application (solution) can be developed in different languages 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 9/18/2018 .NET - What and Why


Download ppt "Lecture 1: .NET What Is It And Why Use It? 9/18/2018"

Similar presentations


Ads by Google