What's better, C# or java? [closed] - c#

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.

Related

C++/CLI .Net telnet library [closed]

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.

Is C# truly viable for a modern web-socket server? [closed]

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.

What is the difference between C#.Net and VB.Net (Except Syntax)? [closed]

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.
Please let me know the difference between C#.Net and VB.Net. I use C#.Net for my projects, but when ever I met with some other programmers they often called VB.Net more powerful and easy, than C#.Net. I always asked them "Why it is more powerful then C#, since it uses the same framework?" but still I didn't get any helpful answers.
Pointers (C#)
XML literals (VB.NET)
VB6 leftovers (VB.NET)
A few other syntax differences
In the end, not a whole lot. Although, some say C# programmers are better paid (never looked into it, but it's possible).
It also depends on your definition of 'powerful' and 'easy'. Both are powerful at their jobs. C# may have a slight advantage in terms of performance since it has pointers.. but they are rarely used in most cases.
Technically, there is no difference except the syntax. Both use the Common Language Runtime (wikipedia) (msdn). They are just two different languages that use the same libraries, and actually compile to the same thing. This is one of the reasons you can write a library in VB.net, compile it to a dll, and include that dll in a c# program.
There are some small differences, but for the most part, the choice of one over the other is almost entirely personal preference. Personally, I find the c# syntax to be less prone to errors, but some people like the "english-ness" of VB.
It's the same thing. I don't even know why Microsoft have C# and VB since it really does the same things.

Best place to learn C++ for a C# programmer [closed]

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 11 years ago.
I have been developing using c# now since the first release of .NET. I have never really spent time on C or C++ and thought it would be a good idea to get a little more awareness. Does anyone have any recommendations for sites that would provide a good learning/tutorial for someone that has c# experience to venture into C++ a little?
Thanks
Warning: C++ is not C and the following is related only with C++.
If you are already a c# developer I think you should work in three different directions:
1) copy semantic, memory management and const keyword, these are the main differences between c# and c++.
Make yourself familiar with copy constructor, destructor and assignment operator. Learn how to use RAII idiom.
Study the differences between passing a variable by: value, reference and pointer.
I will suggest Effective C++ http://www.amazon.com/Effective-Specific-Improve-Programs-Designs/dp/0321334876 also guru of the week it is a great source.
In More Effective C++ there is a nice chapter on the difference between pointer and reference.
2) you need to make yourself familiar with the standard library, in my opinion this is a really good book http://www.amazon.co.uk/Standard-Library-Tutorial-Reference/dp/0201379260/ref=sr_1_4?ie=UTF8&qid=1314957062&sr=8-4
3) the standard library is great but not enough, you will soon need boost.
I am reading this book at the moment http://www.amazon.co.uk/Beyond-Standard-Library-Introduction-Boost/dp/0321133544/ref=sr_1_1?ie=UTF8&qid=1314957541&sr=8-1
I haven't finished it yet, but it looks good so far.
Keep practise, you are going to love coding in c++.
You've already been given several good suggestions, but the wealth of information available on StackOverflow alone may be a bit overwhelming, so I'll give you a very specific bit of advice.
Rather than look for a tutorial on the web get a good book such as "C++ Primer" by Lippman, Lajoie & Moo. It is useful both as a tutorial and as a reference and is currently the most modern among the good, thorough books about C++.
This tutorial is good Teach Yourself C++ in 21 days.
21 Days is an overstatement by the way, you can breeze through that tutorial a lot faster, but it's comprehensive and easily understandable, and I recommend it.
Good luck!

Examples where is Java more elegant than C#? [closed]

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 14 years ago.
It's been a couple of years since I last worked with Java.
Can you tell me what problems can be solved more elegantly in Java?
I am aware of the following benefits of Java:
Java 'runs everywhere',
Java has support for units and
measures
(supposedly) better latency in Java
J2EE (I don't think there is an equivalent in .Net)
different approach to generics (with odd circular definitions such as "Enum>", see Ken Arnold)
What about generics - are there elegant Java examples that cannot be represented in C#? Or other APIs or libraries?
Thanks,
Jiří
P.S. some general links:
Wikipedia comparison article
Comparing Java and C# Generics -
Jonathan Pryor's web log
Java generics are very different to C# generics. And yes, there are places where that means it can be more elegant - usually in terms of wildcarding and variance. On the other hand, wildcarding is generally poorly understood (and I very definitely include myself in that camp) and the whole business of type erasure means that in general I far prefer .NET generics.
A rather different place where Java "wins" IMO is its enum support. C# enums are basically named numbers - Java is much more object oriented. A similar effect can be mostly achieved in C# using nested classes, but more framework support (an equivalent to EnumSet) and switch support would be welcome.
I also like the ability to restrict visibility to a package (namespace) in Java - although this is the only side of Java's access rules that I prefer to C#.
Having used both Java and C# pretty extensively for a number of years, my own feeling is that on the language level C# is far, far ahead of Java. Really, good cross-platform support and a large existing codebase are the only two significant advantages Java has over C# and .NET at this point.
What does "better latency" even mean in this context?
Other than that, I agree with Jon Skeet. On the whole, C# is lightyears ahead of Java. There are a few tricks in Java that are neat (enums for example), but they're very much the exception, not the rule.

Categories

Resources