Hacker News new | past | comments | ask | show | jobs | submit login
Cross Platform Development with Mono (stephenhaunts.com)
53 points by stevehaunts on April 28, 2014 | hide | past | favorite | 43 comments



I must strongly recommend against using Gtk+ as a GUI toolkit for any serious application except on GNU/Linux. The biggest reason for me is that Gtk+ has zero accessibility support on Windows or Mac. That is, it doesn't work with assistive technologies which people with some disabilities need, such as screen readers for blind people. If you develop an application using an inaccessible toolkit, you're erecting a barrier for some people who might need to use your app, particularly if it's going to be used in an educational or business setting.

So, what should you use instead? Qt is better, but not great. It's still bad enough that TeamTalk, a voice chat app that's popular among blind people, has a cross-platform Qt app but also a "classic" MFC app for Windows. The latter used to be the official Windows client, but is now maintained just for blind users.

wxWidgets is better in some ways, because it uses native controls on each platform. Except where it doesn't; for example, the data view control is non-native on Windows, whereas the list view control is non-native in the Mac and GTK ports. and wxHTML is non-native across the board. Still, with some pain, wxWidgets can be made to work for cross-platform accessible apps.

SWT might be a good choice, if you can make it work for .NET/Mono using IKVM.NET. SWT is better than wx in that where it has to use non-native controls, it implements the platform accessibility APIs; it helps that SWT is backed by IBM, which has the resources to put into this kind of thing, and the incentive to do so in the form of sales to government agencies and the like.


I'd be interested to know what kind of problems Qt has with accessibility, I have personally not used the QAccessible* classes yet and would appreciate any tips from the field.

Some potentially interesting blog posts: http://blog.qt.digia.com/blog/category/accessibility/ I wonder what came out of the major upgrade in Qt 5, from looking around the web it seems to support MSAA fully and also I2A in some form.


I haven't looked at the state of accessibility in Qt 5. I'll have to check that out.


What are your thoughts on using a browser client library as a UI framework and write the UI in HTML? Like say use WebKit? I guess I can see how just doing the UI might be very doable but plugging that in with callbacks and the business logic a little tougher.


Interesting to see all the recent activity on HN about cross platform development. Seems like, as far as native code solutions go, C#/.NET is our best bet. As a C# junkie I'm excited about this, but also kinda sad that HTML5 cross platform development never really took off.

Edit: When I said "native code", I meant that Mono allows you to wrap native libraries with greater ease than anything else I've ever encountered.


I'm confused — how is C#.NET a "native code solution"? And what makes you say it's "our best bet"? I've been pretty pleased with PyGTK/PyQT cross-platform development, or, for that matter, Free Pascal LCL applications, if you want actual native code; I find them much less touchy to get working across platforms (though that could be just my relative level of experience with them).


Have you tired c#.Net recently?


It's been a couple of years; I've been writing for my own satisfaction, and C#, for all its inarguable advantages, is not that much fun.


.NET is definitely not our best bet, because once its out of Windows land, the quality falls sharply. Mono is seriously lacking [1] so does Monodevelop etc.

[1] http://mono-project.com/WPF


.NET isn't native code.


There are multiple native compilers for .NET. Xamarin uses one for iOS and Android apps (well, in the case of Android, you're compiling to Dalvik bytecode, but it's just as native as any other Android app).


Xamarin.Android apps do not compile to Dalvik bytecode. Every app ships with MonoVM which runs side-by-side with Dalvik.


Thank you for the correction; I seem to have had Xamarin on Android confused with Xamarin on iOS, which does compile to native code.[1]

1) http://docs.xamarin.com/guides/ios/advanced_topics/limitatio...


Of course it is not. It's a framework. C# on the other hand can compile to native. This is how it works on iOS.


No but you can wrap native UI libraries, the most critical piece that needs to be native. Contrast this with an HTML CSS UI.


You can wrap native UI libraries with just about every language in existence. That's not what people usually mean when they say "native" though. I think they mean precompiled to a binary for a specific architecture.


yeah you can. The whole native vs non native is about whether the UI is native and directly integrates with the platform, not the language or whether there is a runtime.


Err, well the article is about using Mono with GTK, which is not native outside of Gnome.


That's why you'd use monomac, mono touch or wpf on osx,iOS and windows, respectively. Xamarin also has a solution for android.


What about Qt? With python, C++, whatever...


It really does feel like the best bet.


"I still really like the .NET environment and C# language, ... "

This is not my case, but I really do find value in learning a technology that helps you build cross-platform solution. I seriously considered using it.

