LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C ++ vs C# For Opensource Developement (https://www.linuxquestions.org/questions/programming-9/c-vs-c-for-opensource-developement-797319/)

Super TWiT 03-23-2010 11:16 AM

C ++ vs C# For Opensource Developement
 
I really enjoy linux and the philosophy it has with it and someday want to contribute back to the community. I was wondering which language I should focus on learning C++ or C#. I have no experience in either of those languages. I really hate bloated software, and I have heard C++ performs better. (Things like fluxbox are programmed in it I believe) However, C# is supposed to be the thing of the future, and automatic garbage collection is a nice plus.

EDIT:
Found my answer C++ DEFINATELY. I have another thread dedicated to what material I should use.
Thanks for your help!

MBybee 03-23-2010 11:27 AM

C# is a nice language (I like programming in it), and you can open source your code in any language. Mono would be your only real runtime choice outside of the MS world, however - and it tends to lag development by quite a bit.

C++ would be the better choice, though I must mention that GCC/G++ is a freaking mess. You'll end up making quite a few tweaks to optimize your code for the compiler rather than the other way around. You might want to try clang or some of the other ones.

johnsfine 03-23-2010 11:51 AM

Quote:

Originally Posted by Super TWiT (Post 3909159)
I was wondering which language I should focus on learning C++ or C#.

I think MS has a strong track record of trying to pervert standards to sabotage software development on non MS platforms. They tried and failed with C++ and I think the C++ standard is now far beyond their power to pervert that way. They tried, came a lot closer, but still failed with Java. That standard may also be beyond their control at this point.

I think C# exists for the original purpose of giving MS another shot at taking control of an important standard so they can pervert it later to the detriment of the rest of the software industry. I think they still are in control of future changes in the C# standard.

For any development on Linux, one advantage to C++ over C# is the lesser (not zero, unfortunately) influence of MS on the future directions of the language standard.

I also think C++ is a fundamentally better language than C#.

Quote:

I have heard C++ performs better.
When performance matters, C++ performs enormously better. The many comparisons "proving" the performance difference is smaller are distortions primarily based on examples where performance doesn't matter.

Quote:

automatic garbage collection is a nice plus.
Those are fighting words, meaning that once someone makes a serious comment agreeing or disagreeing with that statement, the thread tends to get taken over by an argument on that question and no-one ever convinces anyone. I disagree with your statement about automatic garbage collection, but I'd rather not have that fight again nor here.

paulsm4 03-23-2010 12:14 PM

C# is a great choice for Windows. And (with all apologies to Miguel de Icaza), Linux: not so much :(. In fact, Mono is pretty much "Bloatware Embodied".

Personally, I'd recommend C.

Or Java. Maybe Python or Perl. Or Lisp/Scheme, Ruby, Smalltalk/Squeak, OCaml, Erlang, or any of a zillion others.

But C# on Linux - sorry :(

IMHO... PSM

raconteur 03-23-2010 12:18 PM

Stick with c++. I've been using c# for about a year now and though I have developed a proficiency, I haven't developed any fondness for the language or any of its attributes. I don't believe it will catch on outside of MS for many reasons. Indeed, I have one project that I've spent about a month on now (a fairly simple service that communicates with serial devices, a database, and a web-based configuration) in c# and I'm going to scrap that code and write it in c++. The aggravations are just too many and I've reached a point of diminishing return.

Super TWiT 03-23-2010 12:47 PM

Yeah, I guess that answers my question. I was leaning towards c++ anyway, and have heard a lot about the lack of openess. I really don't want to get tied in to .net. I guess it really doesn't matter if it is "newer" because c++ is still going strong, and will be especially on non microsoft platforms. I had in my mind that c# would outmode C++, but C++ didn't outmode C. I am going c++ all the way. Any good gcc tutorials I should look at? I have how to think like a computer scientist c++ edition. It teaches generic c++ programming

MBybee 03-23-2010 02:40 PM

Quote:

Originally Posted by Super TWiT (Post 3909281)
Yeah, I guess that answers my question. I was leaning towards c++ anyway, and have heard a lot about the lack of openess. I really don't want to get tied in to .net. I guess it really doesn't matter if it is "newer" because c++ is still going strong, and will be especially on non microsoft platforms. I had in my mind that c# would outmode C++, but C++ didn't outmode C. I am going c++ all the way. Any good gcc tutorials I should look at? I have how to think like a computer scientist c++ edition. It teaches generic c++ programming

C# is definitely not outmoding C++. It's probably put a nice dent in VB, though.

johnsfine 03-23-2010 04:51 PM

Quote:

Originally Posted by Super TWiT (Post 3909281)
Any good gcc tutorials I should look at?

You want a C++ tutorial, not a gcc tutorial.

Especially for beginning C++ programming there isn't enough specific to gcc that you need to learn to even call that learning. There is a lot to learn about C++, but it is not specific to gcc.

In choosing your C++ tutorial, you will want to make sure you are selecting one that is not based on MFC nor .net nor Visual Studio.

You might want to select an IDE such as KDevelop or code::blocks. In that case, you would have an easier time with a C++ tutorial that is specific to the IDE you select.

Super TWiT 03-23-2010 05:32 PM

Yeah, I have how to think like a computer scientist: c++ edition, but it is generic. I was just wondering if there was anything more tailored to g++.

Sergei Steshenko 03-23-2010 06:44 PM

Quote:

Originally Posted by Super TWiT (Post 3909638)
Yeah, I have how to think like a computer scientist: c++ edition, but it is generic. I was just wondering if there was anything more tailored to g++.

Ironically, Microsoft C++ documentation/tutorials are good.

If/when you know C++ in general, you can read g++ documentation which explains g++ C++ dialect peculiarities.

And a lot of C++ nuisances have been successfully hidden from the programmer by 'boost' library - in a cross-platform way.

johnsfine 03-24-2010 09:26 AM

Quote:

Originally Posted by Super TWiT (Post 3909638)
I was just wondering if there was anything more tailored to g++.

My point was that "tailored to g++" isn't even a meaningful concept for a C++ tutorial.

There is nothing specific to g++ (other than the simple command to compile a program) that should be used or learned by a beginner.

You should be far more advanced in C++ programming before you have any interest in __attribute__ or any other features that are part of g++ but not part of generic C++.

This is in contrast to MS C++. A tutorial tailored to MS C++ would probably use MFC or .net or other MS specific features that wouldn't be available in generic C++.

A generic C++ tutorial shouldn't use MS specific features. That is all the tailoring to g++ you should want (simply not being tailored to MS).

As I said before, you might want to use an IDE. In that case it is very helpful to choose a tutorial tailored to that IDE. GCC is compatible with many different IDEs.

Also, you might want to write GUI and/or graphics programs early in the process of learning C++. If so, you should choose a GUI and/or graphics tool kit and choose a tutorial based on the tool kit.

MS C++ bundles all that in, so learning GUI or graphics with MS C++ probably means learning the MS specific GUI or graphics tools.

There is no GUI/graphics in generic C++ nor is there any GUI/graphics support specific to GCC. GCC is compatible with many different GUI/graphics tool kits.

MBybee 03-24-2010 10:13 AM

Seriously just start with a solid IDE and work the basic C, then C++ tutorials. Don't worry about advanced stuff at this point.

Once you need them you can start learning the compiler eccentricities for whatever platform :)

Sergei Steshenko 03-24-2010 03:50 PM

Quote:

Originally Posted by MBybee (Post 3910434)
Seriously just start with a solid IDE and work the basic C, then C++ tutorials. Don't worry about advanced stuff at this point.

Once you need them you can start learning the compiler eccentricities for whatever platform :)

I would recommend the opposite - learn to do programming without an IDE. And, if you wish, without a debugger. These are sure ways to learn to first think and only then do.

jamescondron 03-24-2010 04:25 PM

I'd go one further and suggest try to avoid IDEs at all cost, they promote a lot of really, really bad working habits and practices, and are way too resource intensive for what they are; a glorified text editor.

As for your main question; out of the two I'd recommend c++; it is more widely used in the community, and it isn't tied to one vendor; this allows for a much better language community. Much wider at the very least.

If I were to suggest another similar language, though, for my money it always has to be c. Its logically more sound (to me at least), it is a lot simpler than the others, it is quick, and it is fantastic to learn; you make a mistake, it is your mistake and no one elses.

It has also been a standard for what, 38 years?

MBybee 03-25-2010 12:49 AM

Quote:

Originally Posted by jamescondron (Post 3910871)
I'd go one further and suggest try to avoid IDEs at all cost, they promote a lot of really, really bad working habits and practices, and are way too resource intensive for what they are; a glorified text editor.

As for your main question; out of the two I'd recommend c++; it is more widely used in the community, and it isn't tied to one vendor; this allows for a much better language community. Much wider at the very least.

If I were to suggest another similar language, though, for my money it always has to be c. Its logically more sound (to me at least), it is a lot simpler than the others, it is quick, and it is fantastic to learn; you make a mistake, it is your mistake and no one elses.

It has also been a standard for what, 38 years?

Depends on what you consider an IDE :D

I consider Vim and Kate IDEs - not that Eclipse and Xcode don't serve a purpose ( I guess ).

The point is though, use something with syntax highlighting and you'll be on a good start. Something that uses fixed width fonts, especially.


All times are GMT -5. The time now is 08:29 PM.