"Mono is a cross-platform. NET" is the right thing to say

Source: Internet
Author: User
Tags compact gtk silverlight

"Mono is a cross-platform. NET" is the right thing to say (go)

A recent discussion on Stackexchange's programming palette has raised the question of whether mono can be used as a cross-platform. NET. The discussion initiator put forward several "negative" views, including a number of people who responded to the mono creator Miguel de Icaza.

Thorbjorn in the question that mono is not a cross-platform. NET for the following reasons:

    • Java providers such as OpenJDK have passed the official Sun TCK to ensure normal operation, and Mono does not appear to have passed Microsoft TCK.
    • Mono's release is always lagging behind. NET, so how far does it support. NET?
    • Can GUI tools such as WinForm work properly under mono?
    • Business users do not use the open source framework as an alternative.

User Sparkie first responded to the above questions:

First, the CLI (Common Language Infrastructure) and. NET are different, the former is the public standard, and the latter is Microsoft's implementation of this standard, mono is another implementation of the CLI, it is never "portable . NET ". Similarly, C # is also a public standard, nor is it. NET is bound together.

Mono is somewhat backward relative to. NET, but only a tiny bit. Mono can run code for C # 4.0 (the latest. NET version), while Microsoft recently released all of the DLR code (using the Apache 2.0 License agreement), which means mono can use Ironpython,ironruby directly, and F # has also been open source, and Microsoft will regularly publish it. NET, so that mono developers can stay in sync with. NET almost always. Some of the tools and extensions in net, such as code contract, do not have a complete implementation in mono, but they are not widely used. If these extensions become popular, then mono will also provide the corresponding implementations. The

WinForm did not get a complete migration because they were. NET features, not part of the CLI. There is no specific component library defined in the CLI. There are a few component libraries that are cross-platform, such as gtk# and silveright, and if you consider portability from the very beginning of writing your application, you should not use WINFORM/WPF. In addition, mono provides a very thin package layer, and existing WinForm applications can be easily ported to gtk# (no need to rewrite them completely).

Mono provides a tool: Mono migration Analyser (MoMA), which can check one. NET application can be ported to mono (for example, if a non-portable class library is used, or p/invoke).

For commercial applications that do not want to use open source products, mono can use another authorization scheme, when the attribution of the mono code is entrusted to Novell, the authorization scheme is not LGPL.

Therefore, if you want to consider ". NET portability "This proposition, I think if you were to consider the portability of the framework from the outset, it was set up. But if I change the phrase, "I have a use." NET development of Windows applications, it should be possible to run on mono ", that's not true – but mono makes porting such applications much easier.

Then Lloeki talked about his way of working:

In addition to technical factors, the key is the way you write your code.

