NET What Is It And Why Use It





















- Slides: 21
. NET What Is It And Why Use It? 10/28/2021 . NET - What and Why 1
Software from Components • In the industrial revolution, engineers learned to build things in a consistent, predictable, and 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 10/28/2021 . NET - What and Why 2
Why not build software the same way? • Multiple languages and incompatibilities • Basic, C, C++, COBOL, Visual Basic, C#, Java, Fortran, Perl, Python, Eiffel, Delphi, SQL, Pascal, PL/I, APL, assembly, Scheme, Smalltalk, Prolog, Lisp, RPG, Ada, Ruby, … • Cannot just take a piece of code from a Lisp program, for example, and plug it into a COBOL program and have it work • Usually, cannot even call an Ada function from a Python program without special efforts, for example 10/28/2021 . NET - What and Why 3
Why not build software the same way? • Different Data Types • Many different data types • Not implemented the same way in all languages (consider the many ways strings are implemented) • Implementations vary in size • Character type may be 1 byte (ASCII or EBCDIC) EBCDIC or 2 bytes (or even 4) for Unicode • Integers may be 16 bits, 32 bits, 64 bits, etc. 10/28/2021 . NET - What and Why 4
Why not build software the same way? • Different conventions • Argument passing may be left-to-right or right-to-left • Arguments in various languages may be passed using a stack, others use registers, pointers, or some other means; not consistent among languages • Name collisions • Same word may be used differently in different languages – a function name in one may be a keyword in another 10/28/2021 . NET - What and Why 5
Why not build software the same way? • Different platforms and architectures • Addresses and data: 32 -bit, 64 -bit, … data 16 -bit, 16 32 64 • Big-endian vs. little-endian (the number 01234567 is stored with the 01 at the lowest address in big-endian and at the highest address in little-endian: 01234567 vs. 67452301) 67452301 • IBM's 370 mainframes, mainframes most RISC-based computers, and Motorola microprocessors use the big-endian approach. TCP/IP also uses the big-endian approach (and thus big-endian is sometimes called network order). order • Intel processors (CPUs) and DEC Alphas and at least some programs that run on them are little-endian • Different instruction sets • Differences in register architecture 10/28/2021 . NET - What and Why 6
Why not build software the same way? • Different operating systems even on the same hardware • Almost all user software depends on and uses services (I/O, memory management, processor management, etc. ) provided by the OS and its subsystems • Different OS’s have different ways of implementing the services, different API’s, different conventions, different levels of support for various activities 10/28/2021 . NET - What and Why 7
Why not build software the same way? • Different Human Languages; Languages Different Cultures • English, French, Japanese, Chinese, German, … • Punctuation: In the US, 1. 23 represents 1 and 23 hundredths, while in many European cultures, the same value would be represented as 1, 23 • Temperature: Fahrenheit vs. Celsius; in US 30 degrees is cold while in Canada 30 degrees is hot • Currency: US Dollars vs. Canadian Dollars, Euros, Yen, Rubles, . . . • Dates: 03/04/2014 is March 4, 2014 in the US but it is April 3, 2014 in much of Europe • English vs. Metric measures: Inches, miles, gallons, pounds vs. centimeters, kilometers, liters, and kilograms 10/28/2021 . NET - What and Why 8
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 10/28/2021 . NET - What and Why 9
. NET • Based on a open standard developed by Microsoft, Intel, IBM, and others • Approved as a standard by ECMA • Approved as a standard by ISO • Standards cover CTS, CTS CLS, CLS C#, and other items • Designed to be language independent • Platform neutral • Open to development by anyone 10/28/2021 . NET - What and Why 10
Common Type System (CTS) • All. NET languages support common types – though not necessarily using the same name • System. Int 32 is called int in C++ and C#, and Integer in VB, 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 be compatible with other CTS languages 10/28/2021 . NET - What and Why 11
Common Language Specification (CLS) • All. NET languages must support a minimal subset of. NET features and classes • For example, all must support the CTS, CTS the same. NET class libraries, and so forth • The CLS is a set of rules to which a language compiler must adhere in order to create. NET applications that run in the CLR 10/28/2021 . NET - What and Why 12
Common Language Runtime (CLR) • All. NET compilers emit platform-neutral Intermediate Language (IL) object code rather than native machine language code • 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 • CLR contains a JIT compiler that turns IL into native machine language optimized for its target machine • Very fast and efficient • Done only once and only as needed • CLR also handles garbage-collection, garbage-collection exception handling, handling cross-language debugging, and distributed debugging, debugging and other common features • Includes runtime support for thousands of. NET classes 10/28/2021 . NET - What and Why 13
IL Example. method public hidebysig static void Main() cil managed {. entrypoint. custom instance void [mscorlib]System. STAThread. Attribute: : . ctor() = // Code size 14 (0 xe). maxstack 8 IL_0000: nop IL_0001: newobj instance void Manage. DB. frm. Tbl. Mgmt: : . ctor() IL_0006: call void [System. Windows. Forms]System. Windows. Forms. Application: : Run (class [System. Windows. Forms]System. Windows. Form) IL_000 b: nop IL_000 c: nop IL_000 d: ret } // end of method frm. Tbl. Mgmt: : Main 10/28/2021 . NET - What and Why 14
Runtime Compilation and Execution default. aspx Which language? C# code C# Compiler ML HT JIT compiler Visual Basic. NET code VB. NET compiler MSIL CLR Native code 10/28/2021 . NET - What and Why 15
Platform Neutral • Because the IL code is not targeted at any platform, it is portable between systems • A (. NET) NET. exe and a (. NET) NET. dll compiled on a Windows system will run on an Apple or an IBM mainframe IF it has its own CLR 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 10/28/2021 . NET - What and Why 16
Language Interoperability • The standards that are part of. NET insure that a 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 10/28/2021 . NET - What and Why 17
. NET Implementations • Implementations of. NET and its standard technologies include • Microsoft’s. NET Framework and Visual Studio. NET • The Shared Source Common Language Initiative (SSCLI) SSCLI that runs on BSD Unix and Apple OS-X • Mono open source effort led by Novell and others • More than 30 languages support. NET: . NET • Microsoft: VB. NET, C#, J#, managed C++, Cω, Spec# , F#, Java. Script, Typescript • Python, Perl, Cobol, Delphi, Pascal, Eiffel and many others by non-Microsoft vendors 10/28/2021 . NET - What and Why 18
Much of. NET to be Open Sourced Announced 4/3/2014 10/28/2021 . NET - What and Why 20
The. NET Framework Components Visual C++ Basic C# Perl Python … XML Web Services User Interface ASP. NET ADO. NET and XML Base Class Library JIT, GC, Exceptions, Debugging, etc. Base OS API 10/28/2021 Database support . NET Framework Class Library Web Server Common Language Runtime Message Queuing COM+ (Transactions, Partitions, Object Pooling) IIS Web Apps and Services WMI Win 32 . NET - What and Why 21
Thus, … • Solutions/Applications can be developed in any. NET language or languages (by project) project that fully supports the features used by the application and that adheres to the standards • Different parts of an application (solution) solution can be developed in different languages • Visual Studio compiles a project with a single language compiler, thus source code within a project must be in same language, but it can use components such as class libraries written and compiled in other languages 10/28/2021 . NET - What and Why 22