As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
So with Microsoft .NET, you get the advantage of language interoperability. But I've heard that this is slower than native applications. What if you only need one language? Then what are the advantages. I am a C and C++ programmer, and .net seems to be heavily tied with C#. Is this the case? And is dot net portable, or tied to windows?
And lastly, is .net worth taking a look at, from the perspective of a C++ programmer who doesn't need language interoperability?
Thankyou.
Then what are the advantages ...
You get all the .NET classes.
'.NET is slow' is a misconception, along with 'Java is slow'. Yes, it used to be slower than native, and yes, you can get faster programs using hand-optimized assembly, but for nearly all cases short of core engine code for games, .NET is as fast as doing the same thing in C or C++, and can (in some cases) be faster.
You also get the huge benefit of automatic memory management (so you can new a heap object and then just forget about it), and a large class library at your disposal.
Language interoperability is one feature of .Net. It is far from the only feature in .Net. Don't forget things like advanced garbage collection, linq, improved api organization, and much more.
So with Microsoft .NET, you get the advantage of language interoperability.
This isn't the main advantage. Most people code in C#, most try to avoid working on a project using both VB and C#
But I've heard that this is slower
than native applications
.NET has memory management which may make it slower on some things. However, the classic example - games, a lot of XBox games are now written using XNA
And is dot net portable, or tied to
windows?
There is a project called Mono which has ported .NET to linux and there is a platform called MonoTouch which runs that code on iPhones.
However, broadly in its Vanilla form it is tied to the WindowsOS.
Then what are the advantages
Most people code in C# because it's a powerful language both on the web and desktop and has an easy learning curve and good tooling. It also has a powerful class library similar but more comprehensive than Java's (IMO)
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am working to develop an SDK that will allow the users to use it and write code in C# or Java.
To achieve this most optimally, do I have to write the SDK in both languages? That would be a lot of code repetitions albeit in 2 different languages, and the maintenance overhead would be very high.
Are there efficient ways to solve this problem? What will happen if someday we think of adding a 3rd programming language support for the SDK?
Please note that I don't mind having an API instead of SDK. The idea is simple -- it's basically an interface or kit that would provide users to make simple calls to it to perform certain complex actions, all complexity being abstracted into the API or SDK.
To avoid code duplication, there are different options.
you can create the base library in portable C++. C++ can then be interfaced in both Java (e.g. with JNI) and C# (e.g. with C++/CLI). That means that you can create a wrapper for both target languages using C++. This option is more difficult if you want to target more different operating systems.
you can create the software as a service (e.g. SOAP or a simple json service). You can do that in the language you prefer and then create client applications in Java and C#.
It depends on your project, the people who will implement it and on your future goals what the best solution is.
You could code the SDK in C++ and create java/C# wrapper classes to allow users to interface to the SDK
Also allows for easy extension to other languages as most languages allow you to utilise dlls wrote in C++.
Just an idea.
If you're interested read into DLL creation, the adapter pattern, JNI for java, not sure about C# I've not had that much experience
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am looking to make a Mud as a way of learning programming and enjoying it. Part of this is obviously working out a server client connection via the various clients muds use to connect. This uses Telnet for those who aren't aware. I was going to try to learn to do this myself but my father who is a professional programmer said its not that big of a deal to learn and using a library would allow me to move faster through it.
So my question is, first is using a library a better option here, and is there a good free one I can make use of that either uses C++/CLI .Net(preffered) or C# .Net(Was told this one is faster, but is less precise, so I would prefer to learn C++ for the precision, and I was told learning C++ is basically learning C# anyway)?
If using a library is not the best option, is there any good sites or books for finding a simple description on how to make one from scratch?
Most networking libraries will work with C and any variants thereupon.
C# will allow you to implement something (relatively) quickly and easily, but insulate you from programming issues that arrise from using less "safe" languages.
.Net is in fact a library, and it provides both C++ and C# interfaces.
Using a library is deffinately the best option, as it would be required unless you want to get down to the hardware level in every respect. For example the function printf() comes from the C/POSIX library, it actually fills up a buffer on a character device, which then get pushed to a real terminal over a serial interface, or far more likely a virtual terminal and then to your drawing library. Wether you know it or not everytime you use an #import or #include you are linking against an interface to a library. In the case of these simple libraries the compiler already knows where they are so you don't have to tell it about them.
In short C# will let you do things in an abstract and fluffy manner that may soften your learning in the begining, but will ultimatey prevent you from understanding what happened under the hood(and for many people that's ok). C++ will make your life more difficult, and it's compiler may give more cryptic errors, and it won't try to protect you from yourself, but you will probably learn a whole lot more. .Net is just the library your dad advises you use, as it provides a whole lot of functionality, without having a ton of dependencies.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to develop a fairly scalable socket server for an HTML5 / Mobile based turn-based type game.
Time is a real factor in this as I need to prototype out something in 3 months. I have extensive (years) of experience in C# and zero experience in Node or Erlang which I've singled out as the perfect languages for this project. Unfortunately, both of those languages will have a lot of learning curve associated with them and things such as code quality, unit tests, maintainability I will have no experience with so I imagine the code will be of a poor quality.
How bad of a decision will it be to choose to go with C# for this project to save development time as I will have a lot more headaches with scalability and things down the line.
Is C# seriously considered viable for a modern web-app socket server?
A person can write bad code on any platform. Or good code. Yes you can write a very good low impact highly-scalable server in c#. But if this is the first such you've written (regardless of platform), chances are you'll fail to write it efficiently, and then conclude it was the platform's fault.
As an example, the web-socket server that drives instant updates here on SO/SE is written in c#, handles 60k+ connections, and barely registers as any CPU. But it was designed for that, with fully async network access, buffer-recycling, dedicated worker threads, etc.
Actually, if you are specifically looking for web-socket code, then .NET 4.5 on Windows 8 will include inbuilt web-socket support via HTTP.SYS (with managed wrappers, obviously), but it can be done manually. I could possibly even share the library we wrote to do it.
Short: Yes.
Long: c# is statically typed, and it's actually compiled to native code (on Windows) and the speed is simply awesome in my experience. Consider it like C++ with garbage collector :-) Value types + true generics make things much faster than e.g. Java, and I would consider it good enough, too.
Note that you should not get scared by benchmarks game, it uses Mono.
And if you would really get into trouble, you can do unsafe operations if you really need them. So no need to worry for the future.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
Due to my future course in Computer Science, I'm now going to start learning Java.
I've been teaching myself C# and some C++ up until now, so I'm gonna switch to Java.
Just trying to think about what that'll involve, and any suggestions for sites that talk about the various comparisons between C# and Java for someone moving to Java?
Much of the fundamental logical operations and the class/object system work in the same way, and without the need for pointers or the need for more memory management, like in C++, which is great. The comparisons between the framework are the most important I think.
Also reckoning on switching to a Mac and running Java that way.
This from Wikipedia:
"Both C# and Java are designed from the ground up as object oriented languages using dynamic dispatch, with syntax similar to C++ (C++ in turn derives from C). Neither language is a superset of C or C++, however. Both mainly use garbage collection as a means of reclaiming memory resources, rather than explicit deallocation of memory (though C# requires explicit deallocation for graphical, GDI+ objects, in which case it uses the IDisposable interface). Both include thread synchronization mechanisms as part of their language syntax."
Here is a great article highlighting pros and cons of Java vs. C#:
http://www.veridicus.com/tummy/programming/java_vs_csharp.asp
And this one gives the syntactical differences for the same features:
http://www.harding.edu/fmccown/java_csharp_comparison.html
However, as a beginner, I think you will find that the languages are quite similar. C# may come in handy later, so rather than thinking of yourself as "moving" to Java, consider learning both.
I'm not sure this can be answered. There are plenty of arguments back and forth over which is better around the place.
They both have their advantages and disadvantages, but it really comes down to your situation and personal preferences.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I often read that one of the best ways to continue learning how to programme is to study great opensource projects out there in the wild. Can somewhere recommend a good open source C# project that they learned a lot from. I've been coding a couple of years, both windows and web apps, pretty standard stuff, sql server, asp .net. I'm particulary interested in improving my skills in building well architectured n tier apps
Thanks,
Brendan
Microsoft's own ASP.Net MVC project is open source. It's under their own license, which is probably pretty restrictive about what you can actually do with the code. But it's a pretty large project and interesting to look at.
Have you looked at Codeplex? There are over 800 open source C# projects there.
At the general level, I've found that standard library code is often good to learn from. Reading the source to application code is certainly useful. However, reading the code to STL, or D's std.algorithm or something that is similar, teaches you how to think on a higher level, and to create generic, reusable code. In contrast, application code is often more ad-hoc and heavier on boilerplate, and therefore not as educational.
For your specific case, I'd read the code to the libraries/frameworks you're using. It's interesting in and of itself to know how these things work instead of taking them as magic, and they're written by top-tier programmers and probably much higher quality and much more dense in terms of significant programming concepts per line than most application code.
MediaPortal. Some of it is fabulous, some of it is bad. However, if there is anything you want to do, its in there somewhere.
How about the OpenJDK (the open source version of the
Java Development Kit)?
Here is OpenJDK 6
Here is OpenJDK 7 (release planned for 2010 or so)
Have a look at the NHibernate code its fantastic
their repository is here