Creating .NET C# Applications for Linux
An anonymous reader wrote to mention an article on the IBM site entitled Mono brings .Net Apps to Linux. From the article: "Mono gives open source developers the programming power and flexibility to build applications for Linux while maintaining cross-platform capabilities, using a variety of .NET-compatible languages. One of the great advantages of Mono for current .NET developers is providing an easier migration path to Linux. The Mono project has a very open and active development community and provides both developer tools and the infrastructure needed to run .NET client and server applications. Perhaps the most important benefit of using the Mono architecture is that you gain language independence. Mono lets you leverage any existing code from languages supported in the .NET runtime. "
IBM gave me mono... gross!
Sam
Given that Java was a new language, maybe the migration from MS developers wasn't all that great... but now, with Mono, MS developers can move right over.
Agile Artisans
I have a .NET Windows forms app that I'm looking to port to Linux using Mono. Anyone have any experience doing this? Is it something I should even bother trying to do?
Mono has been around and kickin' for almost as long as .NET has been. It still doesn't execute .NET 100%, but definitely something to check out if your a .NET person and want to use Linux.
Keep in mind that Microsoft saw .NET as cross-platform, but only between windows platforms. Java is far better in that respect. While full compatibility is in many cases impossible, the extra effort per platform is much smaller
The Raven
"maintaining cross-platform capabilities, using a variety of .NET-compatible languages." .. great! You can use Microsoft VC.NET, Microsoft C#.net, and Microsoft VB.net on any version of Microsoft windows. (Well recent)
.NET-compatible languages. One of the great advantages of .NET is providing an easier migration path to Linux .. " Is the poster on crack? He might as well say " .. using a variety of MFC based languages makes targetting to Unix easy.
maintaining cross-platform capabilities, using a variety of
Why do people even bother with Mono? I know I am going to be modded as a troll but I have yet to see a single app besides a hello world being cross platform? I think the developers looking at C# and Mono in a greater light than Java are ignoring the patent and copyright issues just because C# looks cooler. Thats pretty short sighted.
C# would be the lowest ranked languaged behind visual basic if you want to avoid vender lock in.
What will happen when C# 2.0 comes out? My guess is Linux will be playing catchup again and meanwhile windows will look like a better alternative to businesses standardizing on C# because their geeks mentioned how great Mono is.
http://saveie6.com/
You keep using that word. I don't think it means what you think it means.
Don't think of it as a flame---it's more like an argument that does 3d6 fire damage
With Java you now have a complete implementation of all language APIs on Windows, Linux, Solaris, HP and so on, not an incomplete port of .NET (Mono) potentially subject to Microsoft patents.
If the Apache Harmony projects succeeds (and it has a lot of backing) there will be a complete open source cross-platform Java implementation. There are already open-source Java versions that are good enough for many applications (gcj, Kaffe).
Mono is a waste of time.
A few years back, I had a serious Java epiphany. Try taking a JAR that runs on an IBM JVM (AIX) and, without a recompile or glitches, run it on a Sun JVM (Windows). It just works.
.NET runtime in Windows?
A C# program targeting the Mono runtime will probably be very portable to all operating systems that run Mono. But, will a Mono app/code base developed on Linux run just as smoothly on the
I read
I'm looking into wxWidgets vs. Windows Forms at the moment for a project I'm working on at the moment. It's my thesis research.
.net or "managed C++" thing, my project is pure C++. I haven't investigated wxWidgets close enough yet to see if they mandate all of my code has to be GPL yet. If not I will give it a serious look. The sample code didn't look quite as clean or object oriented as Windows Forms did, however, which I do value. One cool thing about Windows Forms is that you can keep the "old" C++ code seperate from the Windows Forms program and just call the classes without converting them to "managed C++" or .net.
Qt was eliminated right out - my project can't be made GPL (due to a piece of the code that is subject to export restrictions), and I can't afford the license cost for a commercial license (and the educational license was too restrictive: I could only develop on campus on a school owned computer.).
Windows Forms is looking very slick. Cross compatibility isn't a requirement, its something I would like. I havent bought into the whole
-everphilski-
Why does Mono show up so many times on slashdot?
.NET). I'm sure someone has written a decompiler for PDK binaries but the same thing could be done for .NET applications.
Why use Mono/.NET when you have ruby, perl, php, and python? All of which are cross platform? As far as only being able to give binary code to your customers ActiveState's Perl Dev Kit allows you to do just this (even though it's not free, but still less expensive than a license for Visual Studio
But honestly can someone who has done development in Mono and and the other aforementioned languages convince me or anyone else for that matter to learn C#/Visual Basic.NET, and enjoy what it has to offer? What does it offer that the other aforementioned languages do not?
C#/.NET was designed to be all that java is in terms of platform independence, but MOST importantly, VM and package versioning was thought of from the beginning. Makes the whole difference.
details. I will not use java, for anything, so long as licenses like theirs are forced upon it. With java, you are always a second class citizen.
GENERATION 26: The first time you see this, copy it into your sig on any forum and add 1 to the generation.
It's ECMA, not ANSI.
That's the problem. C# is open and can be completely cross platform, but .NET isn't. To me, though, the greatest part of using C# is having the .NET framework available to you. Mono is having to recreate the .NET framework on Linux, while Java's framework is already there (though not open source).
.NET framework. Six of one, half dozen of another, I suppose.
I'd rather use Java and have its full framwork available to me than use C# and a crippled, albeit quickly catching up,
This is by far the most hyped feature of C# but it's also present in Java. If you look at the large incompatibilities between Visual Basic and VB.NET you'll see that .NET is not really that language independent and that each language is really more of a "skined" version of C#.
As far as alternative languages go in Java there are many. Among the most popular are: JRuby
# interpreter written in 100% pure Java
# Most builtin Ruby classes provided
# Support for interacting with and defining java classes from within ruby
# Bean Scripting Framework (BSF) support
# Distributed under a tri-license (CPL/GPL/LGPL)
Jython (Python)
Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.
Groovy
Groovy is an agile dynamic language for the Java 2 Platform that has many of the features that people like so much in languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.
There's a lot more smaller projects like JavaScript and Rhino, Jelly, BeanShell, Tcl/Java, Sleep, ObjectScript, Pnuts, Judoscript. Some people event think there are too many alternative languages for the Java Virtual Machine.
Why Mono? The answer is extremely clear: outstanding tools.
.Net. That being the case, and seeing that windows developers largely use MS tools, it stands to reason they'd find targeting Linux via Mono the path of least resistance.
Microsoft has some of the best development tools around, and the best of their stuff targets
While Java is often suitable for enterprise apps or web based apps, it just isn't useful for consumer-grade application development
That will be news to the many developers who have produced such applications. Go to the Swing Connection on the Sun Java Website and you will see hundreds of applications that are consumer-grade. This includes games, graphics apps, and multi-media apps.
And, of course, there are the thousands of different Java games that are downloaded to mobile phones every day!
So much for Java not being 'consumer-grade'!
Why don't you ask Sun Microsystems? They seem to have a few good reasons.
Don't get me wrong, I happen to like both C# and Java, but if I have to create a gui app on windows for some reason, C# and .net wins hands down.
Yes, I realize I could use SWT, but that's still not necessarily good enough. It surprises me that Swing still sucks so much after all this time. I would love to use one language exclusively if I could, but until I see some decent gui apps being built using Swing, it's hard for me to want to use Java unless I have backend services to create.
Having said that, I would like to know if anyone can point me to gui applications that use swing and are actually good and fast. I'm curious if they exist at all.
I've been working with C# since .NET 1.0 Beta 1 and with Java since 1.2. When it first came on the scene, my initial reaction was very favorable to C#. Creating and consuming Web Services was incredibly easy (this was 2001, when SOAP had just arrived), and the builtin event/delegate model of .NET made event handling much more intuitive then Java.
.NET enhances productivity in .NET programming, although it is far inferior to Eclipse by way of refactoring tools, incremental compile, and plugin support. Even so, any productivity benefits reaped from using Visual Studio cannot be experienced in Linux, because Microsoft will not port Visual Studio to it.
Then along came Eclipse, which breathed new life into the Java development experience. Nowadays, Eclipse has become an integral part of using Java; most folks I know don't think twice about the IDE they'd choose to develop Java in. The best part of all this is that Eclipse is cross platform as well, which allows me to switch operating systems without hesitation. This could definitely be considered a path to Linux (and in fact, it has been for me).
In the same way, Visual Studio
The easier path to Linux doesn't come down to a language or its Virtual Machine. In the development world, it comes down to your development environment, which is at the core of what a developer does everyday.
I've been programming since I was in Gr. 5. From all the languages I've ever programmed in(BASIC,dBase, Java, C/C++, C#, Assembler etc...), my favourite is Java and C#.
:(
What I like about Java is that it is a modern language that uses modern concepts, is very well documented and its vast lib support makes it very useful.
C# also follows along the same lines of Java, making it quite similar except you have the option of getting out of the sandbox that Java uses. Some people need to get out of the sandbox for various purposes, and C# allows that, not Java.
If I were to choose, I would choose C# 1'st for this very reason and then Java. Unfortunately, I'm a hardware programmer, so I am stuck using C
Mono will always be on the fringes of acceptance like WINE... Never quite compatible and necessitating that you keep returning to Windows at least semi-frequently for that last bit of missing compatability.
No thanks.
Oh and MonoDevelop vs Visual Studio? Don't make me laugh. Well maybe one could run VS under WINE to get a decent IDE.
Sure they'll do it.
...to pad their resume. Read the classifieds lately? There's a lotta .NET jobs out there. It's nice to learn .NET without having to boot "that other OS", y'know.
Weaselmancer
rediculous.
Mono isn't produced by Microsoft, so it's unfair to compare Mono to Sun's JRE. Yes, Sun requires you to fetch the install file yourself (at least with Gentoo's Portage). But Mono is a GPL thing run by people not affiliated with Microsoft.
You can't compare the two. Try comparing Mono and Blackdown instead.
Linux: Creating .NET C# Applications for Linux
And tune in tomorrow for our feature on how to mount a Vespa motorbike engine in your Ferrari.
forma3
If people want an open-source, cross-platform environment, then there are plenty to go around. I use Gtk2-Perl, and I've written a number of Perl modules to assist database developers to connect their DB backend with their GUI. See http://entropy.homelinux.org/axis_not_evil
Gtk2-Perl isn't the only option out there. For Gtk2 ( which runs on Linux, Windows, OS-X, and an impressive number of other platforms ), there are bindings for PHP, Python and Ruby. That covers what most people are recommending for RAD these days.
Then there's QT. I haven't had much to do with it, but there are bindings for all the above languages and more.
There's Java.
I don't see the point in mimicking
And remember, as a wise man ( OK, it was Dubya, but anyway ) once said:
Just because you can't change a language like c# without permission from a standards agency does not free it from the influence of Microsoft. If they changed the language, then they would have to tell you for you to write with it, wouldn't they? The language syntax is not the part of .Net which is proprietary, the framework is. Microsoft is in complete control of all of their classes, namespaces, etc. They can change the setup, or expand it, and any time. More importantly, they have never and will never implement this framework themselves.
In my opinion, trying to implement .Net as a cross platform language is like trying to dig with a spoon. Microsoft has never been known for it's elegant (or even competent) designs. Compare any part of the .Net framework with a better implementation, like Java, and it is clear that once again Microsoft has made something which is needlessly over-complicated, inflexible, and just designed badly. I feel more sorry for the poor fools who are trying to copy Microsofts implementation than those who are dumb enough to choose it for cross platform development over better alternatives. In my opinion, of course, speaking as someone who has spent a few years working with ASP .Net.
Who cares about portability when mono is being used to make really sweet apps for gnome. I don't care about whether these programs run on Windows, I'm just happy they run on Gnome now. Examples of sweet mono apps for gnome Beagle, F-Spot (My personal favourite), Muine, iFolder. So what does it matter that Java is more portable than C#/Mono if mono means sweet apps for Linux now?
It's very easy to download the Sun JRE or JDK from Sun's website and to install it. Not much more effort that typing apt-get install.
I've been using Debian, Fedora and CentOS recently after years of using Slackware and Solaris, and I can tell you that all the package managers have their advantages and disadvantages, but really, downloading and installing the Java distribution from Sun really isn't that difficult.
Sun may have some strange attitudes towards the redistribution of Java, but from what I can gather this is due to stupidity and ignorance rather than malice. The wheels of beaurocracy turn very slowly in Sun.
Stick Men
Argument In Brief
;-)
1. Microsoft's C#/CLI licensing people, at high levels, are aware of us.
2. Microsoft can choose to do damaging things in the current C#/CLI licensing ambiguity.
3. Microsoft considers the free software / Linux community to be a major competitive threat
4. Microsoft does not "compete" gently
5. A + B + C + D = ?
The word pile amassed below defends points (1) and, in particular, (2). I take points (3) and (4) as given. I leave point (5) an exercise for the reader.
Stupid Disclaimer
Since I'm not a lawyer, I don't know if these disclaimers are important. But given the nature of the topic, I'll play it safe and write one. I'm not a lawyer, and this ain't legal advice, its just a dump my current thinking on an issue. It does not represent my employer's opinion. It may represent my cat's opinion, but only on the second tuesday of summer months.
Restatement of the Issue
Miguel has repeatedly stated that the patents necessary to implement the standards ECMA-334 (C#) and ECMA-335 (CLI) are available from Microsoft "RAND + Royalty Free". This seems like an effective open patent grant and encouraged me initially that we could do Mono. I really like Mono. Its terrific technically, and I'd love to be able to use it. But two problems upon further consideration the past couple months:
1. I've not seen an official statement by Microsoft that will let me trust the royalty free assertion. I think we are remiss if we do not assume Microsoft is looking for ways to, quite frankly, screw us. So unless there is a statement from Microsoft that they will have to stick to in a court, I feel (at the very least) uncomfortable.
2. "RAND + royalty free", can still seriously screw Free Software. I think this is more important than the first point. Even with RAND + royalty free you still have to execute a license agreement with Microsoft, and license agreements can stipulate things that are RAND from a corporation perspective but still screw over Free Software. Also, there is evidence that key Microsoft people are already aware of (or planned?) incompatibilities between the licensing scheme for C#/CLI and, at least, the GPL. The eye of Sauron is upon us. RAND + royalty free is very different from a patent grant.
In short, we are in an adversarial situation. Microsoft does not want us to succeed. Thus we cannot trust Microsoft, even if we'd like to, and must consider Mono based upon the question "What is the worst thing MS can reasonably do?". We can only trust Mono if we are convinced Microsoft doesn't have weasel room. The current situation appears, to me, to have lots of weasel room. The technical merits of Mono are basically irrelevant if its a trojan horse in the long term.
The Horror Story
So here's the obligatory horror story based upon what I see as our current course. Actually, I don't think this is taken to extremes at all. The GNOME actions look to me like the path we are currently on, and the Microsoft actions are not out of character, and look legally tenable based on what I know today. Microsoft can choose to not exercise these actions, but they will have the possibility (and will be more likely to the more successful the Linux desktop is).
* Act 1 - Novell hackers continue to push Mono. Novell hackers code most new independent programs/functionality in Mono and gradually start writing extensions to software like Evolution in Mono. Evolution's core continues to remain Mono free, but if you want features X, Y, and Z you have to use Mono. A few GNOME hackers write apps in Mono, some as toys, and perhaps a couple more serious. Red Hat hackers complain. Some try to weakly push Java and some stick with working in C & Python. Sun makes noise, and does their own thing, starts some wacky projects, tries to push Java with OpenOffice.org, and
Cut the crap. My computer has 512MB DDR RAM, and each time I use a Java application it starts swapping LOADS. The computer is nearly UNUSABLE due to all swap usage.
Strangely, mobile devices can run java in just a few 100k. The Java 5.0 VM itself can run in just a few MB.
Write a simple Java 'hello world' program, and you will find it can run in just a few megabytes (use the -Xmx switch to set the max usage).
So the claim that your machine will swap 'each time you use a Java application' is provably nonsense.
I'll start Eclipse, to tell you how much RAM the JVM will use (it might be a shock for you!).
It's an IDE for goodness sake! They are some of the largest apps.
Mind you, the NetBeans IDE can run quite happily in moderate memory. In fact, if you look at the IDE config file for NetBeans 4.1 you will see that the IDE is by default not allowed to use more than about 90-100MB.
In fact, I have just started it giving it a maximum memory of 64MB.
Try it yourself! I am using Java 1.5.0_04 and NetBeans 4.1. The configuration file within the netbeans install directory is etc/netbeans.conf.
So, on a 512MB machine, it isn't causing swapping. (It never does on my PCs, which have this memory).
Saying Java is performing nearly as fast or even faster than C++ is BULLSHIT.
If it is, then it is bullshit backed by considerable evidence. Last year there was a study of java speed for numerical work, using the well-known Linpack benchmark:
http://www.shudo.net/jit/perf/
Java 5.0 usually came within 5-10% of optimised C++.
So, I am sorry, but you are plainly factually wrong.
If you don't believe me, again, try it yourself. The source code for these benchmarks is available.
You may also be interested to know that Java is now so fast it can be used for real-time device control and AI systems. Boeing use Java for robotic and autonomous experimental planes, and one of the entrants for this years robotic road race has its software entirely in Java.
But I really worry that Microsoft has opened a large lead here with .NET, at least in the medium term. Most people have simply compared C# and the .NET framework classes against Java and base their assessment of .NET as a platform on that. But I think it misses the point somewhat.
The Bourne shell is powerful because it allows entire programs--even ones not specifically designed to work together--to be connected together: the utility of the system as a whole increases dramatically because of this network effect. With .NET, it's the same, except with classes and objects across languages previously incommunicado.
On Unix, every scripting language, by contrast, is pretty much an island by itself.
If you need a binding for say, MySQL, you'd have to implement it for Python, Ruby, Perl, Tcl and whatnot. Although tools like SWIG try to automate this, in general, every new binding (N x M of them) is written from scratch. One might argue that doing it this way makes the binding conform best to the spirit of each scripting language, but in practice bindings for important libraries are often buggy and incomplete, perhaps because the cumulative effort is too great or too much language-specific expertise is needed. This is especially true for complex GUI toolkits like Gtk or Qt, which cause headaches with complicated data structures. .NET bindings, on the other hand, are only necessary if they're for unmanaged code; even then, they need only be written once.
Re-using code from different scripting languages is very difficult. Suppose if, for example, a PHP programmer doing screen-scraping is fed up with the PHP/Curl bindings and wants to use Perl's excellent LWP::UserAgent module. Or, say, someone writing a Ruby shopping cart would like to borrow one of the payment library bindings in PHP? How is that possible? Wrapping the functionality into a stand-alone program (and hence using the shell and IPC as glue) is often so much of a hassle that people simply don't bother and end up re-implementing it from scratch. In .NET, this is almost trivial.
Every scripting language has to implement its own interpreter/virtual machine/compiler. Making a thread-safe and efficient one is not easy; making a JIT fast enough to even come near the efficiency of native C/C++ involves a great deal of messy, architecture-specific work. The CLR, by contrast, is common to all .NET languages and any performance enhancement to it is inherited by all. It's well-tuned enough that, for example, PHP.NET actually runs faster than the native PHP interpreter, even with the Zend accellerator product.
Packaging, deployment and building are different in each language. This can be a major problem when trying to glue scripts written in different languages together into the same project or getting the mess to install on the target system. Suppose it was an application which needs Perl 5.8 for one component, PHP 4.3.x (with mcrypt an GMP support enabled) for another and Python 2.3 (with PostgreSQL or MySQL bindings present) for others? How does one deploy this if the target system does not have one or more of these installed? Is there a simple way to put such an application in a test harness or even build it without resorting to a hodgepodge of install.py, MakeMaker and PHPAR? On the other hand, the only prerequisite for .NET applications need be the .NET runtime itself. Everything is compiled into the same common executable bytecode, so no additional interpreters are needed. Any assemblies the application depends on can be safely bundled with it even if the target system already has different versions of those assemblies installed.
I believe, after putting seeing all of these advantages put together, that Miguel de Icaza was right and that we cannot afford to dismiss .NET as merely a Java work-alike.
But imagine if all your applications took a couple seconds to open. Even notepads or terminals or calculators or system monitors. It would change the way you used your computer.
That is exactly the situation on all my workstations right now, and I have never seen a system that is faster. It changes nothing, of course.
I have stated that I do not want to wait even a few seconds for an application to load. It's obnoxious to me and, I would venture, most other users. I don't understand why you are supporting the idea that latency is good.
I am not. I am just saying that below a certain point it is completely irrelevant and has no impact on the user. I have been in IT for 25 years and have never seen anyone ever complain or have any issues with a 2 or 3 second load time. When you say that this is obnoxious to most users, I have good evidence from decades of IT support that you are just plain wrong.
If this really is annoying to you, you must find the majority of applications on any workstation intolerable! I use both GNOME and KDE routinely and I can't think of a single application that starts up in less that 2 seconds.
Small, orthogonal tools. That's the UNIX philosophy, right?
Sure. I agree. But that has never ever applied to GUI systems; they have always had some lag.
Also, please note that the bulk of Microsoft Word's libraries are NOT preloaded with the operating system.
Fair enough, but you mentioned Notepad. I would be very interested to see a 2 second startup for any Office application anywhere - Microsoft or otherwise!
Your statement's only grain of truth is that IE's rendering libraries are indeed preloaded (they are used within the Explorer shell).
Wrong. The text editing controls are preloaded (hence Notepad's speed), the menu and GUI controls are loaded, the file browsing tools are preloaded. (This is the advantage of a common GUI library in Windows).
Because of Java's failings, I dislike Java -> anything. Does this make sense?
No. Because as far as I can tell, what you are labelling as failings simply would not even be noticed by the majority of users, so I don't believe it is fair or sensible to call them failings.
Yet again, I would be interested in proof that a start-up time of a GUI app of a few seconds has any ergonomic impact on anyone anywhere, other than being annoying to you.
You are imposing a requirement on GUI software that almost no major GUI application meets. If such applications, written in supposedly high performance languages like Delphi, C and C++ can't do this, why should Java be any better?