Microsoft .NETAgendaDefinition…EvolutionArchitecture.NET Core ComponentsJava and .NET: Runtime environmentsCommon Language RuntimeCompiling and executing managed codeSlide 10C#.NET languagesLanguage Compiler ListWhy C# ?The safety of JavaThe ease of Visual BasicThe power of C++Slide 18“foreach” loopsAutomatic “boxing”Inheritance and interfacesFruit example: class Fruit & constructorFruit example: a few Fruit methodsA couple of methods from class AppleSnippets from class Bowl.NET vs. J2EEBasic TruthsSlide 28Typical N-tier application architecture.NET and Java: application platforms.NET vs. Java: standard librariesClass Libraries.NET Class LibraryClass LibraryThanks…Microsoft .NET Object Oriented Software Engineering Course PresentationMurat Can Ganiz04/01/2004Murat Can Ganiz, Lehigh University, 20042Agenda.NETC#.NET vs. J2EE (C# vs. Java)Any .NET or C# programmers here?Murat Can Ganiz, Lehigh University, 20043Definition…“Microsoft .NET is a set of Microsoft software technologies for connecting information, people, systems and devices.”Defining the Basic Elements of .NET: http://www.microsoft.com/net/basics/whatis.aspIn real terms to the developer:A new platform for building applications that run in stand-alone mode or over the InternetMurat Can Ganiz, Lehigh University, 20044EvolutionNext Generation of COM:Component oriented software:Win32/C-style APIs are outdatedCOM was step in right direction, but painful to program withCOM was restricted to VB, C++Binary compatibility/portability an issue: x86 version of COM component needed to be compiled for e.g. PowerPCMemory management also a painCommon Object Runtime:An execution environment for components written in any language:Eventually became .NET with incorporation of Web ServicesStandardised APIWeb Services:Interoperability is key in the connected world:Require open standards for interoperability and leveraging legacy codeMurat Can Ganiz, Lehigh University, 20045ArchitectureMurat Can Ganiz, Lehigh University, 20046.NET Core Components• FCL is Framework Class Library, comparable to JDK’s libraryMurat Can Ganiz, Lehigh University, 20047Java and .NET: Runtime environmentsJavaIntermediate language is bytecodeOriginal design targeted interpretationJava VMs with JIT compilation are now also used.NET FrameworkIntermediate language is MSILProvides JIT compilationWhat is JIT?Just-In-Time compilation: translates a bytecode method into a native method on the fly, so as to remove the interpretation overheadMurat Can Ganiz, Lehigh University, 20048Common Language RuntimeCLR sits on top of OS to provide a virtual environment for hosting managed applicationsWhat is similar to in Java?Java Virtual Machine (JVM)CLR loads modules containing executable and executes their codeCode might be managed or unmanagedIn either case the CLR determines what to do with itManaged Code consists of instructions written in a pseudo-machine language called common intermediate language, or IL.IL instructions are just-in-time (JIT) compiled into native machine code at run timeMurat Can Ganiz, Lehigh University, 20049Compiling and executing managed codeSource CodeLanguage CompilerMicrosoft Intermediate Language (MSIL)CompilationJIT CompilerNativeCodeThe first time each method is calledExecutionMurat Can Ganiz, Lehigh University, 200410Common Language RuntimeC#Murat Can Ganiz, Lehigh University, 200412.NET languagesOver 20 .NET-compatible languagesMost are provided by 3rd parties.NET languages provided by MicrosoftC++Visual BasicC#Murat Can Ganiz, Lehigh University, 200413Language Compiler ListAdaAdaAPLAPLBasic (Visual Basic)Basic (Visual Basic)C#C#CCC++C++Java LanguageJava LanguageCOBOLCOBOLComponent PascalComponent Pascal(Queensland U Tech)(Queensland U Tech)ECMAScript (JScript)ECMAScript (JScript)EiffelEiffel (Monash U.) (Monash U.)Haskell (Utrecht U.)Haskell (Utrecht U.)lcc lcc (MS Research Redmond)(MS Research Redmond)Mondrian (Utrecht)Mondrian (Utrecht)ML ML (MS Research Cambridge)(MS Research Cambridge)Mercury Mercury (Melbourne U.) (Melbourne U.) Oberon Oberon (Zurich University)(Zurich University)Oz (Univ of Saarlandes)Oz (Univ of Saarlandes)PerlPerlPythonPythonScheme (Northwestern U.)Scheme (Northwestern U.)SmallTalkSmallTalkMurat Can Ganiz, Lehigh University, 200414Why C# ?Important features are spread out over multiple languagesExample: do you think developers should have to choose between pointers (C++) or garbage collection (Java)?Old languages + new features = poor syntaxGarbage collection in C++?Event-driven GUIs in Java?Increase developer productivity!Type safetyGarbage collectionExceptionsMurat Can Ganiz, Lehigh University, 200415The safety of Java100% object orientedAutomatic garbage collectionArray bounds checking at runtimeStrict type checkingStructured exception handlingMurat Can Ganiz, Lehigh University, 200416The ease of Visual BasicFirst class support for propertiesFirst class support for eventsforeach loopsMurat Can Ganiz, Lehigh University, 200417The power of C++EnumerationsOperator overloadingMathematical, Indexing, and CastingFunction pointersCalled “delegates”Type safeStructsMurat Can Ganiz, Lehigh University, 200418The power of C++Option to pass parameters by reference or by valueCan disable type-safety, garbage collection, and bounds checkingCan directly manipulate memory with pointersMurat Can Ganiz, Lehigh University, 200419“foreach” loopsIterates over arrays or any class that implements the IEnumerable interfaceInt32[] myArray = new Int32[]{10, 20, 30, 40};Int32[] myArray = new Int32[]{10, 20, 30, 40};foreach(Int32 i in myArray){foreach(Int32 i in myArray){ Console.WriteLine(i);Console.WriteLine(i);}}Murat Can Ganiz, Lehigh University, 200420Automatic “boxing”Automatically converts primitive values to objects as neededStack s = new Stack();Stack s = new Stack();s.push( 42 );s.push( 42 );......int x = (int)s.pop();int x = (int)s.pop();Stack s = new Stack();Stack s = new Stack();s.push( new Integer( 42 ) );s.push( new Integer( 42 ) );......int x = ((Integer)s.pop()).intValue();int x = ((Integer)s.pop()).intValue();Murat Can Ganiz, Lehigh University, 200421Inheritance and interfacesC++ syntaxSimply use a colon
or
We will never post anything without your permission.
Don't have an account? Sign up