Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian [email protected] Nat Friedman...

21
Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian [email protected] Nat Friedman VP Software Development, Ximian [email protected]

Transcript of Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian [email protected] Nat Friedman...

Page 1: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

Advanced Mono Development: Best Practices

Miguel de IcazaCTO, Ximian [email protected]

Nat FriedmanVP Software Development, [email protected]

Page 2: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.2

one Net: Information without boundaries…where the right people are connected with the right information at the right time to make the right decisions.

The one Net vision

Novell exteNd™

Novell Nsure™

Novell Nterprise™

Novell NgageSM

:

:

:

:

Page 3: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.3

The one Net vision

Novell Nterprise is an innovative family of products which gives you the power to enable and manage the constant interaction of people with your business systems — regardless of who they are or where they are.

Novell Nterprise™

Novell exteNd™

Novell Nsure™

Novell Nterprise™

Novell NgageSM

:

:

:

:

Page 4: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.4

Mono Project: Two Main Goals.

• Improve Linux Developer Productivity.

• ISV Migration path from Windows to Linux.

• An Open Source implementation of .NET Framework.

Page 5: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.5

The Two Stacks.

Mono Runtime

Microsoft Compatibility Libraries Mono Libraries

ASP.NET

ADO.NET

Windows.Form

Java Compatibility

iFolder

Evolution#

Gnome#

Novell.LDAP

ZipLib

GTK#

Apache Mono

Mozilla

MySQL/Postgress

Page 6: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.6

Compatible: What Mono Will Run.

Mono 1.0 will run Microsoft.NET code that uses:• mscorlib, System, System.Net• System.Xml • System.Web (ASP.NET Web Forms)• System.Web.Services (ASP.NET Web Services) • Remoting, and SOAP Remoting (compatibility issues)• System.Drawing.

Binary compatible:• Compile on Windows Deploy on Linux.

Page 7: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.7

We have created our own development platform.

• Takes advantage of Open Source technologies.• Takes advantage of Novell® services.• Novell.LDAP: Works on Mono and Windows.

Binaries produced by mono run on Windows unmodified.

The community is creating an ecosystem• And we get to reuse third-party components

from the Windows world for Desktop and Web Applications.

Mono Has its Own Development Platform

Page 8: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.8

Mono SDK

C# compiler• Supports V1 and some V2 features of the C#

language.• Performs the task of compiler and linker.

IL tools• ilasm: Intermediate Language assembler.• monodis: Library and executable disassembler.

Debugger:• mdb: low-level debugger

Web Services• wsdl: generate stubs from a WSDL or Disco

document.

Page 9: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.9

The Mono Documentation Browser.• Documentation for .NET Class Libraries• Mono and Novell Specific class libraries.

Wiki-like support• People can edit, modify the documentation• Upload contributions to centralized server.

Sample

MonoDoc

Page 10: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.10

MonoDevelop:• A port of the venerable SharpDevelop from

Windows.• Modified to use the Linux Desktop.• Take advantage of Linux-specific features.• Advanced editing features.

Integrated Debugging Environment• Uses the Mono Debugger Core Engine.

MonoDevelop: Integrated IDE

Page 11: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.11

Assemblies.

Assemblies:• The deployment Unit.• They end in “.exe” or “.dll”• They contain IL code and any resources needed.

There is no difference to the runtime:

$ mcs hello.cs -r:library.dll$ mcs hello.cs -r:program.exe

$ mcs library.cs -target:library $ mcs program.cs -target:exe

Page 12: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.12

Sample Session.

Compiling Software:

Running your software:

Behind the curtains:

$ mcs program.cs

$ mono program.cs

$ monodis program.cs

Page 13: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.13

Disassembled code.

// method line 2.method private static default int32 'Add' (int32 'a', int32 'b') cil managed {

.param [1]

.param [2] // Method begins at RVA 0x20f4

// Code size 4 (0x4).maxstack 8IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: add IL_0003: ret

} // end of method X::default int32 'Add' (int32 'a', int32 'b')

static int Add (int a, int b){

return a + b;}

Page 14: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.14

Instrumentation.

The Mono Runtime can instrument your program:

You can create your own profiling modules.

$ mono --profile program.exe

$ mono --profile=coverage program.exe

So far:Internal call cost.Code Coverage Analysis.Mono can call you at invoke/return time

Page 15: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.15

Developing a Sample Client + Server

We will develop a client and a server.

Nat will be doing the client side.• Using Gtk# to write the GUI and Glade

for rapid prototyping.

Miguel will be doing the server side.• Plain server-side development.

We will use a web service.

Page 16: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

Demonstration

Page 17: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.17

Interop with Java

Converting Java classes to .NET assemblies• The ikvmc command

Exporting .NET classes to be used by Java• Using netexp.exe

Running your Java applications• Today Mono use GNU Classpath• Limited in functionality to GNU Classpath features• Eclipse, Jython run.

Page 18: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

© March 9, 2004 Novell Inc.18

Information.

Mono:• http://www.go-mono.com

Email:• [email protected]

Blog:• primates.ximian.com/~miguel/activity-log.php

Page 19: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

Questions & Answers

Page 20: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.
Page 21: Advanced Mono Development: Best Practices Miguel de Icaza CTO, Ximian miguel@novell.com Nat Friedman VP Software Development, Ximian nat@novell.com.

General DisclaimerThis document is not to be construed as a promise by any participating company to develop, deliver, or market a product. Novell, Inc., makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc., reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.

No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of Novell, Inc. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.