"Thankfully, there is the Mono .NET implementation that I can use and it is really well supported."

But it's kind of unsupported and most of the time it lags behind. Currently on my brand new ubuntu system, it's version 3.2, on my "stable" ubuntu its 2.10. The current version is 3.4.

" As well as being open source, Mono also has a company, Xamarin, sponsoring its development as they use the mono system for their IOS and Android ..."

You cannot develop iOS nor Android application on Linux with Xamarin, You need Windows or OS X.

This is old bug still accurate. https://bugzilla.xamarin.com/show_bug.cgi?id=142

This is an actual deal breaker for us. Haft of the team is using OS X and the other haft Ubuntu.


"But it's kind of unsupported and most of the time it lags behind. Currently on my brand new ubuntu system, it's version 3.2, on my "stable" ubuntu its 2.10. The current version is 3.4."

Isn't that more of a problem with Debian/Ubuntu than it is Mono? You're not comparing what Mono's released to Microsoft's .NET runtime, you're comparing what Ubuntu ships to what Mono themselves have released.


I understand that is not the actual status and capabilities of mono. But if you want to ship your app and use the latest feature, this is a problem.

If it's a couch-developed app for your own use, this is not an issue.


Sure, but that's an issue in packaging software for Linux that goes far beyond Mono/Xamarin. Any software you develop for Linux that has external dependencies is dependent upon the decisions of at least a dozen major distributions on what to support, package and ship. Solving that problem is way behond the scope of the Mono runtime.


Have they fixed the bug where you can't copy/paste between mono apps and native OS X apps yet?

https://bugzilla.xamarin.com/show_bug.cgi?id=3106

--

Steps to reproduce the problem:

1. Copy some text in any non-mono application

2. Paste it to mono application.

Actual Results:

Copy&Paste doesn't work.

Expected Results:

Working clipboard.

How often does this happen?

Always.

--

Wow. So by cross platform they mean "unusable GUI apps on Macs"


If you were going to develop a mono app on osx you'd be better off using monomac than gtk#. Mono develop is written in gtk# and cut and paste works just fine on osx.


My use case is the most basic one possible:

-Build a GUI app in C# -Run in on both my Windows dev machine (Windows 7), and my main desktop (OS X)

That's it. I don't care even what I have to use to build the app (Windows Forms, Stetic, etc).

Any advice?


If your app is something others will use, for the best experience you write your app in such a way that the UI is as swappable as possible. Then write a Mac UI with monomac and a Windows UI with WPF. If it's just you who needs it, then Gtk# might be ok for standard things. But don't expect good os integration without work.


Have you considered using node-webkit, AngularJs, and Bootstrap for your cross platform GUI needs?


The problem with this is you only get 1 thread for the UI and other stuff to run on.


What you mean by "unusable GUI"? The same button you clicked to get to this page looks 99% and acts 100% the same on every platform. A button is a button. A textBox is a textBox no matter what any platform call it.


Do these people actually use Monodevelop daily? Because my and a lot of other people's experience beyond a Hello World program is dismal.

And until you actually have cross platform development tools that don't suck, .NET is not a viable option.


The authoring platform doesn't matter as long as the product is cross-platform. Just use Windows to get the best development experience. I mean people use Sublime which is like a notepad on steroids and don't complain.


> The authoring platform doesn't matter as long as the product is cross-platform.

I think it matters a lot. That's why a lot of people don't care about .NET/C# actually, because they can't stand Windows.


This post inspired me to fire up my Linux mint virtual box and test mono. I'm every impressed by its potential. It does lack some awesome c# features like async/await. I've been using Xamarin for a while now and love it. My only fear for mono on Linux is the lack of XAML like interface equivalent. I dislike GTK. I'm keeping my fingers crossed :)


I'm pretty sure async/await is supported

Source: I'm using async/await in Xamarin.Android

Maybe it's because Linux Mint doesn't have the latest version of Mono in the package repository?


Nice, I just gave a talk on Xamarin and building cross-platform native apps at a mobile workshop this weekend.


I haven't used it in a while but Tcl/Tk with Tile (now known as ttk) used to be a decent solution for cross-platform GUIs with native-looking widgets. Among other things it had top-tier Unicode support and a declarative layout system (compare: QML). Is it still viable?


I love Mono Develop / Xamarin studio, but it needs split panes desperately.


Mono is not “cross” platform. It infects your environment with .NET which is very much a platform.


It is an environment that allows your code to run on multiple platforms. It is cross platform.


Whole world is infected with JavaScript runtime - a much bigger problem - but it sort of works.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: