What is the limitation of PerlNet? - c#

I've used PerlNet for a data extraction project. Perl is a powerful language for extracting data and text manipulation with a huge CPAN module. However, my program need some kind of UI, thread... which I decided to use .NET C#. With Perl Dev Kit, we have an option to wrap an Perl module to a .NET DLL and use this DLL directly from C#.
Everything was ok but I have one question about PerlNet architecture. As far as I know, PerlNet was a research project between ActiveState and Microsoft for running Perl code in .NET but I did not find any document for this.
What is limitation of PerlNet? How was PerlNet constructed?
Thanks,
Minh.

There's a book "Programming Perl in the .NET Environment" that may help you.
ActiveState doesn't seem to have any publicly accessible documentation online that gives any kind of details about PerlNET. But I'd be very surprised if there wasn't some doc included with the Perl Dev Kit, even though it sounds like they aren't providing any support for it anymore.
You may find answers to your questions on the perl.net#listserv.activestate.com mailing list or in its archives.

While I can't really say more about the way PerlNet is built than is readily available, I will say that from my experience, it is fairly clunky and not very reliable.
If it's a "real" project, i.e. money is involved, I would steer away from using PerlNet.
Specifically, it seemed to trash shared memory in .NET, and would cause crashes erratically.
That said, I haven't used PerlNet for some time so it could be a much better product now.

Related

How to use the vst sdk on the .net framework

I like making music using mostly my computer and especially love using synthesisers. There is a wide range of synthesiser plugins available online which are quite awesome. I have downloaded the VST (Virtual Studio Technology) SDK which is the platform that most plugins I know of use.
I would like to know if you can use the SDK on the .Net framework to write plugins; the only documentation and tutorials I could find is for C++ and I'm not that trusted with C++. I could learn to use C++, I taught myself C# in a week, but to use an unknown language and to learn other new concepts don't seem like a good combination.
Could anyone just give me pointers in the right direction on how to get started and even if it is possible to program it using .Net?
Regards Charl
Many beginners find VST.NET the perfect choice to start off with. It comes with some samples and with VS2008/VS2010 project templates that yield working plugins. So its a great way to start.
VST.NET provides a framework that structures and groups the VST API into manageable pieces. Out of the box it provides support for common functionality such as plugin parameters and programs.
So drop by at the VST.NET codeplex site and we'll help you get started.
BTW: To my knowledge the noise project has been abandoned and although VST.NET might not appear to be very active, I still continue to react on the questions posted on its codeplex site.
I second obiwanjacobi's sentiment. VST.Net is about the only .Net VST bridge out there that I know of and the community is great. It's an excellent framework.
https://vstnet.codeplex.com/
As for the statement: "doubt .NET platform would be adequate concerning the raw performance that a VST plugin requires". This is entirely untrue. My tests have shown that on a decent computer, .Net can very easily handle basic synthesis without even raising the CPU level above a few percent. Of course, it's not going to match C++'s performance for very complex synthesis, but in cases like this, there's no reason why you can't fall back on C++ to do the more complex stuff. In fact that is where Vst.Net excels. It would allow you to build very complex synthesis as a VST, and then leverage that in .Net.
At the same time, I think you'd be hard pressed to say definitively that .Net couldn't do very complex synthesis as well. I haven't really tried, but there's no real obstacles when you pay attention to the performance of your code, which would go for any programming platform.
On top of all that, there is now .Net Native to add to the picture. .Net Native has the potential to be AS fast as C++.
I remember hearing of noisevst and VST.NET, two C# wrappers for the VST API but I don't know how stable they are. And I really doubt .NET platform would be adequate concerning the raw performance that a VST plugin requires.
So I would recommend learning a little bit of C++. Yes, C++ is so big and complex that nobody on earth knows every feature of it. But for plugin development purposes all you need to do is to implement a couple of methods. You can start from the provided samples in the VST API. Audio DSP code wouldn't look much different if you'd use C#, C++ or any other mainstream language anyway.
If you also want to implement a GUI for your plugin, that's where the things start getting hairy. VSTGUI is simple but lacks many features. I can recommend WDL's iPlug framework but that would require a little more than basic C++.

C# or Python for my app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have the task of developing an application to pull data from remote REST services and generating Excel reports. This application will be used by a handful of users at the company (10-15). The data load can reach 10,000-200,000 records. I have been debating whether to use Python or C#...
The only reason I am considering Python is because I am familiar with it and it would be less of a risk.
Personally I want to try use C# since this would be a good opportunity to learn it. The application is not too complicated so the overhead of learning it won't be too much... I think.
Are there any issues with C# that I should be concerned about for this type of program? The users run Windows XP... would users not having .NET installed be a major concern?
Thanks in advance.
EDIT:
I guess I need to stress the fact that the end users should be able to run the application without installing additional libraries/frameworks.
Why not IronPython which merges the two worlds together?
If you want to learn C# and you don't have such a limited time constraint, now might be a good time to try it. Also, though I haven't done Excel work with either Python or C#, I would expect it to be easier to work with Excel files with a Microsoft product rather than Python. If you're just dumping data in CSV format to a file, though, either Python or C# will work fine.
If you want to try something even crazier, you can use IronPython such that you'll have .NET resources available but you can still write in Python.
I would normally say, use what you know.
However, here you may have some performance issues using an interpreted language. I, myself, would use C#. If you want to learn it, now is as good of a time as any.
However, if your own cost/benefit analysis reveals that you would be better off in python, use that.
.NET will be required for C# on windows, but you can use the .NET Client Profile to make the install pretty painless.
I realize this is an old post but I guess I have some pertinent information for anyone coming across this in more recent times, as I have.
The Python library, Openpyxl has worked well for me for manipulating and creating excel files in my desktop based automation scripts.
http://openpyxl.readthedocs.io/en/default/usage.html
It is accessing the file directly from my understanding, unlike the Interop technique in c#. So wherever it runs, you wouldn't need Excel installed. If you're trying to get something on a server it might be an issue getting a licensed copy of Excel or ensuring it exists if your user is running this locally.
Using C# you have the full features of visual studio to help code, such as the code completion, debugging tools and error highlighting. However you can get most of that with Python in Visual Studio, though I've found it more complicated trying to get the right version of python tied to the project and whatnot.
In C# you can easily compile an executable whereas I believe you'll need to mess with loading some Python libraries to get close to a similar local executable with dependencies comparable to the C# output.
If the users have to install a C# client then not having .NET installed would be an issue. You can package the installer so it downloads the .NET runtime, but depending on what features you use it could be quite a big download.
If your application is web based then all the C# code runs on the server and just delivers HTML to the browser so whether .NET is installed or not shouldn't matter.
Integration with Excel will almost certainly be simpler from C#. Given the requirements "Windows only" and "Integrates with Excel", it would seem a simple choice that C# is better suited to this individual problem.
And, no, users' not having .NET is not a concern compared with Python as the alternative. The Dot Net framework is a standard part of Microsoft Update. In contrast, Python will almost certainly not be there on the average end users' machine. In your case, with an internal app, that last point might not matter of course.
If you are doing any kind of HTTP work with C# make sure you take a look at the new HttpClient library that is in WCF REST Starter Preview2. Ignore the name of that download, the HttpClient part can be used independently of WCF.
It is a WAY better client than just using HttpWebRequest.
If you do a web based application not having installed .NET in the client machine wont be a problem .. but I suppose you dont want to try both C# and web development at the same time
It is easy with Python to pull data from a web server, parse the JSON or XML, and generate some kind of report. If you need really good Excel integration (for example, your output is supposed to be an Excel spreadsheet that includes numerous graphs) C# might be better, but Python is still possible; there is PyExcelerator for writing rich spreadsheet files, and there is Python support for COM if you want to use COM to talk to Excel.
With Python it is also very easy to make a stand-alone executable, for example with py2exe.
This sounds like a batch tool, one that won't have a GUI; I think I would write it in Python if I were you, unless I really wanted a fun project to help me learn C#. But anything with a GUI, C# is probably better. (I haven't done GUI development with Python, but I have seen comments here and elsewhere that the performance of Python GUIs tend to be slow.)
The answer probably has more to do with the circumstances than the question of which is the better language for the task at hand.
If you have no prior C# experience, it's probably not a good idea to jump into it now and learn it as you go along. Syntax differences are trivial to learn, mastery is defined by knowing the dirty details and how to use the language's strengths to get the job done.
If you have plenty of time and starting over a lot is NOT an issue, or you have experience with a language that is paradigmatically very similar to C# (say, Java or C++), you could probably afford to take the risk and adapt to the new language very quickly.
If you don't care about efficiency (e.g. it's a pet project, you don't care much about your job or efficiency simply isn't important), try C# just to learn something new (always a good thing) or stick to Python to make sure you won't have to adjust your thinking too much (always a source of vulnerabilities and misunderstandings).
If you definitely want to use C#, you should play around with it in your "free time" (not necessarily at home, but preferably at work when there's nothing else to do) and thus build a skillset you can use once you have to start with the actual project. This way you'll already be familiar with the paradigm (to use the term loosely) and encounter less problems where they count.

Effort estimation: using C / Win32 or learning C# / .NET

