Object Oriented Software Engineering Based On A Presentation by Murat Can Ganiz
Object Oriented Software Engineering Based On A Presentation by Murat Can Ganiz
NET
Based on a presentation
by Murat Can Ganiz
Agenda
.NET
C#
2
Definition…
“Microsoft .NET is a set of Microsoft software
technologies for connecting information, people,
systems and devices.”
3
Evolution
Next Generation of COM:
Component oriented software:
4
Architecture
5
.NET Core Components
6
Java and .NET: Runtime environments
Java
Intermediate language is bytecode
Original design targeted interpretation
Java VMs with JIT compilation are now also used
.NET Framework
Intermediate language is MSIL
Provides JIT compilation
What is JIT?
Just-In-Time compilation: translates a bytecode method
into a native method on the fly, so as to remove
the overhead of interpretation
7
Common Language Runtime
CLR sits on top of OS to provide a virtual environment
for hosting managed applications
What is CLR similar to in Java?
Java Virtual Machine (JVM)
CLR loads modules containing executable and
executes their code
Code might be managed or unmanaged
In either case the CLR determines what to do with it
Managed 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 time
8
Compiling and executing managed code
Compilation Microsoft
Source Language Intermediate
Code Compiler Language
(MSIL)
Native JIT
Code Compiler
Execution
9
Common Language Runtime
10
C#
.NET languages
12
Language Compiler List
Ada lcc
APL (MS Research Redmond)
Basic (Visual Basic) Mondrian (Utrecht)
C# ML
(MS Research Cambridge)
C
Mercury
C++
(Melbourne U.)
Java Oberon
COBOL (Zurich University)
Component Pascal Oz (Univ of Saarlandes)
(Queensland U Tech) Perl
ECMAScript (JScript) Python
Eiffel (Monash U.) Scheme (Northwestern U.)
Haskell (Utrecht U.) SmallTalk
13
Why C# ?
Unofficially: because Sun owns Java
Important features are spread out over multiple
languages
Example: do you think developers should have to choose
between pointers (C++) or garbage collection (Java)?
Old languages + new features = poor syntax
Garbage collection in C++?
Event-driven GUIs in Java?
Increase developer productivity!
Type safety
Garbage collection
Exceptions
14
The safety of Java
15
The ease of Visual Basic
First class support for properties
foreach loops
16
The power of C++
Enumerations
Operator overloading
Mathematical, Indexing, and Casting
Function pointers
Called “delegates”
Type safe
Structs
17
The power of C++
Option to pass parameters by reference
or by value
18
“foreach” loops
Iterates over arrays or any class that
implements the IEnumerable interface
foreach(Int32 i in myArray){
Console.WriteLine(i);
}
19
Automatic “boxing”
Automatically converts primitive values to
objects as needed
Stack s = new Stack();
s.push( new Integer( 42 ) );
...
int x = ((Integer)s.pop()).intValue();
20
Inheritance and interfaces
C++ syntax
Simply use a colon and separate by commas
Can inherit from one base class
Can implement any number of interfaces
/// <summary>
/// For identifying object types
/// </summary>
/// <returns>Type of the object</returns>
public override string ToString() //Is the keyword a good idea?
{ return "Fruit"; }
23
A couple of methods from class
Apple
public override bool validSize(double size)
{ if ((size>500) || (size<10)) return false;
else return true;
}
24
Snippets from class Bowl
using System;
using System.Collections;
namespace FruitProject1
{ /// <summary>
/// class Bowl models a bowl of fruit
/// </summary>
public class Bowl
{ private int capacity;
private ArrayList fruitList = new ArrayList();
public Bowl(int capacity)
{ this.capacity = capacity; }
public int getCapacity() { return capacity; }
public int getNumberofFruits() { return fruitList.Count; }
public bool addFruit(Fruit f)
{ if (fruitList.Count<capacity) fruitList.Add(f);
else return false;
return true;
}
//More methods…
} 25
.NET vs. J2EE
Basic Truths
J2EE
Java-centric and platform-neutral
J2EE is not a product you buy from Sun.
J2EE is a set of specifications which indicate how
various J2EE functions must interoperate
If I don’t buy J2EE from Sun, how does Sun make money?
J2EE 1.4 released with features to completely
support web services – JAX-RPC 1.1 API, J2EE
Management 1.0 API, web service endpoints etc.
(Hard to learn, hard to implement!)
27
Basic Truths
.NET
Windows-centric and language-neutral
.NET is a Microsoft product strategy that includes a
range of products from development tools and
servers to end-user applications.
Platform-neutral version of .NET is available
Mono –Novell-sponsored, open source
implementation of the .NET development
environment
( http://www.go-mono.com )
28
Typical N-tier application
architecture
29
.NET and Java: application platforms
.NET
The .NET Framework
Java
Java application servers
Products include:
IBM WebSphere Application Server
BEA WebLogic Application Server
Sun iPlanet Application Server
Oracle Application Server
Many others
30
.NET vs. Java: standard libraries
31
Class Libraries
32
.NET Class Library
IO
GUI Programming
System Information
Collections
Components
Application Configuration
Connecting to Databases (ADO.NET)
Tracing and Logging
Manipulating Images/Graphics
33
Class Library
Interoperability with COM
Globalization and Internationalization
Network Programming with Sockets
Remoting
Serialization
XML
Security and Cryptography
Threading
Web Services
34
Thanks…
This presentation available at:
www.cse.lehigh.edu/~glennb/oose/Csharp_dotNET.ppt
Questions?