Presentation is loading. Please wait.

Presentation is loading. Please wait.

7/23/2016 1.NET - What and Why Lecture 1:.NET What Is It And Why Use It?

Similar presentations


Presentation on theme: "7/23/2016 1.NET - What and Why Lecture 1:.NET What Is It And Why Use It?"— Presentation transcript:

1 7/23/2016 1.NET - What and Why Lecture 1:.NET What Is It And Why Use It?

2 7/23/2016 2.NET - What and Why 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

3 7/23/2016 3.NET - What and Why 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, … Lisp COBOLCannot just take a block of code from a Lisp program, for example, and plug it into a COBOL program and expect it to work Ada PythonUsually, cannot easily call an Ada method from a Python program, for example

4 7/23/2016 4.NET - What and Why 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 ASCII EBCDICUnicodeCharacter type may take 1 byte (ASCII or EBCDIC) or 2 or more bytes for Unicode Integers8163264 128Integers may occupy 8 bits, 16 bits, 32 bits, 64 bits, 128 bits,...

5 7/23/2016 5.NET - What and Why Why not build software the same way? Different conventions left-to-rightright- to-leftArgument passing may be left-to-right or right- to-left stackregisterspointers someothermeansArguments in one language may be passed using a stack; others use registers, pointers, or some other means; not consistent among languages Name collisions classname keywordSame term may be used differently in different languages – a class name in one language may be a keyword in another

6 7/23/2016 6.NET - What and Why Why not build software the same way? platformsarchitecturesDifferent platforms and architectures Addressesdata163264Addresses and data: 16-bit, 32-bit, 64-bit,… Big-endianlittle-endianBig-endian (ABCD) vs. little-endian (DCBA) instructionsetsDifferent instruction sets registerarchitectureDifferences in register architecture

7 7/23/2016 7.NET - What and Why Why not build software the same way? operating systemsDifferent operating systems even on the same hardware OSAlmost all user software depends on and uses services provided by the OS and its subsystems OperatingSystems implementingservices API’sconventionssecurity levelssupportDifferent Operating Systems have different ways of implementing the services, different API’s, different conventions, different security approaches, different levels of support for various activities

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

9 7/23/2016 9.NET - What and Why 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: proprietaryAll approaches were proprietary incompatibleApproaches incompatible with each other NotopenstandardsNot based on open standards

10 7/23/2016 10.NET - What and Why.NET Based on a standard developed by Microsoft, Intel, IBM, and others ECMA (European Computer Manufacturers Association information and communications systems)Approved as a standard by ECMA (European Computer Manufacturers Association – an international standards body for information and communications systems) ISOInternational Standards OrganizationApproved as a standard by ISO (International Standards Organization) CTSCLSC#,Standards cover CTS, CLS, C#, and other items languageagnosticDesigned to be language agnostic PlatformneutralPlatform neutral OpenOpen to development by anyone

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

12 7/23/2016 12.NET - What and Why Common Type System (CTS) All.NET languagescommon typesAll.NET languages support common types – though not necessarily using the same names System.Int32intC++ C#, IntegerVBSystem.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 between languages as arguments System.SingleSingleVBfloat C++C#,.NETSystem.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

13 7/23/2016 13.NET - What and Why Common Language Runtime (CLR) Intermediate Language (IL)All.NET compilers emit platform-neutral Intermediate Language (IL) object code (like byte-code in Java) rather than native machine language code IL hardwareOS.NET languageIL is the same regardless of hardware, OS, or.NET language Assembly.EXE.DLLOutput of a project is called an Assembly : may be either a.EXE or a.DLL CLRplatformOnly the CLR needs to know on what platform it is running

14 CLR, continued CLRJust-In-Time (JIT) ILnativemachinelanguageoptimized targetmachineCLR 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 compiledinterpretedThus code is compiled, not interpreted as in some languages CLRgarbage-collectionexception handlingcross-language debugging, distributeddebuggingCLR also handles garbage-collection, exception handling, cross-language debugging, and distributed debugging, and other common features runtimesupport.NETIncludes runtime support for thousands of.NET classes 7/23/2016 14.NET - What and Why

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

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

17 7/23/2016 17.NET - What and Why Platform Neutral IL portableBecause the IL code is not targeted at any platform, it is portable between systems of different HW, SW, etc. NET.exeNET.dll WindowsMac SunIBMmainframeA (.NET).exe and a (.NET).dll compiled on a Windows system will run on a Mac, a Sun, or an IBM mainframe... IF...... IF... CLRJIT compilerILnativecode runtime support for the.NET classes 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

18 7/23/2016 18.NET - What and Why Common Language Runtime Class Loader IL to Native CompilersCodeManagerGarbageCollector Security Engine Debug Engine Type Checker Exception Manager Thread Support COM Marshaler Base Class Library Support

19 7/23/2016 19.NET - What and Why Language Interoperability.NETThe standards that are part of.NET insure that: VB.NET C#A Windows control developed in VB.NET can be used in a C# program methodbusiness-tierclass COBOL.NETVB.NET WindowsFormsA method written in a business-tier class in COBOL.NET can be invoked by a VB.NET Windows Forms front end NETstringDelphi.NET WindowsC# SSCLI Apple OS-XA.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

20 7/23/2016 20.NET - What and Why.NET Implementations.NETImplementations of.NET include NETFrameworkVisual Studio.NETMicrosoft’s.NET Framework and Visual Studio.NET SharedSourceCommonLanguageInitiativeSSCLI BSDUnixAppleOS-XThe Shared Source Common Language Initiative (SSCLI) that runs on BSD Unix and Apple OS-X MonoopensourceNovellMono - open source effort up until recently led by Novell and others 30.NETMore than 30 languages support.NET: VB.NET, C#, managed C++, Cω, Spec#, F#Microsoft: VB.NET, C#, managed C++, Cω, Spec#, F# Python, Perl, Cobol, Delphi, Pascal, Eiffel, Fortran, RPG, Scheme, Smalltalk, Ruby, Forthnon- MicrosoftPython, Perl, Cobol, Delphi, Pascal, Eiffel, Fortran, RPG, Scheme, Smalltalk, Ruby, Forth, and many others by non- Microsoft vendors.NET Frameworkadd-ins VisualStudio.NETcompilersIDE’s Borland, Mono,MacromediaThousands of tools are available from third-party vendors to aid in.NET Framework development, including thousands of add-ins for Visual Studio.NET, as well as compilers with their own IDE’s from Borland, Mono project, and Macromediaadd-ins

21 7/23/2016 21.NET - What and Why The.NET Framework Components Win32 and Win64 MessageQueuingCOM+ (Transactions, Partitions, Object Pooling) IISWMI Common Language Runtime.NET Framework Class Library ADO.NET and XML XML Web Services User Interface VisualBasicC++C# ASP.NET PerlPython… Database support Web Apps and Services Base Class Library JIT, GC, Exceptions, Debugging, etc. Web Server Base OS API

22 7/23/2016 22.NET - What and Why Thus, … Solutions/Applications.NETlanguagelanguagesprojectSolutions/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 Differentpartssolution differentlanguagesDifferent parts of the application (solution) can be developed in different languages VB main programclassC# classF#,A VB main program can use a class developed in C# that uses another class developed in F#, for example.NET web application separate.NET languageIn a.NET web application, each web page at a web site could be developed in a separate.NET language


Download ppt "7/23/2016 1.NET - What and Why Lecture 1:.NET What Is It And Why Use It?"

Similar presentations


Ads by Google