I intend to write a small application to scratch a personal itch and probably make the life of some colleagues easier. Here is what I have:
10+ years of experience in C
Plenty of experience in programming against the Win16/32 API in C from the Win3.1 to 2000 days.
C library written by myself already doing about 75% of what the application shall do.
What the application shall do:
open a binary, feed it into the mentioned library.
take the resulting text output and feed it into a new Excel Workbook.
apply some formating.
integrate nicely with the Windows environment (availability in "Open With...", remember some stuff using the registry etc.)
(maybe later) before giving the CSV data to Excel, parse it by looking up the meaning of some values in an XML file.
Except for the XML parsing part I have done all of that stuff before including COM / Office Automation in C/Win32. There is a lot of boilerplate code involved, but it is doable and the result will be a pretty small application without the need for an installer.
So why even think about C# / .Net?
no experience with parsing XML
the promise of less boilerplate code for the Windows and Excel stuff (yes, I have done C++ with OWL, MFC, ATL etc. but I am not going there anymore - not for free/fun)
Since I have also experience with C++, VB(not .Net) and a little Java / Objective-C I suppose learning C# will all be about the .Net libraries and not actually about the language.
My considerations so far:
Learning .NET might be fun and might result in less code / first steps in a more modern environment.
Sticking with what I know will lead to a predictable outcome in terms of effort and function (except for the optional XML stuff)
VB looked great at the beginning until the projects where about 80% done, then the pain started and the DLL coding in C. I am concerned history could repeat itself if I choose .Net.
My primary objective is the functionality. Effort is a concern. The XML parsing is optional.
Please advice.
Update: one thing I forgot to mention explicitly is that I am also worried about easy deployment of the tool to my co-workers. With Win32 I am pretty sure I can come up with an EXE file < 1Mb that can be easily emailed and does not require installation. With .Net not so much. Can I create the necessary MSI or whatever in Visual Studio Express (free) or do I need 3rd party tools?
as others have your question mostly covered, I'd just like to quickly comment on your considerations:
Learning .NET might be fun and might result in less code / first steps in a more modern environment.
Totally agreed. It is definitely fun and usually it does result in less code. The investment you make now will certainly benefit you in future projects. It is way faster to program in .Net than in C. Not only it is easier, but it is also safer. You are isolated from many programming errors common in C mostly related to memory mismanagement. You also get a very complete managed API to do stuff you would usually need to build your own framework.
Sticking with what I know will lead to a predictable outcome in terms of effort and function (except for the optional XML stuff)
Hence your indecision. :-)
VB looked great at the beginning until the projects where about 80% done, then the pain started and the DLL coding in C. I am concerned history could repeat itself if I choose .Net. My primary objective is the functionality. Effort is a concern. The XML parsing is optional.
.Net is an entirely different beast from VB. Most of the things you wouldn't be able to do in VB, or at least do them easily, are supported by .Net. For instance, Windows Services are a snap to build in .Net. Socket programming is also supported, but there are very few reasons to do it yourself, as you've got loads of communication APIs with .Net. You've got web-services, .Net Remoting, MSMQ management, and more recently WCF. Proper multithreading is supported by .Net, unlike the idiotic apartment model in VB. In case you really need to go low level, you can also actually use pointers in C#, inside of unsafe code blocks, even though I would never advise to do so.
If you really need to do things in C, then integrating is also relatively easy. You can create COM objects and use interop to work with them from .Net. You can also interact directly with plain ol' dlls using DllImport. Using www.pinvoke.net makes it easier.
When I developed in VB, sometimes I also had to go back to C++ to do stuff that I wasn't able of doing in VB. Since I began programming in .Net, the only extremely rare scenarios I would need to go back to C++ were when I needed to use legacy COM components that used types I was having a hard time to marshal via interop. I wouldn't worry about history repeating itself.
If you're using COM, you may be interested in using C# 4.0 instead of earlier versions - the downside being that it's only in beta. But basically it makes COM stuff somewhat less ugly for various reasons.
I'd expect there to be plenty of good C libraries for XML parsing by now. I would expect the main benefit to actually be the knowledge gained. I doubt that you'll actually produce the code faster for this project, but the next one may well be a lot quicker.
How much do you care about learning new stuff?
It sounds like an ideal project for learning C# & .NET.
You know most of what you need to do so you can use that to gain a base level of understanding of C# & .NET which you can then apply to the stuff you need to learn.
As Rune says though, a key driver could be the timescales. If this is something you need in a hurry then coding it in C & using win32 directly might be the answer.
Sorry I couldn't be more definite.
I think you should use C#. With your experience the learning curve won't be too steep. The code will ultimately be cleaner (and less of it) than you probably could with C/Win32.
There is probably going to be no problem using your existing C-library with the [DllImport] attribute.
It depends. :-) It depends on whether you want to do this quickly or if you want to learn something new. It depends on whether you will be the only maintainer of the code or if others will maintain it in the future. It depends on how complex your xml handling will be and on how complex the COM automation is.
You will probably get a working application quicker if you do it in C than in C#. Both since you have much of the stuff needed already in place and since you know C well.
But this project sounds like a good match for C# and .Net. .Net has great support for XML and COM interop is easy but clumsy in C# (much better in the next version!). So if you are interested in learning C# and .Net this would be a good project to do so.
I would definitely do this in .Net and probably C# (but I am biased). Using .Net would probably result in code that is easier to read and maintain and most probably easier to write. So if you are interested in learning C# I would suggest you go for it!
Edit:
You worry about the size of the executable if you write it in .Net. I doubt that will be a problem, for most if not all of the libraries you will use for a project like this will already be installed on your computer. 1 Mb is rather large for a .Net executable, event for a big project.
a short notice on the installation. .NET is as default xcopy-able so you wouldn't need an installer for the exe to be usable. Mail it around (or with the next release of the .NET framework optionaly leave it on a network share)
You could look at building a hybrid system that uses C++/CLI and C#. C++/CLI provides a nice bridge between the two and lets you easily split different parts of the system between the managed and unmanaged worlds.
Not sure if the setup projects are included in the free versions of visual studio. But you could use clickonce (included with the framework) or WIX (open source XML based msi creation tool).
learning C# will all be about the .Net libraries and not actually about the language
No there are many things you need to learn about the language (delegates , events , generics ...) and also it is object oriented and it manages the memory by itself and yes no pointers :)
anyway C# and .NET are great all you need is some effort to get up to speed