No matter what kind of cross-platform applications (such as Java,python,ruby ... If portability is not considered when writing code, then you should assume that the code can be executed directly across the platform at 0 (even if the likelihood is actually much higher). You can't just get an assembly to make sure it performs correctly in mono.

But for a new project (or a project that you can easily refactor), choose. Net/mono is wise as one of the portable scenarios, but for cross-platform code, you still need to test it constantly. If you use continuous integration, simply create a mono-built node. As long as you develop good habits (such as path separators), many of the problems can be solved during the development phase, while the vast majority of code use unit testing and other common practices, coupled with a little upfront planning can be very good cross-platform. The rest, such as platform-related code (such as P/invoke), can be encapsulated to provide targeted implementations for different platforms. Projects of this kind can be well transplanted with little or no extra cost.

Of course, the use of a non-existent or incompatible class library in mono is another matter, but for my own part, this has not happened. These are the practices we actually use at work, and I can safely claim that ". Net+mono" is a cross-platform solution.

For the level of support for Mono's. NET features, Robert and Michael talk about:

I've used mono, and I think it's just as good as other open source platforms, but not directly supported by Microsoft. If you can accept open source projects such as Clojure or Scala, mono can also make you happy. Mono Roadmap page is a reference to the support level for. Net. Mono is not the same as. NET, they are more or less different, for example now you can't use the entity Framework.

Mono is not a. NET transplant, and some technologies are not or are intended to be implemented by mono (such as Workflow Foundation or WPF), and they are also available in Microsoft. Other technologies, such as SIMD extensions, outside of net. To put it simply, mono and Microsoft. NET are two different projects based on the same base--cil and bcl--.

In the discussion, the mono creator, Miguel de Icaza, gave the most detailed response:

“. NET cross-platform "is a vague statement, whether the framework itself or the overall environment is constantly changing.

To put it simply, as. NET infrastructure, the CLI standard is cross-platform, but if you want to get the best experience on different platforms, you will have to use the targeted APIs on the respective platforms. The CLI technology family has never tried to "write once, execute everywhere", like the difference between a phone and a mainframe is too big. Instead of providing a unified API and runtime for different platforms, it is not as good as the best experience on the respective platforms to provide the right tools. Imagine a programmer who is not a Windows PC or UNIX server, knowing that there are too many exciting platforms for gaming devices, mobile phones, set-top boxes, distributed clusters, etc. today.

Microsoft's. NET Framework is not a cross-platform product, it can only run on Windows. There are also some on other systems. NET Framework variants, such as Silverlight in Windows Phone 7,xbox 360 and in the browser, have a slightly different configuration (profile).

Now you can use it on every major operating system, phone, mobile device, embedded system or server. NET technology, the following is a list of various implementations of the CLI, although not complete, but should be able to cover 99% of the situation:

    • Computers based on x86 and x86-64:
      • Windows: Generally you will use. NET or Silverlight, but you can also use the full mono.
      • Linux, BSD or Solaris: full mono or Silverlight.
      • MacOS X: Full mono or Silverlight.
      • A subset of Android:mono and Android.
    • Arm computers:
      • Windows Phone 7:compact Framework 2010.
      • Windows 6.5 and earlier: the early compact Framework.
      • Android device: Mono/android.
    • PowerPC computer:
      • Use the full mono feature on LINUX,BSD or UNIX operating systems.
      • Use mono in an embedded system, such as PS3,WII.
      • Run the compact Framework on the XBox36.
    • S390, s390x, Itanium, SPARC computers:
      • Full mono support
    • Other embedded operating systems:
      • Mobile configuration for. NET microframework or Mono.

Sometimes the same code is difficult to run around. For example, the XNA code does not run on each desktop, and vice versa. In order to. NET to run in different configurations, you need to modify a little bit of code. Here are some of the configurations I've learned:

    • . NET 4.0 Configuration
    • Silverlight Configuration
    • Windows Phone 7 Configuration
    • XBOX360 Configuration
    • Mono Core configuration: Same as the. NET configuration, can be used in Linux,macos x,solaris,windows and BSD.
    • The. NET Micro Framework
    • Mono's iphone configuration
    • Mono's Android configuration
    • Mono's PS3 configuration
    • Mono's Wii Configuration
    • Moonlight Configuration (Silverlight-compatible)
    • Moonlight extended configuration (Silverlight and the full. NET 4 API)

The above configuration is somewhat different, this is not a bad thing. Each configuration is designed to fit its platform, and removing any one is unwise. For example, the Silverlight API can control the browser, which does not concern the phone, and because of the lack of proper support, the XNA coloring feature does not make much sense for PC hardware. The sooner you realize. NET is not a solution that binds developers to a particular hardware or platform, the sooner they can become better developers.

This means that some APIs or solutions can be used on multiple platforms, such as ASP. NET can be used on Windows,linux,solaris,macos x because. Both NET and mono provide these APIs. At the same time, ASP. NET is not available on some Microsoft-supported platforms, such as Xbox or Windows 7, nor does it support Mono's Wii and iphone configurations.

The nature of other solutions is the same. To fully list these technologies requires a complex table, I don't know how to show them here, but here's a list of specific technologies and platforms:

Core runtime engine (all platforms):

    • Reflection.Emit support: All platforms except WP7, CF, XBox, Monotouch, and PS3.
    • CPU SIMD Support: Linux, BSD, Solaris, and MacOS X. PS 3, Monotouch and monodroid will be supported.
    • Continuations-mono.tasklets:linux, BSD, Solaris, MacOS, PS3, and Wii.
    • Assembly Uninstall: Only Windows.
    • VM injection: Linux, BSD, MacOS X, and Solaris.
    • Dlr:windows, Linux, MacOS X, Solaris, and Monodroid.
    • Generics: There are some limitations on iphone and PS3.

Language:

    • C # 4: All platforms.
    • C # compiler-as-a-service: Linux, MacOS, Solaris, BSD, and Android.
    • F #, IronRuby, and IronPython: All platforms except WP7, CF, Xbox, Monotouch, and PS3.

Server technology:

    • Asp. Net:windows, Linux, MacOS, BSD, and Solaris.
    • Ado. NET: All Platforms
    • LINQ to SQL: all platforms
    • Entity Framework: Windows only
    • XML Core technology: all platforms
      • XML serialization: All platforms except WP7,CF and Xbox.
    • LINQ to XML: all platforms
    • System.json:silverlight,linux,macos,monotouch,monodroid: Portable to other platforms
    • Support for System.Messaging:Windows, Linux, MacOS, and Solaris requires RABBITMQ.
    • . NET 1 Enterprise Services: Windows only.
    • WCF: The full version only supports Windows. Silverlight, Solaris, MacOS, Linux, MonoTouch, monodroid support themselves.
    • Windows Workflow: Windows only.
    • Cardspace identity: Windows only.

GUI Technology:

    • Silverlight:windows, Mac, and Linux (Moonlight)
    • WPF: Windows only
    • Gtk#:windows, Mac, Linux and BSD
    • Windows.Forms:Windows, Mac, Linux, and BSD
    • MONOMAC-native Mac integration: Mac only
    • MonoTouch-Native iphone integration: Iphone/ipad only
    • Monodroid-native Android integration: Android only
    • Media Center API: Windows only
    • Clutter:windows and Linux

Image class Library:

    • Gdi+:windows, Linux, BSD and MacOS
    • Quartz:macos X, iphone and ipad
    • Cairo:windows, Linux, BSD, MacOS, IPhone, IPad, MacOS X, PS3 and Wii

Mono class Library-cross-platform, can be in. NET, but it needs to be compiled manually:

    • C # 4 Editors and services
    • Cecil-cil operation, workflow, CIL probing, linker
    • Relaxng Class Library
    • Mono.data.* Data Provider
    • Complete System.Xaml (for setup,. NET does not provide this technology)

Monotouch runs on the iphone mono,monodroid for mono on the andriod. PS3 and Wii transplants are only available to Sony and Nintendo certified developers.

In the discussion, Miguel de Icaza also said that IBM had completed at least two mono transplants for AIX, but their transplant team did not get permission to feed back on its results.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.