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.
Days ago I created a program in Python to download stuff from the Internet, doing HTTP POST and GET and parsing JSON objects. I noticed some slow performance and I was thinking about writing it from scratch using another language, so I started to write it in C++ to make it faster. Finally I give up, C++ wasn't made for the Internet and it's very difficult to get something working.
I was thinking about giving C# or Java a try, which would you recommend? (I need my program to be fully cross-platform, other programming languages are valid too)
Edit: You can check the source code here: http://code.google.com/p/grooveapi/
Rewriting an IO bound application in a different language is unlikely to make any difference in its execution speed.
If you need it to be cross-platform: (i.e. you just write it once and it can run anywhere) Then Java or Python are your only options. This is because any C variant will need compiling specifically for the platform you intend to use it on.
My suggestion: Out of the two I would suggest Python. I have be educated in Java at University, and have learnt Python myself. Python is the language I turn to for web programming projects (in the form of Django on a larger scale) and the language used at companies I have worked for inside of their web applications.
Before you switch to another language... are you sure the performance problems are due to the language itself? It can very well be possible the problem is in the program, or the network latency or any other reason.
Don't blame the language before you've profiled your application carefully, maybe you have a bottleneck somewhere. The cost of a new development will be always very high, specially compared to a few line changes if you've found a problem in your code.
how did you notice "slow performance" when using python? I mean, python is slow, ok, but for your use case it shouldn't matter. Did you profile the code? Can you paste the code here so we can take a look and maybe improve it?
I don't know what kind of performance issues you had with your program in python but it usually does great for me ( scripts parsing log files that are huge take really little time for instance...).
now It all depends on the general purpose of this. If its just a script, no gui etc.. then you should definitely look into optimizing python, or doing some perl or php-cli script.
I'm not familiar with it first hand but ruby seems to have a big following and seems very "internet" oriented aswel.
If you do want to create something more than a script you have lots of options, c# is one of them, but it won't be cross platform, i'd go with java.
In the end I'd recommend rechecking your python code, it seems odd that its not doing what you want performance wise.... python is really good.
You should choose the language you feel most comfortable with. In most cases the performance of the scripting language is not the bottleneck. It is more important to get things done quickly and keep it maintainable. I would recommend you to choose Ruby or Python. If you have to get Python faster you still can choose to use JIT implementation like PyPy. Actually quite high traffic webapps, like YouTube, use Python.
I'd go with the good, old PHP! It has proven time and time again, that it is more than capable of doing this, and is quite easy to learn.
So my advice: Go with PHP!
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 10 years ago.
I'm looking for general opinion about which language would be best. Best in regards to many considerations.
I have a pretty strong background in c, c++, and objective-c. I feel quite comfortable with those 3. I have used very little c#. I've worked in firmware and middleware for over a decade and have moved into mobile apps lately. Mostly iOS, but now expanding to Windows RT.
I am about to write a version of my company's app for Windows Store (or Metro depending on what you want to call it). I did a proof of concept a couple months back using C++/CX. There were are few hurdles learning it (the syntax for ref classes, and the heavy use of namespaces), but that is in the past and I feel quite comfortable with it at this point.
Some drawbacks that I found were that most of the examples (both MSDN and private) of .net are in c# with fewer in c++. It also seemed to be a little tougher to get questions answered concerning .net frameworks with c++. Most of the time people would post a c# answer and I'd need to port it to c++ equiv. Sometimes this is easy, sometimes more difficult.
My question is: Would it be worth my time and my company's time to start over with c# instead of continuing in c++? I'd need to pick up c#, but I don't consider that a huge burden (actually looking forward to it). Some concerns are:
* Acquiring an more engineers down the road to work on this code. Our company will grow shortly. Will it be easier to find an engineer that knows c# vs MS's specialized c++/cx?
* Ease of getting help though examples, articles, and forums. If c# is much more common, that's useful.
* Compatibility between 3rd party libraries (Seems like WinRT components can be used from any of the main languages)
* Advantages of C# over C++? They both offer everything I need for this app, at least that I can see. What are some pitfalls of C#?
* Does c# use the continution/lambdas for asych programming in the same manner as C++/CX?
Are there any other pros/cons that I'm not thinking of?
What do YOU think? Also, what do YOU have experience with? Why do you back your answer?
C# would have the better online support (code examples, answers to questions), and the stronger base of engineers. I mean that in this specific situation, for this kind of strongly Microsoft APIs reliant software development. Windows Store highly important in Microsoft's overall strategy and C# is more important in their language strategy than C++. Thus, C# is the right fit, IMO.
*EDIT (Filip Skakun) I know reopening the question might be hard, so I can't answer it separately but I typed in all this text that could be useful, so I thought I'd add it below:
It is up to you to decide of course and it might be a very subjective choice depending on what you believe in, like if you think the higher potential productivity and better tooling and documentation support of C# outweighs the benefits of a faster, closer to the metal and (slightly subjectively) more portable C++ that you already know. C++ is still almost twice as popular as a language based on the tiobe index, so getting C++ developers might be easier than C# ones. C++/CX is something you only need to use for cross-assembly communication and talking to the WinRT library, but anything else you code should be done in the standard C++ based on all expert recommendations. Also note that C++/CX is not a managed language and you don't use it with .NET. It is highly similar in syntax though to C++/CLI which is a managed language. The good thing about WinRT is that you can use both languages if you want or need to. I use C# for all the XAML UI, networking, business logic etc. There are tons of samples for using C# with XAML while limited range of ones for C++ since it only became available and recommended for XAML platforms with WinRT. On the other hand for anything lower level like working with DirectX or CPU intensive tasks I use C++, since there is more documentation for straight DirectX than the open-source .NET wrappers for it and it performs better when you want to squeeze out all the potential power of the CPU or use the least energy from the battery.
C# is a bit cleaner language than C++ with less punctuation, the new async/await keywords that make async calls (which you must use in Windows 8 apps) a lot cleaner. It is also a managed language so in most cases you might not need to care about when memory gets released, about buffer overruns etc. Debugging C# code yields more deterministic results than C++ (I just spent 2 days debugging some C++ code and I still don't know how far along I am in finding the bug). It is also easier to maintain legacy code since debugging is so much easier.
C++ is faster, so it also uses less battery, your application will start faster and possibly use less energy. If you already know it well then you might have an advantage over the managed development crowd building apps out there. Because it doesn't use garbage collection - memory management is more deterministic and lightweight, so your animations will be more fluid.
Then there is also the motivation factor. If you really want to learn C# - you might be more happy, motivated and productive learning C# than the language you already know and will happily spend more hours learning it than you would be willing to spend writing another C++ app.
The underlying WinRT libraries are the same regardless of which language you use, but the .NET libraries are only available in .NET code and the standard C++ libraries are only available in native code.
Finally - regardless of what decision you make - you can always mix both languages. That could add to maintenance costs since whoever maintains the code in the future might need to know both languages and also the mixed language platform is very young, slightly less supported by the tools (you can't do mixed managed+native remote debugging for example) and potentially more buggy. It is a very good choice in many cases for the reasons I stated earlier though.
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.
What aspects of Objective-C do you like and why (specially comparing with C#)? Has C# lost something on the way comparing to older languages as C, C++ and Objective-C
1. Memory Management
I'd say one of the biggest benefits is the explicit memory management that Obj-C requires. At least, there is a garbage collector but you have to opt-in knowingly. I can't tell you how much thread deadlock and memory leakage I had with C# because I expected the GC to do my work for me. What it taught me was to make pretty much all classes in C# implement IDisposable. No object should ever assume that mommy will clean his room for him.
2. Message Sending
Rather than the concept of a "method", "messaging" seems much more realistic to me. You send an object a message, telling it what to do. It's mainly semantics, but it can make all the difference in how you design classes.
3. Message Syntax
Some consider the verbose style of obj-c messages to be a downside, but I personally like it. I can look at a line of code, and instantly know what all the parameters are for, without having to consult metadata. It's almost like Ruby in the sentence-like construction, just not as succinct. For example, seeing if one class is a subclass of another is quite readable to strangers:
[animal isSubclassOfClass:organism]
In addition, this verbose syntax starts to make you really think about how your program should be designed in order to minimize the amount of cruft that builds up. I feel that my classes in objective-C are much smaller and more purposeful than in C#. It's not easy to build giant super-classes full of methods. So, it promotes good design.
4. Deployment
When jobs exist for a technology that are primarily for deploying software, there is a problem. As a developer, I should be able to cleanly package something with the click of a button, and have it ready for consumption by my clients. C# is a nightmare, and while much of that has to do with the way Windows is built as opposed to OSX, they could learn a lot from Apple. Packaging with XCode is a breeze. It's not a language feature, but it makes all the difference when it comes time to actually deploying what you've written. Spend your time coding good software, not making installers.
5. Interface Builder
Again, this isn't really a language feature as much as an IDE feature, but it should be included. Interface Builder promotes MVC from top to bottom. Presentation logic is 100% separate from controller or model logic by design. Plus, it's just dead easy to use.
Objective C is a pure superset of ANSI C. Thus you can port and reuse a huge amount of C library code, emulators, numerical libraries, etc. written for Linux/Unix.
Objective C is also unmanaged, so you can access and optimize the bits in memory to your hearts content, which is useful if you are trying to minimize every byte and battery-eating processor cycle. Memory management is also explicit, which allows a competent programmer to minimize memory usage without wasting processor cycles to do it less efficiently via garbage collection. Basically, you can learn how to develop code that is can offer much better battery life on tiny portable devices.
If you know and like C# just goto Mono for the Iphone (http://monotouch.net/).
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 13 years ago.
C# is owned by Microsoft and Java is owned by Sun/Oracle. What dangers does that really expose to the users of these languages? Has anyone felt their code was "owned"? Do projects like Mono help keep the "owners" honest?
Please do not make this a holy war of languages. I just want to know if it's rational to avoid such languages or if that's just paranoia. An interview with the inventor of C++ got me thinking, but I also want to balance his thoughts with the thoughts of the community as a whole.
As compared to what? Since you put it in these terms, the original C and C++ languages are "owned" by Bell Labs.
Java is not "Owned", it is open source. If you find a bug in it that you absolutely cannot deal with, you CAN fix it. (There are both open source and closed source implementations, however)
I don't know if you can get the source code to C#, but since Mono copied it there IS an open source for that as well.
I don't know if there is a second source for the .net libraries.
As for the actual "Dangers" (Which was your real question, after all), it would be that the company decides not to release updates any longer--if they do, will the language wither and die or will it take off on it's own? Java is in the process of transition from one of these states to another. Sorry, don't know about C#.
There is also the (Perceived) danger I mentioned earlier about--can you fix it if you hundred-million dollar company absolutely needs it fixed in order to continue.
This was a more significant problem twenty years ago, these days the fact is that if it's a good stable language, this isn't something you ever need to worry about.
No such danger for C# language. It is an ISO standard. Formally it is owned by a committee. But Java is a trademark
Getting up in the morning is risky, but that doesn't keep the world under the covers.
I feel like this is one of those acceptable risks. In Java's case, companies have used it for the last 15 years or so to their benefit.
What's the alternative? Developing and maintaining your own language so you own it? That's what SAP did. It seems to have worked out for them, but it'd be interesting to calculate the cost they've incurred.
Bjarne Stroustrup is a brilliant man, but let's not forget that he has biases. He isn't happy that Java eclipsed C++ as the primary object-oriented language when it came out. He's attributed it to Sun's marketing, not conceding that it might have improved on C++.
It's a good practice to try and spot biases on the part of any speaker to make sure you're not swallowing someone's view whole. This is one of those cases.
If there are not two independent implementations, language is "Owned" and you are at the mercy of the vendor should he raise prices or can the product.
I don't like that.
EDIT: As often as not, you can count legally forkable codebases as two (the second is yourself).
Aren't all languages owned by a person/company/standards body. The only way I can think of where it isn't really owned by anybody is if the person who made it is anonymous and also public domain
hmm, well Xbox only supports C# for indie games, and no other platform supports it.
obviously the danger is that if you want to do multi platform code, you want the language supported by the most platforms, the more "owned" language is probably going to be supported by less platforms.
the only issue I have is support for the language, and how hard it is to convert from one to the other, for instance I would say c++ to c# is easier than the other way because of memory management.
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've been a "Microsoft developer" ever since I started programming... I started out by learning QBasic then ASP & Visual Basic and finally I moved on to learn VB.NET, ASP.NET and C# which is now my primary language. Still I've always wanted to learn something like Java or C++ to see how what the "other side" is like, and to learn the pros and cons of each platform. The only problem is that I never found the time or opportunity to pick up another language.
My basic understanding is that Java and C# have a lot of similarities as well as a lot of differences. Coming from C# I'm mostly interested in what C# could learn from Java, or put another way, what I'm missing out on.
Nothing, C# based itself on Java :)
prepares to be ridiculously downvoted
Should support Java like Enums, In C# they are just name for numbers !!
I think C# would be better off if they enforced the one public class per file and forced you to put your code files in a directory structure which matches the namespace (i.e. "package"). This is one thing I really like about Java that frustrates me in C#, especially when people start moving .cs files around, and putting multiple public classes in one file.
Personally I would have preferred to use the Java style for properties. I don't like the fact that properties in C# looks exactly like fields and yet have entirely different semantics. By making it clear that properties are really just methods there is no illusion and less risk of mistakes.
Anonymous interface implementation - Java does it, C# does not (yet).
For example:
// C#
interface IRunnable
{
void Run();
}
var runnable = new IRunnable()
{
public void Run()
{
Console.WriteLine("Running...");
// Do your running
}
};
runnable.Run();
checked exceptions
package visibility for submodules. AFAIK you can only have one module per assembly. I mean a group of tightly coupled classes which can see each other but should be hidden from the outside world.
C# obviously learned a great deal from Java, just like Java did from C++. They've traded back and forth in both language features (e.g., Java taking annotations from C#) and ancillary projects (NHibernate, NAnt, Spring.NET, POJO/POCO based development, etc. all have their origins in Java).
But I'm afraid that Java's not advancing anymore now that Sun lost market and people and has been sold to Oracle. I don't see anything coming out of Java or vendors that looks terribly new right now. Java 7 has been a long time coming, and it's catching up with closures and other things.
I think whatever energy is left in language development has passed to dynamic and functional languages.
The only development that I'm aware of that could change that is Rikard Oberg's Qi4J. He's so out there. It's just going to be a long time before it becomes mainstream, if ever.
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.
What do you see as benefits for one over the other? As far as I know, it's just preference. I have way more experience with C# than I do with Visual Basic and was wondering if I should dabble in Visual Basic for certain types of projects?
VB4 was my first language, with VB6 being the last time I touched it. I have moved to c# and wouldnt consider going back. VB just feels too fat and fluffy for me (preference).
All the .NET languages compile to IL though...
Note: c# is "closer" to java...
I personally prefer C#, I love the syntax and I feel really comfortable with the language.
Some say that C# programmers are paid better than VB programmers, but I think you should try both languages and see on which you fell better.
Top 10 reasons C# is better than VB.NET
Top 10 reasons VB.NET is better than C#
If you plan on doing any SSIS you will need to know VB. This one of few areas that I am aware of in which it truly matters which language you choose as SSIS only supports VB for any "integrated" code you write for it.
You are correct in saying that it is a preference as all .NET languages are compiled to IL. So choose the one you are most comfortable with and don't worry too much about it.
Coming from a curly-braces background I find c# to be a lot easier to read and write. I find VB.Net to be too verbose and some of the syntax (I'm looking at you, arrays) makes my eyes water.
I also get frustrated by the background compilation in VB.Net, especially on large projects where it can make the IDE unresponsive.
The only advantage VB.Net has over C# in my opinion is optional parameters. These make certain interop tasks a lot easier but I think c# is due to get them in 4.0.
VB.NET
In my opinion, C# was created only for marketing reasons to bring Java developers to .NET.
There are many more developer jobs in the job marketplace for C# over VB. Visual Basic got a bad wrap from the get go because it was an interpreted language. Back in the early days of computers, interpreted was bad and slow.
In the beginning, Microsoft built VB mostly for consultants to be able to quickly and effectively write internal software.
I cringe when I see C#, but these days, I write in JavaScript more than any other language and I love it.
VB's language keywords makes more sense to me over C#'s such as Imports vs Using. With declarations, I do not like having object type coming before the variable's name. And it seems that C# has many hidden rules with parenthesis and what not that a developer must know just to even read C#. Whereas VB is straight to the point and flows very nicely without crazy syntaxes.