Is there a reason I should not start with C#

I think I'm leaning toward C# and .net as a concentration language for learning web development. I would like to learn good programming fundamentals and I've looked at pretty much everything else. The four I've narrowed it down to have been C#, Python, Ruby and PHP. Is there a reason to stay away from C# (and I don't think the cost issue would really apply to my solo-developer situation but I could be totally wrong). Any thoughts?
I realize that these are all great languages so I'm not trying to ask which is the best overall. However, would Ruby be a viable alternative for a first language or does it have too much "magic under the hood" coupled with Rails, and unorthodox methodologies? I do like what I've seen with the language.
This is likely to result in a flamewar but I think C# is a pretty good language to start with for Web Development.
It is a full featured object oriented language and is statically typed and compiled. It's very well documented and has a huge developer community.
If you absolutely have to run on Linux/Apache and do not want to use Mono, that would be a reason not to use C#. Other than that, I don't think there is a compelling reason not to, particularly with ASP.NET MVC, which lets you move away from the WebForms model.
This is not to say that WebForms is necessarily bad but some might object to WebForms as it introduces abstractions that are not inherent in other web development platforms.
If you go with C# for web development, depending on your experience with web technology, I'd heartily recommend starting with ASP.NET MVC before ASP.NET Web Forms.
ASP.NET Web Forms is the original style of building ASP.NET applications, and tries to abstract a lot of the details. It allows you to build applications without realising what's happening under the hood (post data, state management). In my opinion, these abstractions although making things easy at first begin to "leak" when you get into more complicated scenarios (as this tutorial proves).
ASP.NET MVC on the other hand makes it easier to build web sites that are a lot "closer to the metal" while still keeping you productive. If you want absolute control over the resulting HTML and aren't afraid of things like cookies, form tags, post and query string data, then you might enjoy ASP.NET MVC a lot more.
Of course it would be beneficial to know both. But if I was starting now, I'd probably start with MVC and move to Forms (then realise how bad it is and move back :)).
There are no "best language over all". You use one tool for the purpose it has been made, that's why there are several tools.
Since your question is "why not learn C#", I'd say :
If you plan to work with other OS then Windows (Mono cannot compare).
If work in an env or with people not .net friendly (e.g : bank, scientists)
If you work in an env or with people that are expert in another good tech (never underestimate the use of a good master).
If you think Free Software matters so much that using a MS product is not worth it.
If you don't like MS Visual Studio (working in c# without a good IDE is a pain).
If You plan to program something that .net is not suited for (e.g embedded devices, scripting, real-time, fault tolerant system, AI, etc).
If you are a web dev and can't afford a Windows Server Licence.
If you want to learn programming with the very basics, including simple functions and quick and dirty scripts.
Now, I program in Php, Python, Java and C#. Python is my language of choice, but c# is really the first MS programming tool that seduced me : it's clean and efficient. Really, it's about what you want to do, not a question of religion.
Make YOUR choice.
That's said, C# sucks and Python rocks.
I agree C# is a pretty complete language, it's syntax is clean and extensible. There's a huge amount of web resource already available, but and it's a big but, it effectively ties you to windows as your platform. For web especially that's an important consideration. On the desktop windows is king, but for web servers the market it isn't nearly so dominant.
Another side issue, if you're looking at rich media on the web you have to consider Flash and/or Silverlight. If you go C# then you're someway to using Silverlight without learning a different language.
Don't worry about the cost. The compiler is free to use, along with the rest of the Fx SDK, and you can even download Visual Studio for free.
The disadvantage to learning C# is that it ties you to a proprietary platform and software stack. Now, there is Mono, which does a good job of implementing much of C# and .Net, but the primary and most complete implementation is Microsoft's which is non-free.
I have not used C# enough to debate it's technical merits with respect to Ruby or Python. I can say, however, that learning to use and even contribute back to free software can be quite educational, in addition to the other benefits (discussed in length elsewhere) that free software provides.
c# is a good language to start with because:
It is a very good and very clean language
It has an excellent library (.NET framework). This is one of the most important things to consider when choosing a language.
It is very popular, you'll always be able to find the answer you are looking for from the community.
If you know c#, you pretty much know VB.NET.
c# is syntactically similar to Java. Learning c# won't teach you Java's libraries, but it will significantly reduce the learning curve if you want to enter the Java camp.
c# is syntactically similar to c++. Again, it uses a different library and unlike c++ you get memory management; but the learning curve should be somewhat reduced if you decide to play with c++.
As for the web...
ASP.NET webforms does a lot of magic for you. ASP.NET MVC (just released) does almost no magic for you. For learning, MVC is the better choice.
C# is a great language to use. And since you are using it via the web and not desktop applications for example, you don't have to worry about being multi-platform since the code is run on your server and the output delivered to the clients. With that said, you will have to find Windows hosting (which can sometimes be a bit more expensive) or use mono (which isn't exactly the most updated software out there). The downsides are minimal though, grab a copy of the express edition and go for it!
I think the cost of deployment might be a different thing, i.e. if your project needs to scale horizontally, and add more servers to load balance or even for geographically distributed servers. Usually the windows hosting will run a bit more than linux (without even considering the flame wars reasons).
C# is fine for starting if you are doing web development. However, I recommend that you don't start programming with web development. Web development is hard to get right. Way harder than little command line things. I recommend that you get some good experience programming for the command line, and then move up to GUI, and then move on to the web. The web has a whole bunch of things you have to worry about. You have to know 3 languages (HTML, JS, C#(or insert your server side language here)). Plus you have to worry about all the browser quirks and stuff. And that's without even getting into databases. Which is usually used in most web applications, but opens up a whole other can of worms.
Considering all the answers so far, I thought I'd look at all four languages mentioned.
While I've done a lot of development in PHP, and sadly continue to do so, I think PHP was never a great language (though it had a few great elements) and these days there's not much point picking it up. It remains extremely easy to get into but I think in general, PHP is a "bad habit".
Python is a great language, but to me, Ruby is all that Python is and a bit more. Personally I would go for Ruby.
C# is also a great language, but while I haven't used C# enough to say anything with confidence, I feel that Ruby is a better choice.
No reason in particular to stay away from C#. It's as good a language as any. Stackoverflow uses it for example, so it works on a successful website, and you can get jobs programming in it.
The proprietary thing would be a consideration if you were programming as a hobby or off your own limited budget, or you wanted to contribute to the development of the compiler/language. I'm guessing neither of these are the case. (Edit: as others have pointed out, open source environments for C# exist.)
It depends on a couple of things. C# and .Net is populate and th tools are really very easy (complared to Java! Java developer talking here...) but Windows Hosting is expensive vs LAMP (which include Ruby, Python and PHP).
For me it all depends on the tool that you want to use. For web services etc I would use C# but for a simple website PHP since its easy.
It also depends on the job market of your location... here in South Africa you get alot more C# jobs and not much PHP etc. Off course if your a freelance you will struggle to find work.
For me Ruby again is good for my own person stuff but you don't get any Ruby jobs here.
My advice? Learn the differences for yourself. Play around with both of them. If you have a project in mind, write a prototype for it in them. You'll always be at the mercy of other peoples' biases otherwise.
ASP.net (C#) and Ruby on Rails are used in high-profile sites, so you can't go too wrong with either one. Might I also suggest that you try out Python programming with django? It's what I tend to prefer for web programming.
I'm a C# .Net developer and I think it's great, but I'll highlight a danger in the Asp.Net WebForms. It is unlike the majority of other web frameworks and does A LOT of magic under the covers. As others have said ASP.Net MVC is probably more inline with other web frameworks (Rails for example). Web Forms abstracts a lot of the nuts and bolts of webdev away which If you want to be web developer you'll end up needing to know. So yes C# is great but I'd start with MVC and then look at web forms possibly. Also looking at other languages and frameworks is highly encouraged there's always stuff to learn.
Commercially I am a C# developer. I love C#. C# is a great strongly typed language. With Resharper installed I can build my ideas in code rapidly and flex it to my will.
When I go home each evening I use Ruby. Even though I have no refactoring support (snif.) I find I am much more productive in Ruby than in C#.
I worked writing a large ASP.Net application for a couple of years. We implemented MVC to try to detangle the view from the model. It always felt like I was fighting the framework, not working with it. The latest .Net frameworks for doing web application are based on Rails... just a couple of years behind. I love the language. I love the CLR. I'm not too keen on .Net.
I find the ruby community to be friendly and vibrant. The rails open source community produces loads of tutorials and plugins that make getting up to speed easy and putting your application together simple.
Another thing to consider (as far as choosing a language to learn) is that ruby is an Object Oriented language. Even classes are objects. C# is a Class Oriented language, ie. it provides you one way to create objects.. define a class first. (not totally true.. you can generate assemblies in memory using codedom.. but that is by no means easy).
This may seem like a subtle point, but there is a difference.. and until you get experience with an OO language like ruby or smalltalk it's not obvious what that is. Once you have felt the freedom of building objects by mixing in functionality at runtime etc. you find that all the 'work-around's you had to do in C# disappear. Not having the safety net of interfaces does seems scary at first.
In all, I'd learn ruby..
If you are new to programming (totally) I'd start with http://pine.fm/LearnToProgram/
Then I would learn BDD (RSpec) and get test infected as soon as possible.
Then I'd consume rails tutorials and screen casts until my eyes popped
The only problem is .. if you start with ruby then later go to C# you'll find yourself going "Aaaaagh! This would be so much easier to do in ruby" all the time. I know I do.
It really depends on what you are trying to achieve. I program in both and to be brutally honest, if you are trying to make a career out of programming, I get paid twice as much for .NET programming. The types of clients that I do PHP dev work for are not the types that pay a lot (PHP is often chosen based on saving some $$$). .NET seems to be much more entrenched in larger corporations.
Just my observation...
No disadvantages really except that you will be unwelcome in those social groups (and even geographical regions) that pose themselves against the "evil Microsoft".
The language (better .NET platform) is quite good. One important thing is that it is being very actively developed causing some people trouble keeping up. But I'd rather have rapid development compared to year-long stagnation.
You might consider checking what employers in your area prefer as a technology stack.
Considering licensing costs you can consider the following: If it is a small site you can use Visual Studio Express/SQL Server Express for free and it will be sufficient. If you come up with some major heavy trafficked project you will likely to find a way to make revenues and cover licensing costs.
Learning C# is great in 2009.
Way back in the day, when I entered the professional world, the language landscape was very different. I coded professionally in C and Modula 3 (Pascal replacement language).
My point is that I would plan for the technical landscape to change over time, and plan for that in your professional career development.
Learning multiple platforms is a great way to accomplish this. For example, you could have C#/.NET as your primary skill, but also work with JAVA. When a new platform emerges, you could add it as your transition or backup skillset.

Why doesn't Sun do a C# to Java byte code compiler?

We Want to Run Our C# Code on the JVM
My company has a large C# code base. Well over half of this code is our core engine for creating, reading, modifying, calculating and writing Excel workbooks. We frequently get questions from customers and potential customers asking whether we are going to build a Java version of our engine - many of them are not at all interested in the UI. We even have a few customers who have taken the trouble to use our .NET library from their Java applications.
So, we would like to build a Java version of our core engine, ideally without maintaining a separate Java source code base.
Eric Sink described this problem very well. I am in a similar position except for the fact that our software license includes royalty free deployment, making Eric's choice of Mainsoft a nonstarter for us.
I have been Googling the likes of "c# to jvm" every few months for several years now with no joy. Having spent ~7 years developing similar software for Java, I am confident that the .NET APIs we use in our core engine could easily be encapsulated and we could accomplish everything we need using the Java libraries. So, if we only had a C# -> JVM compiler we could build our core engine for Java and we would no longer have to turn away Java developers who would like to use it.
I am not asking for the technical reasons why Sun does not do a C# compiler. I recognize that Java has no properties or an unsigned 64 bit long, etc... For the sake of argument, just assume that all of these technical issues could be dealt with by extending the JVM and / or other means.
And I am not asking for yet another debate on why one language / stack might be better than the other. The reality in our business is that there are plenty of potential customers using each.
Why Should Sun do a C# Compiler? (IMO of course)
Making it easier to run C# code on the Java platform means more developers and more software for the platform. Is there anything more important to the success of a platform? Jonathan Schwartz is a software guy. I will leave it to others smarter than me to decide whether or not he took on an impossible job as President and CEO of Sun, but having met with Jonathan shortly after he joined Sun my impression is that he understands software and the need for a large base of developers.
So Why Doesn't Sun do a C# Compiler?
NIH syndrome?
The ghost of Scott McNealy?
Too many Java developers dislike or distrust anything related to Microsoft?
They agreed not to as part of taking the big bucks?
???
There must be a good reason. I just cannot for the life of me figure out what it is...
Firstly Sun has zero incentive to implement a C# compiler on the JVM because they have something very similar called the Java programming language.
Its also not really as simple as just implementing a compiler as the Java standard class libraries are not the same as the .net Base Class Libraries. You would end up having to change all the .NET API calls to Java API calls.
Micrsoft had a product called J# which was meant to be for Java to .NET conversion but in the end no one used it as the API was limited to pre Java 2 API so it was mostly useless. It would be the same if Sun implemented parts of the .NET BCL, as only the core portions of it are standardised and royalty free. Parts like ASP.NET and WPF, WCF etc are not part of the ECMA standards and so Sun would need Microsofts permission to implement those API's.
If enough customers want a java version to make business sense to port your application to java then do it, you just wont ever get any help from Sun via a C# to JVM compiler.
Joe Erickson wrote:
Making it easier to run C# code on the
Java platform means more developers
and more software for the platform.
This is an untrue statement. Running C# code on the JVM does not create Java programmers, it creates C# programmers who can execute on a JVM. It only expands the reach of C#, assuming the JVM also translates any microsoft specific calls (i.e. win32) into something that is platform neutral. So if Sun translates IL to Java Bytecode, the only group it helps is: Microsoft. And, given Sun's history with Microsoft during the original C#-Java schism/Visual J++ lawsuits...
Plus, you have to face the technical infeasibility, whether you want to or not. There are fundamental differences in the way the bytecodes are executed that are far more important issues than whether or not there's an unsigned long datatype.
If you must have C# on a non-Microsoft platform, use Mono
Why doesn't Microsoft do a C# to Java byte code compiler? Why don't you do it? There are open specs on each side...
"So, we would like to build a Java version of our core engine, ideally without maintaining a separate Java source code base."
Basically, you want to compile your C# code unmodified, and have it run in a Java-only environment.
IKVM is not what you want. IKVM is three main things.
a. ikvm - CLI implementation of a Java virtual machine (note that this uses Classpath (now OpenJDK) for the Java class library).
b. ikvmc - Compiles java bytecode to CLI bytecode.
c. ikvmstub - Generates java stub classes that call CLI code.
Note that all of these tools depend on CLI at runtime. What you want is exactly the opposite of IKVM, which is of course MVKI (Most Venerable Kompiler Intermediary) :):
a. mvki - Java implementation of a CLI virtual machine (presumably this would use Mono or DotGNU for the class library).
b. mvkic - Compiles CLI bytecode to Java bytecode.
c. mvkistub - Generates CLI stub classes that call Java
Note that none of these would require an existing implementation of the .NET Framework at runtime, so they should be satisfactory to your Java-only customers.
Unfortunately, as far as I know MVKI does not exist, so you're best off doing a manual port (which would inevitably be cleaner, albeit more work).
Edit: Based on the description of Mainsoft, it appears to be similar to MVKI, though I'm not sure what they do for the class library, and unlike IKVM it's not FOSS.
http://jsc.sourceforge.net/ is a c# cross compiler that can convert .NET code to Java (amongst other things).
Expose your .NET API as ASMX web services and you should be good to go.
EDIT: For more heavy-usage scenarios, it would be worth looking into Windows Communication Foundation (WCF). This has built-in, configurable support for security, streaming, different transport scenarios (HTTP, TCP/IP, local named pipes). You are not restricted to SOAP message encoding, but that would probably be the easiest way to interop with Java.
I'm not too sure about your exact scenario, but if you're dealing with large files and the .NET code and Java code are both running locally, you can just save the file to the user's hard drive using .NET and then fetch it from your Java app.
There must be a good reason. I just cannot for the life of me figure out what it is...
It is easy to believe that companies are non-profit organisations which have your interests at heart. It is easy to forget that the only purpose for a listed company is to make money for it share holders. This is a legal obligation and directors/executives have been sacked/sued if share holders don't believe they have failed to do this.
Sun makes Java free because it helps sell their hardware which how it makes money from Java. IBM makes Java free because it helps them make more money on their consulting.
If Sun were to spend money on a C# converter how would it make that money back and make a profit. Imagine you have to convince Sun's share holders. If you can, Sun will make a C# converter.
I wonder whether the Mono project could have made less work for themselves by targeting the JVM instead of developing and maintaining their own virtual machine from scratch. Development effort could have focused on a C# cross-compiler and porting clean-room implementations of the .NET libraries to the JVM. Sort of like an open-source version of what Mainsoft has done. You could then enable inter-language calls between Java and C# code in the same JVM, and deploy Applets and Java Web Start applications written in C#.
I know this might not be what your looking for, but here are some possible alternatives that (if not to you) could be useful to others.
C: You could port as much as possible to C. Now you can make a wrapper in C# and Java (and any other language that can communicate with C) that makes it feel native to their language while programming. The problem now is that you (or them, depending your license) has to build the C part for each platform.
Fantom*: A programming language that according to their home page,
is:
Portable: Write code portable to the Java VM, .NET CLR, and JavaScript in the browser.
Familiar: Syntax Java and C# programmers will feel at home with Fantom's evolutionary syntax.
Object Oriented: Everything subclasses from Obj. Value types when you need the performance.
Functional: Functions and closures are baked in.
Static and Dynamically Typed: Don't like the extremes - take the middle of the road.
Haxe*: (pronounced hex) is cross platform language that compiles to other languages. Soon C# and Java will be supported. It currently supports:
Javascript: You can compile a Haxe program to a single .js file. You can access the typed browser DOM APIs with autocompletion
support, and all the dependencies will be resolved at compilation
time.
Flash: You can compile a Haxe program to a .swf file. Haxe is compatible with Flash Players 6 to 10, with either "old" Flash 8 API
or newest AS3/Flash9+ API. Haxe offers very good performance and
language features to develop Flash content.
NekoVM: You can compile a Haxe program to NekoVM bytecode. This can be used for server-side programming such as dynamic webpages
(using mod_neko for Apache) and also for command-line or desktop
applications, since NekoVM can be embedded and extended with some
other DLL.
PHP: You can compile a Haxe program to .php files. This will enable you to use a high level strictly-typed language such as haXe
while keeping full compatibility with your existing server platform
and libraries.
C++: You can now generate C++ code from your Haxe source code, with the required Makefiles. This is very useful for creating native
applications, for instance in iPhone development.
Haxe Community. (2011, March 11). Haxe Introduction. Retrieved January 29, 2011, from http://old.haxe.org/doc/intro
You can learn more about why Haxe is useful here.
*I have never used this language and I don't know how well this would work.
I made a comment that should really have been an answer:
It is just not technically possible at this point to implement the C# spec on the JVM. C# supports pointers, unsigned types, user defined value types, true generics, passing by reference, and loads of other things. For a very C#-like JVM language, check out Stab.
Mainsoft fakes it. I am sure it takes enormous effort on their part.
Have fun.
Must break checked exceptions.
Must find a way to implement delegates (which are like single-method interfaces added no earlier than load time).
You can run your .NET code and Java code in the same interpreter! See the IKVM .NET-based JVM, and the Boo and Java wiki page for an example use case (using the .NET-based Boo language to write applications using Java libraries).
Joe, I suggest you investigate IKVM. You might find something there that scratches your itch
If i was doing something like cross platform cross language support, I would create a 'common api' since the languages are similar in syntax you could make a translator easy enough. Then instead of calling java or .net apis directly from the core, you would call your 'common api' which would re implement the java and .net apis you would need. In this way you could create a cross language sandbox if you will. Since the main differences in java and c# are object definitions, I would get those by reflecting the C# dlls, and then reconstruct the constructs, then it would be easy to have an interpreter run through and implement the function bodies and convert properties to getters setters already knowing the structure of the files. This of course is assuming .net 2.0, some of the features in 3.0 and 3.5 become very difficult to 'interpret'
It would be complex, but probably not as complex as reconstructing a core in java by hand, and having to have 2 teams working on them seperatly. If this idea sparks some inspiration i might create one. I would really rather see a simpler stable mono installation for mac.
Basically I think a code level interpreter based on a set of common api classes is something very possible to write with a team in a week or two.
Simple. Because Sun would rather not be sued by Microsoft. And while we as programmers might see no viable reason for a suit, keep in mind that Microsoft is quite a bigger company than Sun and has the power to boss them around.
Sun fortunately is in the position of being quite more open than Microsoft however. If such a demand exists, either open source or a third-party could make this compiler for Java and Sun wouldn't have to take the heat.
JACIL is an apparently dead project that attempts to do the reverse of IKVM. Perhaps some motivated folks could use it as a starting point for a viable .Net to JVM compiler.
I guess the better question is why don't you write a C# to Java byte code compiler, if you want one to exist. Waiting for corporate overlords to do something is a bad idea.
A suggestion for creating such an implementation: take Mono's or .GNU's C# front end. Don't bother writing your own.
I think you will find that the Mainsoft, Enterprise Edition tool allows you to run most/maybe all your .NET code under the Java JVM... Seems to be focused more on ASP.NET but will allow C#. It has been available for some time, pity they don't publicize it better!
Warning blurb follows....
Mainsoft® is Java-.NET
interoperability software that enables
IT organizations to move to
Java-enabled platforms such as Linux
while preserving existing investments
in .NET code and skills. The software
integrates seamlessly into the Visual
Studio® development environment,
enabling C# and Visual Basic
developers to rapidly develop and
maintain server and Web applications
that run on Windows, Java EE platforms
or both, thereby reducing application
development and maintenance costs,
time-to-production and total cost of
ownership.

Categories